diff --git a/resources/assets/enderio/textures/gui/still.png b/resources/assets/enderio/textures/gui/still.png index b53d83ea..8bf75587 100644 Binary files a/resources/assets/enderio/textures/gui/still.png and b/resources/assets/enderio/textures/gui/still.png differ diff --git a/src/main/java/crazypants/enderio/machine/MachineRecipes.java b/src/main/java/crazypants/enderio/machine/MachineRecipes.java index 9ed3bbf8..f9ed3181 100644 --- a/src/main/java/crazypants/enderio/machine/MachineRecipes.java +++ b/src/main/java/crazypants/enderio/machine/MachineRecipes.java @@ -54,6 +54,10 @@ public class MachineRecipes { GameRegistry.addShapedRecipe(crusher, "fff", "imi", "ici", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'c', capacitor); } + //Still + ItemStack still = new ItemStack(EnderIO.blockStill, 1, 0); + GameRegistry.addShapedRecipe(crusher, "iii", "dmd", "gcg", 'd', Items.cauldron, 'g', basicGear, 'm', machineChassi, 'i', Items.iron_ingot, 'c', capacitor); + //transceiver ItemStack transceiver = new ItemStack(EnderIO.blockHyperCube, 1, 0); ItemStack obsidian = new ItemStack(Blocks.obsidian); diff --git a/src/main/java/crazypants/enderio/machine/PoweredTask.java b/src/main/java/crazypants/enderio/machine/PoweredTask.java index 058bf040..5186567f 100644 --- a/src/main/java/crazypants/enderio/machine/PoweredTask.java +++ b/src/main/java/crazypants/enderio/machine/PoweredTask.java @@ -75,6 +75,14 @@ public class PoweredTask { return recipe.getCompletedResult(chance, inputs); } + public MachineRecipeInput[] getInputs() { + return inputs; + } + + public void setInputs(MachineRecipeInput[] inputs) { + this.inputs = inputs; + } + public void writeToNBT(NBTTagCompound nbtRoot) { NBTTagCompound stackRoot; diff --git a/src/main/java/crazypants/enderio/machine/still/GuiStill.java b/src/main/java/crazypants/enderio/machine/still/GuiStill.java index 46ebb393..63b16f6a 100644 --- a/src/main/java/crazypants/enderio/machine/still/GuiStill.java +++ b/src/main/java/crazypants/enderio/machine/still/GuiStill.java @@ -8,6 +8,8 @@ import net.minecraftforge.fluids.FluidTank; import org.lwjgl.opengl.GL11; import crazypants.enderio.machine.GuiMachineBase; +import crazypants.enderio.machine.IMachineRecipe.ResultStack; +import crazypants.enderio.machine.MachineRecipeInput; import crazypants.render.RenderUtil; public class GuiStill extends GuiMachineBase { @@ -31,12 +33,29 @@ public class GuiStill extends GuiMachineBase { int guiTop = (height - ySize) / 2; drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - // int i1 = still.getProgressScaled(24); - // drawTexturedModalRect(guiLeft + 79, guiTop + 31, 200, 0, 18, i1 + 1); - if(still.getProgress() < 1 && still.getProgress() > 0) { int scaled = still.getProgressScaled(12); drawTexturedModalRect(guiLeft + 81, guiTop + 76 - scaled, 176, 12 - scaled, 14, scaled + 2); + + IIcon inputIcon = null; + for (MachineRecipeInput input : still.getCurrentTask().getInputs()) { + if(input.fluid != null && input.fluid.getFluid() != null) { + inputIcon = input.fluid.getFluid().getStillIcon(); + break; + } + } + StillMachineRecipe rec = (StillMachineRecipe) still.getCurrentTask().getRecipe(); + IIcon outputIcon = null; + for (ResultStack res : rec.getCompletedResult(1.0f, still.getCurrentTask().getInputs())) { + if(res.fluid != null && res.fluid.getFluid() != null) { + outputIcon = res.fluid.getFluid().getStillIcon(); + } + } + + if(inputIcon != null && outputIcon != null) { + renderVat(inputIcon, outputIcon, still.getProgress()); + } + } RenderUtil.bindBlockTexture(); @@ -47,6 +66,26 @@ public class GuiStill extends GuiMachineBase { super.drawGuiContainerBackgroundLayer(par1, par2, par3); } + private void renderVat(IIcon inputIcon, IIcon outputIcon, float progress) { + RenderUtil.bindBlockTexture(); + + int x = guiLeft + 76; + int y = guiTop + 34; + + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1, 1, 1, 0.75f * (1f - progress)); + drawTexturedModelRectFromIcon(x, y, inputIcon, 26, 28); + + GL11.glColor4f(1, 1, 1, 0.75f * progress); + drawTexturedModelRectFromIcon(x, y, outputIcon, 26, 28); + + GL11.glDisable(GL11.GL_BLEND); + + GL11.glColor4f(1, 1, 1, 1); + RenderUtil.bindTexture("enderio:textures/gui/still.png"); + drawTexturedModalRect(x, y, 0, 256 - 28, 26, 28); + } + private void renderTank(FluidTank tank, int x) { FluidStack fluid = tank.getFluid(); if(fluid == null || fluid.getFluid() == null || fluid.amount <= 0) { diff --git a/src/main/java/crazypants/enderio/machine/still/TileStill.java b/src/main/java/crazypants/enderio/machine/still/TileStill.java index 74bbe21b..cb2678a7 100644 --- a/src/main/java/crazypants/enderio/machine/still/TileStill.java +++ b/src/main/java/crazypants/enderio/machine/still/TileStill.java @@ -14,6 +14,7 @@ import crazypants.enderio.ModObject; import crazypants.enderio.machine.AbstractPoweredTaskEntity; import crazypants.enderio.machine.IMachineRecipe.ResultStack; import crazypants.enderio.machine.MachineRecipeInput; +import crazypants.enderio.machine.PoweredTask; import crazypants.enderio.machine.SlotDefinition; public class TileStill extends AbstractPoweredTaskEntity implements IFluidHandler { @@ -159,4 +160,8 @@ public class TileStill extends AbstractPoweredTaskEntity implements IFluidHandle } + public PoweredTask getCurrentTask() { + return currentTask; + } + }