From 26feb5e646ba15f8ad12ee883af4282e99bc8b41 Mon Sep 17 00:00:00 2001 From: cp Date: Mon, 21 Apr 2014 16:21:30 +0800 Subject: [PATCH] Even more additions to the IO GUI. --- .../enderio/textures/gui/alloySmelter.png | Bin 2712 -> 2424 bytes .../enderio/machine/GuiMachineBase.java | 47 +++++++++++++++++- .../enderio/machine/GuiOverlayIoConfig.java | 4 ++ .../machine/alloy/ContainerAlloySmelter.java | 2 +- .../machine/alloy/GuiAlloySmelter.java | 10 ++++ .../generator/GuiCombustionGenerator.java | 17 +++++++ .../enderio/machine/still/GuiVat.java | 23 +++++++-- 7 files changed, 95 insertions(+), 8 deletions(-) diff --git a/resources/assets/enderio/textures/gui/alloySmelter.png b/resources/assets/enderio/textures/gui/alloySmelter.png index 6b1679e3c819efa298c89eda7abd9fbdad342fa7..2f98f5d6f7f9e7838993a8943041b54a4fe3779e 100644 GIT binary patch literal 2424 zcmeGdeNd8j`1ig-3a^eN)XF|cmXc(E!C`3%CZ$b@OU~&c!%|D#iX3NJPF`DP8=2l( z>1ZitvoF79rSF=hl^SMdn|*N2f>P6ED+8~vk?iH#AG_P_|J~Me&+ne+p6}=ReSIO7 ztaKyKBm)54q9P;K007}E1YDeOl2H>c!wF%NC`JUp_r-`Ui3orbkVebIxLhC*C=`m# zn>Xj?=9bU*uJ-lDSaYtj=iLcp7^21YCSbSE)o3)Got<{O9k+i6?Y{{3?TNE^L%_`Ny^BCPXTzZ$+4gt`X9c-g)>#+cvbAyRMqyR%oHF^O537Z zBoWK#S&J9(7jd~OE#U(Eh3Suq5XrI=e>;+&d5<$S;(m1+mGjcBuHE@nT%aO?kxQmF zZ=F(c+GXfv$F6;S)mIu_-!v@jR+af=`Z@*AIF$6vnai1d1hNN}^9bW#tIPMKX!lb? zLv9iD=@&TBg)ew9RdV=QJ}p=YH)MIa_WeXsmbNh|#|$Dh+?hbY-h^pL#|-(6==!?~ zdC^18s;r486@zPncubS3;N=j1*6@|IrC9yNSUkjt1T{kDj?$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=&b~isydv#Be8|Z zA6v5!J%}hpy2u z_7o_Li%(+4P8s!bW1kNlx=U^RBRb%ufs{6F_ zN=RZVqZNOz-4-S&DOfvw9vSJxVw@haa6PV~B>5#yE!8XtCRtY>>t1@kk5C#L`^XHI+cHms>lKni zvm~D4f^QC$3z8+BPih*@J2EQWrgNktS@C|W)GF-(!`QqkoXO;&M-hIF|ck%6@4Ps%Xz7<+;6`2BCcr;_TZ&BfLpp-ge*;+Bh4 zNnWW&HS^jaLj{UDzP4@AxHPX*2J}@!55v+z* z3%5S1H4vaS;^xN9YkiNbEh#NTbYWC)OWd3w68|= zq!#F-b)Qg%6KmSU1|=$O9QNhS|5ZO@Xpj8p_K4)nd6d9s-QP=C81xNh(8n2AC9zOK zUs(4gP>65a;&P{Ur5E&k>)ycpX!-_p2PbF;+!w>`*%MuvMEQ 0 && (mode == IoMode.PULL || mode == IoMode.PUSH_PULL)) { + for (int slot = slotDef.getMinInputSlot(); slot <= slotDef.getMaxInputSlot(); slot++) { + renderSlotHighlight(slot,PULL_COLOR); + } + } + if(slotDef.getNumOutputSlots() > 0 && (mode == IoMode.PUSH || mode == IoMode.PUSH_PULL)) { + for (int slot = slotDef.getMinOutputSlot(); slot <= slotDef.getMaxOutputSlot(); slot++) { + renderSlotHighlight(slot,PUSH_COLOR); + } + } + } + + protected void renderSlotHighlight(int slot, Vector4f col) { + Slot invSlot = (Slot)inventorySlots.inventorySlots.get(slot); + renderSlotHighlight(col, invSlot.xDisplayPosition,invSlot.yDisplayPosition,16,16); + } + + protected void renderSlotHighlight(Vector4f col, int x, int y, int width, int height) { + GL11.glEnable(GL11.GL_BLEND); + RenderUtil.renderQuad2D(getGuiLeft() + x, getGuiTop() + y, 0, width, height, col); + GL11.glDisable(GL11.GL_BLEND); + } + protected int getPowerX() { return POWER_X; } @@ -113,8 +149,15 @@ public abstract class GuiMachineBase extends GuiContainerBase { guibutton.drawButton(this.mc, 0, 0); } + SelectedFace sel = configOverlay.getSelection(); + if(sel != null) { + IoMode mode = sel.config.getIoMode(sel.face); + if(mode != null) { + renderSlotHighlights(mode); + } + } + + } - - } diff --git a/src/main/java/crazypants/enderio/machine/GuiOverlayIoConfig.java b/src/main/java/crazypants/enderio/machine/GuiOverlayIoConfig.java index 45055345..8d38368f 100644 --- a/src/main/java/crazypants/enderio/machine/GuiOverlayIoConfig.java +++ b/src/main/java/crazypants/enderio/machine/GuiOverlayIoConfig.java @@ -9,6 +9,7 @@ import net.minecraft.util.IIcon; import crazypants.enderio.EnderIOTab; import crazypants.enderio.gui.IGuiOverlay; import crazypants.enderio.gui.IoConfigRenderer; +import crazypants.enderio.gui.IoConfigRenderer.SelectedFace; import crazypants.gui.IGuiScreen; import crazypants.render.ColorUtil; import crazypants.render.RenderUtil; @@ -97,6 +98,9 @@ public class GuiOverlayIoConfig implements IGuiOverlay { return bounds; } + public SelectedFace getSelection() { + return renderer.getSelection(); + } diff --git a/src/main/java/crazypants/enderio/machine/alloy/ContainerAlloySmelter.java b/src/main/java/crazypants/enderio/machine/alloy/ContainerAlloySmelter.java index 4c7f397d..ad4f6a89 100644 --- a/src/main/java/crazypants/enderio/machine/alloy/ContainerAlloySmelter.java +++ b/src/main/java/crazypants/enderio/machine/alloy/ContainerAlloySmelter.java @@ -27,7 +27,7 @@ public class ContainerAlloySmelter extends AbstractMachineContainer { return tileEntity.isItemValidForSlot(0, itemStack); } }); - addSlotToContainer(new Slot(tileEntity, 1, 78, 7) { + addSlotToContainer(new Slot(tileEntity, 1, 79, 7) { @Override public boolean isItemValid(ItemStack itemStack) { return tileEntity.isItemValidForSlot(1, itemStack); diff --git a/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java b/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java index d3452c8b..0d36f104 100644 --- a/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java +++ b/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java @@ -15,6 +15,7 @@ import crazypants.gui.GuiToolTip; import crazypants.gui.IconButton; import crazypants.render.RenderUtil; import crazypants.util.Lang; +import crazypants.vecmath.Vector4f; public class GuiAlloySmelter extends GuiMachineBase { @@ -65,6 +66,15 @@ public class GuiAlloySmelter extends GuiMachineBase { buttonList.add(vanillaFurnaceButton); } + @Override + protected void renderSlotHighlight(int slot, Vector4f col) { + if(tileEntity.getSlotDefinition().isOutputSlot(slot)) { + renderSlotHighlight(col, 75,54,24,24); + } else { + super.renderSlotHighlight(slot, col); + } + } + @Override protected void actionPerformed(GuiButton par1GuiButton) { if(par1GuiButton.id == SMELT_MODE_BUTTON_ID) { diff --git a/src/main/java/crazypants/enderio/machine/generator/GuiCombustionGenerator.java b/src/main/java/crazypants/enderio/machine/generator/GuiCombustionGenerator.java index 5dfed177..3d86a7ba 100644 --- a/src/main/java/crazypants/enderio/machine/generator/GuiCombustionGenerator.java +++ b/src/main/java/crazypants/enderio/machine/generator/GuiCombustionGenerator.java @@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11; import crazypants.enderio.fluid.Fluids; import crazypants.enderio.machine.GuiMachineBase; +import crazypants.enderio.machine.IoMode; import crazypants.enderio.machine.power.PowerDisplayUtil; import crazypants.gui.GuiToolTip; import crazypants.render.ColorUtil; @@ -58,6 +59,22 @@ public class GuiCombustionGenerator extends GuiMachineBase { } + @Override + public void renderSlotHighlights(IoMode mode) { + super.renderSlotHighlights(mode); + + if(mode == IoMode.PULL || mode == IoMode.PUSH_PULL) { + int x = 48 - 2; + int y = 21 - 2; + int w = 15 + 4; + int h = 47 + 4; + renderSlotHighlight(PULL_COLOR,x,y,w,h); + x = 114 - 2; + renderSlotHighlight(PULL_COLOR,x,y,w,h); + } + + } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/crazypants/enderio/machine/still/GuiVat.java b/src/main/java/crazypants/enderio/machine/still/GuiVat.java index 8bca0661..727c9f02 100644 --- a/src/main/java/crazypants/enderio/machine/still/GuiVat.java +++ b/src/main/java/crazypants/enderio/machine/still/GuiVat.java @@ -2,18 +2,15 @@ package crazypants.enderio.machine.still; import java.awt.Rectangle; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.IIcon; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; import org.lwjgl.opengl.GL11; import crazypants.enderio.fluid.Fluids; import crazypants.enderio.machine.GuiMachineBase; import crazypants.enderio.machine.IMachineRecipe.ResultStack; -import crazypants.enderio.machine.power.PowerDisplayUtil; +import crazypants.enderio.machine.IoMode; import crazypants.enderio.machine.MachineRecipeInput; import crazypants.gui.GuiToolTip; import crazypants.render.RenderUtil; @@ -61,6 +58,22 @@ public class GuiVat extends GuiMachineBase { } + @Override + public void renderSlotHighlights(IoMode mode) { + super.renderSlotHighlights(mode); + + int x = 30; + int y = 12; + if(mode == IoMode.PULL || mode == IoMode.PUSH_PULL) { + renderSlotHighlight(PULL_COLOR,x-2,y-2,15+4,47+4); + } + if(mode == IoMode.PUSH || mode == IoMode.PUSH_PULL) { + x = 132; + renderSlotHighlight(PUSH_COLOR,x-2,y-2,15+4,47+4); + } + } + + /** * Draw the background layer for the GuiContainer (everything behind the * items) @@ -128,7 +141,7 @@ public class GuiVat extends GuiMachineBase { drawTexturedModalRect(x, y, 0, 256 - 28, 26, 28); } - + @Override protected int getPowerX() { return 10;