Switch instead of if

main
astoria 2 years ago
parent bd824b43a8
commit 80cb07dd48

@ -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")){
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();
}
}

@ -46,14 +46,16 @@ public class ChipTileEntity extends AbstractWireTileEntity {
public void setMode(String string) {
if (mode.equals("none")) {
if (string.equals("constant")) {
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;
} else if (string.equals("count")) {
break;
case "count":
mode = string;
this.inputs = new WiringButton[3];
this.outputs = new WiringButton[1];
@ -62,6 +64,7 @@ public class ChipTileEntity extends AbstractWireTileEntity {
this.inputs[1] = new WiringButton(214, 200, "Clock", 1);
this.inputs[2] = new WiringButton(214, 180, "Reset", 2);
initialized = true;
break;
}
}
}

Loading…
Cancel
Save