diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java index d9240c5..fa1533b 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiSettings.java @@ -37,8 +37,10 @@ public class GuiSettings extends GuiScreen { @Override protected void actionPerformed(GuiButton guiButton){ if(wireEntity instanceof ChipTileEntity){ - if(((ChipTileEntity)wireEntity).mode.equals("constant")){ - constAction(guiButton); + switch(((ChipTileEntity)wireEntity).mode){ + case "constant": + constAction(guiButton); + break; } } } @@ -51,5 +53,6 @@ public class GuiSettings extends GuiScreen { wireEntity.outputs[0].floatvalue--; } this.controlList.get(1).displayString = wireEntity.outputs[0].floatvalue + ""; + wireEntity.updateIO(); } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java index 3a34758..babbfb0 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java @@ -46,22 +46,25 @@ public class ChipTileEntity extends AbstractWireTileEntity { public void setMode(String string) { if (mode.equals("none")) { - if (string.equals("constant")) { - mode = string; - this.inputs = new WiringButton[0]; - this.outputs = new WiringButton[1]; - this.outputs[0] = new WiringButton(214, 240, "Output", 0); - initialized = true; - hasSettings = true; - } else if (string.equals("count")) { - mode = string; - this.inputs = new WiringButton[3]; - this.outputs = new WiringButton[1]; - this.outputs[0] = new WiringButton(214, 240, "Output", 0); - this.inputs[0] = new WiringButton(214, 220, "Source", 0); - this.inputs[1] = new WiringButton(214, 200, "Clock", 1); - this.inputs[2] = new WiringButton(214, 180, "Reset", 2); - initialized = true; + switch(string) { + case "constant": + mode = string; + this.inputs = new WiringButton[0]; + this.outputs = new WiringButton[1]; + this.outputs[0] = new WiringButton(214, 240, "Output", 0); + initialized = true; + hasSettings = true; + break; + case "count": + mode = string; + this.inputs = new WiringButton[3]; + this.outputs = new WiringButton[1]; + this.outputs[0] = new WiringButton(214, 240, "Output", 0); + this.inputs[0] = new WiringButton(214, 220, "Source", 0); + this.inputs[1] = new WiringButton(214, 200, "Clock", 1); + this.inputs[2] = new WiringButton(214, 180, "Reset", 2); + initialized = true; + break; } } }