From a5a8265c8b39b5527ba4148147aea390d8f4b812 Mon Sep 17 00:00:00 2001 From: Gig Date: Sat, 27 Jun 2015 16:07:11 +0100 Subject: [PATCH] Sawmill now renders fluids and so dose recipe handler --- .../client/gui/GuiIndustrialSawmill.java | 22 +++++++++++++++++++ .../IndustrialSawmillRecipeHandler.java | 22 +++++++++---------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java index aa493b8f0..57d6d79b8 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java @@ -1,9 +1,12 @@ package techreborn.client.gui; +import ic2.core.util.DrawUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import techreborn.client.container.ContainerIndustrialSawmill; @@ -53,6 +56,25 @@ public class GuiIndustrialSawmill extends GuiContainer { if(j > 0) { this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2); } + + if (sawmill.tank.getFluidAmount() != 0) + { + IIcon fluidIcon = sawmill.tank.getFluid().getFluid().getIcon(); + if (fluidIcon != null) + { + drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55); + + this.mc.renderEngine + .bindTexture(TextureMap.locationBlocksTexture); + int liquidHeight = sawmill.tank.getFluidAmount() * 47 + / sawmill.tank.getCapacity(); + DrawUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47 + - liquidHeight, 12.0D, liquidHeight, this.zLevel); + + this.mc.renderEngine.bindTexture(texture); + drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47); + } + } } diff --git a/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java b/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java index a75ed73d8..d9bdcd46f 100644 --- a/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java +++ b/src/main/java/techreborn/compat/nei/recipes/IndustrialSawmillRecipeHandler.java @@ -3,6 +3,7 @@ package techreborn.compat.nei.recipes; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; import ic2.core.util.DrawUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; @@ -10,8 +11,10 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; import techreborn.api.recipe.IBaseRecipeType; import techreborn.api.recipe.machines.GrinderRecipe; +import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe; import techreborn.api.recipe.machines.IndustrialSawmillRecipe; import techreborn.client.gui.GuiIndustrialSawmill; +import techreborn.compat.nei.recipes.GenericRecipeHander.CachedGenericRecipe; import java.awt.Rectangle; import java.util.List; @@ -69,7 +72,7 @@ public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implemen @Override public void loadTransferRects() { this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect( - new Rectangle(80, 20, 20, 20), getNeiBaseRecipe().getRecipeName(), new Object[0])); + new Rectangle(55, 20, 20, 20), getNeiBaseRecipe().getRecipeName(), new Object[0])); } @Override @@ -78,22 +81,17 @@ public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implemen CachedRecipe recipe = arecipes.get(recipeIndex); if (recipe instanceof CachedGenericRecipe) { if (((CachedGenericRecipe) recipe).recipie instanceof IndustrialSawmillRecipe) { - IndustrialSawmillRecipe sawmillRecipe = (IndustrialSawmillRecipe) ((CachedGenericRecipe) recipe).recipie; - if (sawmillRecipe.fluidStack != null) { - IIcon fluidIcon = sawmillRecipe.fluidStack.getFluid().getIcon(); + IndustrialSawmillRecipe grinderRecipe = (IndustrialSawmillRecipe) ((CachedGenericRecipe) recipe).recipie; + if (grinderRecipe.fluidStack != null) { + IIcon fluidIcon = grinderRecipe.fluidStack.getFluid().getIcon(); if (fluidIcon != null) { -// GuiDraw.drawRect(7, 16, 176, 31, 0); -// drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - int liquidHeight = sawmillRecipe.fluidStack.amount * 47 / 16000; - DrawUtil.drawRepeated(fluidIcon, 11, 19 + 47 - liquidHeight, 12.0D, liquidHeight, GuiDraw.gui.getZLevel()); + int liquidHeight = grinderRecipe.fluidStack.amount * 100 / 16000; + DrawUtil.drawRepeated(fluidIcon, 7, 22 + 47 - liquidHeight, 14.0D, liquidHeight, GuiDraw.gui.getZLevel()); - -// this.mc.renderEngine.bindTexture(texture); -// drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47); } - GuiDraw.drawString(sawmillRecipe.fluidStack.amount + "mb of " + sawmillRecipe.fluidStack.getLocalizedName(), 14, 124, -1); + GuiDraw.drawString(grinderRecipe.fluidStack.amount + "mb of " + grinderRecipe.fluidStack.getLocalizedName(), 14, 135, -1); } } }