From 21724f33b253a14c7be4704490402c2180cedc2d Mon Sep 17 00:00:00 2001 From: cp Date: Thu, 27 Mar 2014 14:28:00 +0800 Subject: [PATCH] Still now working, need to add xml recipes etc now. --- .../assets/enderio/textures/gui/still.png | Bin 2585 -> 2552 bytes .../enderio/machine/MachineRecipes.java | 4 ++ .../enderio/machine/PoweredTask.java | 8 ++++ .../enderio/machine/still/GuiStill.java | 45 ++++++++++++++++-- .../enderio/machine/still/TileStill.java | 5 ++ 5 files changed, 59 insertions(+), 3 deletions(-) diff --git a/resources/assets/enderio/textures/gui/still.png b/resources/assets/enderio/textures/gui/still.png index b53d83ea0654597f0eec19b63fba5c382b4cab7a..8bf7558785ad0dfd96598ba8be23a1e9b9ea4926 100644 GIT binary patch delta 1323 zcmZ8fYfuvh5WYKdJQAePBnXN%j8W3cOCDp}2sscTfP@GLRuQNQrfLNd2=dBB>wpYs zK!rj`a*9!`C{YwC1cJ|Eg#t#Sh)N6~l$eS#;bkNR{n4pA-;e!vzi(!DXDdikL|HzL z7aJVl7nK>O6CKH@cDG!2Z%-#=H2z-X%qUA(A0mrf+>*_*UM9!3tWDxP{b{E4e17Yj zzTI?6cImfFOHb z>`652q^Yjak8D;G-sZV|%fou%C~R50p=rl}6p6UqRCgZPlZ0FTZkkG?PmEShyvc?O{Rw(KyZr*t`wQcQ{d& zN4HKZIOeS-TjR&{yjUdDGw{XB(8)dPGm(ndKoDsk1siWw+ z@A^kPw5P^TQh_7<)wrDMF7a1GgiRTzfN>~}`~68&HroW#+VRO2nZ3JJLBlJ9fiF$m z;MzxuAk-ghuiGF+W1h392`zc}%$~X(ApXit0(f~w;f8#Y_QEt04>c@eI3qD5rW{-J z)~fDZSOO^FL+*Z1_a6lyk>=U1ag#?1*yy@u}JW8d(bFSUJ9oLm_8i)5d%w@93Lmn@?iR+URSIn#37XO21gpJ&*WI4#!6 z%X{iO8lkem?1u5U!283?5s>s5P`s7@d@+x+hFd{%tsW$@E#@^mK@cErVUfz;4iZtW zu%sxN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4Y0sGgjs{?|tPAA#+vwB9~$)9uAn5qpkQM24PdQL}cI{V-Ry-IAQnB$6T`jdx zl{}OBOKY(p6tQ6eXTCP4@;JyS?~QjaUF@iH|9u)X;Z~=M${p^zMn|!L%i;FG6DKMb zMab zCMMO9JRZDNk7wo<#>Tfbp5p2d8aOl#!2uy`*JHjhm_Dd(_5@436c4TdWLzj4gB#3e sm62;D%U+sU;doqHcrIoim&RUP@saDzvxA_yx4>!z`G;(8^yTIL4WXq@8~^|S 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; + } + }