package blusunrize.immersiveengineering.common.util.compat.jei.blastfurnace;
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.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import java.awt.*;
import java.util.List;
public class BlastFurnaceFuelWrapper extends BlankRecipeWrapper
{
private final List<ItemStack> fuel;
private final String burnTime;
private final IDrawableAnimated flame;
public BlastFurnaceFuelWrapper(IGuiHelper guiHelper, List<ItemStack> fuel, int burnTime)
{
this.fuel = fuel;
this.burnTime = I18n.format("gui.jei.category.fuel.burnTime", burnTime);
ResourceLocation furnaceBackgroundLocation = new ResourceLocation("minecraft", "textures/gui/container/furnace.png");
IDrawableStatic flameDrawable = guiHelper.createDrawable(furnaceBackgroundLocation, 176, 0, 14, 14);
this.flame = guiHelper.createAnimatedDrawable(flameDrawable, burnTime, IDrawableAnimated.StartDirection.TOP, true);
}
@Override
public void getIngredients(IIngredients ingredients)
{
ingredients.setInputs(ItemStack.class, fuel);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
minecraft.fontRendererObj.drawString(burnTime, 24, 12, Color.gray.getRGB());
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
{
flame.draw(minecraft, 2, 0);
}
}