From f18adc9c0a6d1ced221b19229365cdbe45da1b9d Mon Sep 17 00:00:00 2001 From: drcrazy Date: Thu, 28 Dec 2017 02:05:13 +0300 Subject: [PATCH] Fixed texture issue in JEI. --- .../fluid/FluidGeneratorRecipeWrapper.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java b/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java index fe8b43ac1..3b8f3fa3d 100644 --- a/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java +++ b/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java @@ -26,7 +26,8 @@ package techreborn.compat.jei.generators.fluid; import mezz.jei.api.IGuiHelper; import mezz.jei.api.IJeiHelpers; -import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IDrawableAnimated; +import mezz.jei.api.gui.IDrawableStatic; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; @@ -38,27 +39,19 @@ import javax.annotation.Nonnull; public class FluidGeneratorRecipeWrapper implements IRecipeWrapper { - private static final int FLUID_GENERATOR_STORAGE = 100_000; - private final FluidGeneratorRecipe baseRecipe; - private final IDrawable energyProduced; - - public FluidGeneratorRecipeWrapper( - @Nonnull - IJeiHelpers jeiHelpers, - @Nonnull - FluidGeneratorRecipe recipe) { + private final IDrawableAnimated progress; + public FluidGeneratorRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull FluidGeneratorRecipe recipe) { this.baseRecipe = recipe; - IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); - energyProduced = guiHelper.createDrawable(FluidGeneratorRecipeCategory.texture, 176, 3, - (int) (25 * ((recipe.getEnergyPerMb() * 1000.0) / FLUID_GENERATOR_STORAGE)), 14); + IDrawableStatic progressStatic = guiHelper.createDrawable(FluidGeneratorRecipeCategory.texture, 176, 3, 25, 14); + this.progress = guiHelper.createAnimatedDrawable(progressStatic, 200, IDrawableAnimated.StartDirection.LEFT, false); } @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - energyProduced.draw(minecraft, 73, 26); + progress.draw(minecraft, 73, 26); minecraft.fontRenderer .drawString(PowerSystem.getLocaliszedPowerFormattedNoSuffix(baseRecipe.getEnergyPerMb() * 1000) + " " + PowerSystem.getDisplayPower().abbreviation, 70, 13, 0x444444);