TechReborn/1.11/jei/industrialGrinder/IndustrialGrinderRecipeWrapper.java

59 lines
1.9 KiB
Java
Raw Normal View History

2016-02-20 01:57:57 +01:00
package techreborn.compat.jei.industrialGrinder;
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 net.minecraftforge.fluids.FluidStack;
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
import techreborn.client.gui.GuiIndustrialGrinder;
import techreborn.compat.jei.BaseRecipeWrapper;
2016-10-08 21:46:16 +02:00
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
public class IndustrialGrinderRecipeWrapper extends BaseRecipeWrapper<IndustrialGrinderRecipe> {
2016-02-20 01:57:57 +01:00
private final IDrawableAnimated progress;
2016-10-08 21:46:16 +02:00
public IndustrialGrinderRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
IndustrialGrinderRecipe baseRecipe) {
2016-02-20 01:57:57 +01:00
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 176, 14, 24, 17);
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-20 01:57:57 +01:00
}
@Override
@Nonnull
2016-10-08 21:46:16 +02:00
public List<FluidStack> getFluidInputs() {
if (baseRecipe.fluidStack != null) {
2016-02-20 01:57:57 +01:00
return Collections.singletonList(baseRecipe.fluidStack);
2016-10-08 21:46:16 +02:00
} else {
2016-02-20 01:57:57 +01:00
return Collections.emptyList();
}
}
@Override
2016-10-08 21:46:16 +02:00
public void drawAnimations(
@Nonnull
Minecraft minecraft, int recipeWidth, int recipeHeight) {
2016-02-20 01:57:57 +01:00
super.drawAnimations(minecraft, recipeWidth, recipeHeight);
progress.draw(minecraft, 44, 20);
int x = 70;
int y = 40;
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-20 01:57:57 +01:00
}
}