From 89beff99c72a2d4ef65d16057b20113cc3a57f9f Mon Sep 17 00:00:00 2001 From: Modmuss50 Date: Sat, 11 Aug 2018 15:23:57 +0100 Subject: [PATCH] Fluid config work --- .../gui/slot/elements/ConfigFluidElement.java | 3 +-- .../gui/slot/elements/ConfigSlotElement.java | 1 + .../slot/elements/FluidConfigPopupElement.java | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/techreborn/client/gui/slot/elements/ConfigFluidElement.java b/src/main/java/techreborn/client/gui/slot/elements/ConfigFluidElement.java index ab071bd0f..ef1716b20 100644 --- a/src/main/java/techreborn/client/gui/slot/elements/ConfigFluidElement.java +++ b/src/main/java/techreborn/client/gui/slot/elements/ConfigFluidElement.java @@ -26,7 +26,6 @@ package techreborn.client.gui.slot.elements; import reborncore.common.util.Tank; import techreborn.client.gui.GuiBase; -import techreborn.client.gui.slot.GuiSlotConfiguration; import java.util.ArrayList; import java.util.List; @@ -46,7 +45,7 @@ public class ConfigFluidElement extends ElementBase { elements.add(popupElement = new FluidConfigPopupElement(x - 22, y - 22, this)); elements.add(new ButtonElement(x + 37, y - 25, Sprite.EXIT_BUTTON).addReleaseAction((element, gui1, provider, mouseX, mouseY) -> { - GuiSlotConfiguration.slectedSlot = -1; + GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE; return true; })); diff --git a/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java b/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java index a40d6c01b..6a95ec9c3 100644 --- a/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java +++ b/src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java @@ -58,6 +58,7 @@ public class ConfigSlotElement extends ElementBase { elements.add(popupElement = new SlotConfigPopupElement(this.id, x - 22, y - 22, this)); elements.add(new ButtonElement(x + 37, y - 25, Sprite.EXIT_BUTTON).addReleaseAction((element, gui1, provider, mouseX, mouseY) -> { GuiSlotConfiguration.slectedSlot = -1; + GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE; return true; })); diff --git a/src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java b/src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java index f323078e5..ed9abd277 100644 --- a/src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java +++ b/src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java @@ -49,6 +49,7 @@ public class FluidConfigPopupElement extends ElementBase { public boolean filter = false; ConfigFluidElement fluidElement; + int lastMousex, lastMousey; public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) { super(x, y, Sprite.SLOT_CONFIG_POPUP); @@ -106,7 +107,7 @@ public class FluidConfigPopupElement extends ElementBase { public void cyleConfig(EnumFacing side, GuiBase guiBase) { FluidConfiguration.FluidConfig config = guiBase.getMachine().fluidConfiguration.getSideDetail(side); - FluidConfiguration.FluidIO fluidIO = new FluidConfiguration.FluidIO(config.getFluidIO().getIoConfig().getNext()); + FluidConfiguration.ExtractConfig fluidIO = config.getIoConfig().getNext(); FluidConfiguration.FluidConfig newConfig = new FluidConfiguration.FluidConfig(side, fluidIO); PacketFluidConfigSave packetSave = new PacketFluidConfigSave(guiBase.tile.getPos(), newConfig); @@ -128,6 +129,13 @@ public class FluidConfigPopupElement extends ElementBase { NetworkManager.sendToServer(packetFluidIOSave); } + @Override + public boolean onHover(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) { + lastMousex = mouseX; + lastMousey = mouseY; + return super.onHover(provider, gui, mouseX, mouseY); + } + private void drawSateColor(TileLegacyMachineBase machineBase, EnumFacing side, int inx, int iny, GuiBase gui) { iny += 4; int sx = inx + getX() + gui.guiLeft; @@ -137,9 +145,9 @@ public class FluidConfigPopupElement extends ElementBase { RebornCore.logHelper.debug("Humm, this isnt suppoed to happen"); return; } - FluidConfiguration.FluidConfig slotConfig = fluidConfiguration.getSideDetail(side); + FluidConfiguration.FluidConfig fluidConfig = fluidConfiguration.getSideDetail(side); Color color; - switch (slotConfig.getFluidIO().getIoConfig()) { + switch (fluidConfig.getIoConfig()) { case NONE: color = new Color(0, 0, 0, 0); break; @@ -149,6 +157,9 @@ public class FluidConfigPopupElement extends ElementBase { case OUTPUT: color = new Color(255, 69, 0, 128); break; + case ALL: + color = new Color(52, 255, 30, 128); + break; default: color = new Color(0, 0, 0, 0); break; @@ -156,7 +167,6 @@ public class FluidConfigPopupElement extends ElementBase { GlStateManager.color(255, 255, 255); GuiUtil.drawGradientRect(sx, sy, 18, 18, color.getRGB(), color.getRGB()); GlStateManager.color(255, 255, 255); - } private boolean isInBox(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY, GuiBase guiBase) {