/******************************************************************************* * AbyssalCraft * Copyright (c) 2012 - 2017 Shinoow. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt * * Contributors: * Shinoow - implementation ******************************************************************************/ package com.shinoow.abyssalcraft.integration.jei.crystallizer; import java.awt.Color; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import javax.annotation.Nonnull; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawableAnimated; import mezz.jei.api.gui.IDrawableStatic; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.BlankRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.translation.I18n; public class CrystallizerFuelRecipe extends BlankRecipeWrapper { @Nonnull private final List<List<ItemStack>> inputs; @Nonnull private final String burnTimeString; @Nonnull private final IDrawableAnimated flame; public CrystallizerFuelRecipe(@Nonnull IGuiHelper guiHelper, @Nonnull Collection<ItemStack> input, int burnTime) { List<ItemStack> inputList = new ArrayList<>(input); inputs = Collections.singletonList(inputList); burnTimeString = I18n.translateToLocalFormatted("gui.jei.category.fuel.burnTime", burnTime); ResourceLocation furnaceBackgroundLocation = new ResourceLocation("abyssalcraft", "textures/gui/container/crystallizer_NEI.png"); IDrawableStatic flameDrawable = guiHelper.createDrawable(furnaceBackgroundLocation, 176, 0, 14, 14); flame = guiHelper.createAnimatedDrawable(flameDrawable, burnTime, IDrawableAnimated.StartDirection.TOP, true); } @Nonnull public List<List<ItemStack>> getInputs() { return inputs; } @Override public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { flame.draw(minecraft, 2, 0); minecraft.fontRendererObj.drawString(burnTimeString, 24, 12, Color.gray.getRGB()); } @Override public void getIngredients(IIngredients ingredients) { ingredients.setInputLists(ItemStack.class, inputs); } }