Fluid config work
This commit is contained in:
parent
808a07fdbf
commit
89beff99c7
3 changed files with 16 additions and 6 deletions
|
@ -26,7 +26,6 @@ package techreborn.client.gui.slot.elements;
|
||||||
|
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.client.gui.GuiBase;
|
import techreborn.client.gui.GuiBase;
|
||||||
import techreborn.client.gui.slot.GuiSlotConfiguration;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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(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) -> {
|
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;
|
return true;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ public class ConfigSlotElement extends ElementBase {
|
||||||
elements.add(popupElement = new SlotConfigPopupElement(this.id, x - 22, y - 22, this));
|
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) -> {
|
elements.add(new ButtonElement(x + 37, y - 25, Sprite.EXIT_BUTTON).addReleaseAction((element, gui1, provider, mouseX, mouseY) -> {
|
||||||
GuiSlotConfiguration.slectedSlot = -1;
|
GuiSlotConfiguration.slectedSlot = -1;
|
||||||
|
GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE;
|
||||||
return true;
|
return true;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
public boolean filter = false;
|
public boolean filter = false;
|
||||||
|
|
||||||
ConfigFluidElement fluidElement;
|
ConfigFluidElement fluidElement;
|
||||||
|
int lastMousex, lastMousey;
|
||||||
|
|
||||||
public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) {
|
public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) {
|
||||||
super(x, y, Sprite.SLOT_CONFIG_POPUP);
|
super(x, y, Sprite.SLOT_CONFIG_POPUP);
|
||||||
|
@ -106,7 +107,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
public void cyleConfig(EnumFacing side, GuiBase guiBase) {
|
public void cyleConfig(EnumFacing side, GuiBase guiBase) {
|
||||||
FluidConfiguration.FluidConfig config = guiBase.getMachine().fluidConfiguration.getSideDetail(side);
|
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);
|
FluidConfiguration.FluidConfig newConfig = new FluidConfiguration.FluidConfig(side, fluidIO);
|
||||||
|
|
||||||
PacketFluidConfigSave packetSave = new PacketFluidConfigSave(guiBase.tile.getPos(), newConfig);
|
PacketFluidConfigSave packetSave = new PacketFluidConfigSave(guiBase.tile.getPos(), newConfig);
|
||||||
|
@ -128,6 +129,13 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
NetworkManager.sendToServer(packetFluidIOSave);
|
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) {
|
private void drawSateColor(TileLegacyMachineBase machineBase, EnumFacing side, int inx, int iny, GuiBase gui) {
|
||||||
iny += 4;
|
iny += 4;
|
||||||
int sx = inx + getX() + gui.guiLeft;
|
int sx = inx + getX() + gui.guiLeft;
|
||||||
|
@ -137,9 +145,9 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
RebornCore.logHelper.debug("Humm, this isnt suppoed to happen");
|
RebornCore.logHelper.debug("Humm, this isnt suppoed to happen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FluidConfiguration.FluidConfig slotConfig = fluidConfiguration.getSideDetail(side);
|
FluidConfiguration.FluidConfig fluidConfig = fluidConfiguration.getSideDetail(side);
|
||||||
Color color;
|
Color color;
|
||||||
switch (slotConfig.getFluidIO().getIoConfig()) {
|
switch (fluidConfig.getIoConfig()) {
|
||||||
case NONE:
|
case NONE:
|
||||||
color = new Color(0, 0, 0, 0);
|
color = new Color(0, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -149,6 +157,9 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
case OUTPUT:
|
case OUTPUT:
|
||||||
color = new Color(255, 69, 0, 128);
|
color = new Color(255, 69, 0, 128);
|
||||||
break;
|
break;
|
||||||
|
case ALL:
|
||||||
|
color = new Color(52, 255, 30, 128);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
color = new Color(0, 0, 0, 0);
|
color = new Color(0, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -156,7 +167,6 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
GlStateManager.color(255, 255, 255);
|
GlStateManager.color(255, 255, 255);
|
||||||
GuiUtil.drawGradientRect(sx, sy, 18, 18, color.getRGB(), color.getRGB());
|
GuiUtil.drawGradientRect(sx, sy, 18, 18, color.getRGB(), color.getRGB());
|
||||||
GlStateManager.color(255, 255, 255);
|
GlStateManager.color(255, 255, 255);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInBox(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY, GuiBase guiBase) {
|
private boolean isInBox(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY, GuiBase guiBase) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue