TechReborn/1.11/jei/grinder/GrinderRecipeWrapper.java

46 lines
1.5 KiB
Java
Raw Normal View History

2016-02-25 14:17:33 +01:00
package techreborn.compat.jei.grinder;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic;
import net.minecraft.client.Minecraft;
import techreborn.api.recipe.machines.GrinderRecipe;
import techreborn.client.gui.GuiGrinder;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
2016-10-08 21:46:16 +02:00
public class GrinderRecipeWrapper extends BaseRecipeWrapper<GrinderRecipe> {
2016-02-25 14:17:33 +01:00
private final IDrawableAnimated progress;
2016-10-08 21:46:16 +02:00
public GrinderRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
GrinderRecipe baseRecipe) {
2016-02-25 14:17:33 +01:00
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiGrinder.texture, 176, 14, 20, 11);
int ticksPerCycle = baseRecipe.tickTime();
2016-03-25 10:47:34 +01:00
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
2016-10-08 21:46:16 +02:00
IDrawableAnimated.StartDirection.LEFT, false);
2016-02-25 14:17:33 +01:00
}
@Override
2016-10-08 21:46:16 +02:00
public void drawAnimations(
@Nonnull
Minecraft minecraft, int recipeWidth, int recipeHeight) {
2016-02-25 14:17:33 +01:00
super.drawAnimations(minecraft, recipeWidth, recipeHeight);
progress.draw(minecraft, 25, 7);
int x = -45;
int y = 4;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
2016-10-08 21:46:16 +02:00
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
2016-02-25 14:17:33 +01:00
}
}