TechReborn/1.11/jei/centrifuge/CentrifugeRecipeWrapper.java

63 lines
2.5 KiB
Java
Raw Normal View History

2016-03-13 17:08:30 +01:00
package techreborn.compat.jei.centrifuge;
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.CentrifugeRecipe;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.compat.jei.BaseRecipeWrapper;
2016-10-08 21:46:16 +02:00
import javax.annotation.Nonnull;
public class CentrifugeRecipeWrapper extends BaseRecipeWrapper<CentrifugeRecipe> {
2016-03-13 17:08:30 +01:00
private final IDrawableAnimated progressUp;
private final IDrawableAnimated progressLeft;
private final IDrawableAnimated progressDown;
private final IDrawableAnimated progressRight;
2016-10-08 21:46:16 +02:00
public CentrifugeRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
CentrifugeRecipe baseRecipe) {
2016-03-13 17:08:30 +01:00
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressUpStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 14, 12, 12);
IDrawableStatic progressLeftStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 26, 12, 12);
IDrawableStatic progressDownStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 38, 12, 12);
IDrawableStatic progressRightStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 50, 12, 12);
2016-03-25 10:47:34 +01:00
int ticksPerCycle = baseRecipe.tickTime() / 4; // speed up the animation
2016-10-08 21:46:16 +02:00
// a bit
2016-03-25 10:47:34 +01:00
this.progressUp = guiHelper.createAnimatedDrawable(progressUpStatic, ticksPerCycle,
2016-10-08 21:46:16 +02:00
IDrawableAnimated.StartDirection.BOTTOM, false);
2016-03-25 10:47:34 +01:00
this.progressLeft = guiHelper.createAnimatedDrawable(progressLeftStatic, ticksPerCycle,
2016-10-08 21:46:16 +02:00
IDrawableAnimated.StartDirection.RIGHT, false);
2016-03-25 10:47:34 +01:00
this.progressDown = guiHelper.createAnimatedDrawable(progressDownStatic, ticksPerCycle,
2016-10-08 21:46:16 +02:00
IDrawableAnimated.StartDirection.TOP, false);
2016-03-25 10:47:34 +01:00
this.progressRight = guiHelper.createAnimatedDrawable(progressRightStatic, ticksPerCycle,
2016-10-08 21:46:16 +02:00
IDrawableAnimated.StartDirection.LEFT, false);
2016-03-13 17:08:30 +01:00
}
@Override
2016-10-08 21:46:16 +02:00
public void drawAnimations(
@Nonnull
Minecraft minecraft, int recipeWidth, int recipeHeight) {
2016-03-13 17:08:30 +01:00
super.drawAnimations(minecraft, recipeWidth, recipeHeight);
progressUp.draw(minecraft, 33, 18);
progressLeft.draw(minecraft, 18, 33);
progressDown.draw(minecraft, 33, 48);
progressRight.draw(minecraft, 48, 33);
int x = -45;
int y = 60;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
2016-10-08 21:46:16 +02:00
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " secs", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
2016-03-13 17:08:30 +01:00
}
}