More chips!

main
Astoria 2 years ago
parent 9cf6dbdb5a
commit c0e198d8c5

@ -14,7 +14,11 @@ public class GuiProgrammer extends GuiScrollable {
//This.width / 2 //This.width / 2
this.controlList.add(new GuiButtonExtended(1, this.width, "Constant")); this.controlList.add(new GuiButtonExtended(1, this.width, "Constant"));
this.controlList.add(new GuiButtonExtended(2, this.width, "Count")); this.controlList.add(new GuiButtonExtended(2, this.width, "Count"));
this.controlList.add(new GuiButtonExtended(3, this.width, "Addition")); this.controlList.add(new GuiButtonExtended(3, this.width, "Duplicate"));
this.controlList.add(new GuiButtonExtended(4, this.width, "Addition"));
this.controlList.add(new GuiButtonExtended(5, this.width, "Subtraction"));
this.controlList.add(new GuiButtonExtended(6, this.width, "Multiplication"));
this.controlList.add(new GuiButtonExtended(7, this.width, "Division"));
} }
public GuiProgrammer(EntityPlayer player, AbstractWireTileEntity wireEntity) { public GuiProgrammer(EntityPlayer player, AbstractWireTileEntity wireEntity) {
@ -33,8 +37,20 @@ public class GuiProgrammer extends GuiScrollable {
((ChipTileEntity) wireEntity).setMode("count"); ((ChipTileEntity) wireEntity).setMode("count");
break; break;
case 3: case 3:
((ChipTileEntity) wireEntity).setMode("dup");
break;
case 4:
((ChipTileEntity) wireEntity).setMode("add"); ((ChipTileEntity) wireEntity).setMode("add");
break; break;
case 5:
((ChipTileEntity) wireEntity).setMode("sub");
break;
case 6:
((ChipTileEntity) wireEntity).setMode("mult");
break;
case 7:
((ChipTileEntity) wireEntity).setMode("div");
break;
} }
} }
this.mc.displayGuiScreen(null); this.mc.displayGuiScreen(null);

@ -15,15 +15,51 @@ public class ChipTileEntity extends AbstractWireTileEntity {
doIncrement(); doIncrement();
updateIO(); updateIO();
break; break;
case "dup":
doDup();
updateIO();
break;
case "add": case "add":
doAdd(); doAdd();
updateIO(); updateIO();
break; break;
case "sub":
doSub();
updateIO();
break;
case "mult":
doMult();
updateIO();
break;
case "div":
doDiv();
updateIO();
break;
}
} }
private void doDiv() {
outputs[0].floatvalue = inputs[0].floatvalue / inputs[1].floatvalue;
}
private void doMult() {
outputs[0].floatvalue = inputs[0].floatvalue * inputs[1].floatvalue;
}
private void doSub() {
outputs[0].floatvalue = inputs[0].floatvalue - inputs[1].floatvalue;
}
private void doDup() {
outputs[0].floatvalue = inputs[0].floatvalue;
outputs[1].floatvalue = inputs[0].floatvalue;
outputs[0].stringvalue = inputs[0].stringvalue;
outputs[1].stringvalue = inputs[0].stringvalue;
} }
private void doAdd() { private void doAdd() {
outputs[0].floatvalue = inputs[0].floatvalue + inputs[1].floatvalue; outputs[0].floatvalue = inputs[0].floatvalue + inputs[1].floatvalue;
outputs[0].stringvalue = inputs[0].stringvalue + inputs[1].stringvalue;
} }
public void doIncrement() { public void doIncrement() {
@ -69,12 +105,41 @@ public class ChipTileEntity extends AbstractWireTileEntity {
this.inputs[1] = new WiringButton(214, 200, "Clock", 1); this.inputs[1] = new WiringButton(214, 200, "Clock", 1);
this.inputs[2] = new WiringButton(214, 180, "Reset", 2); this.inputs[2] = new WiringButton(214, 180, "Reset", 2);
break; break;
case "dup":
this.inputs = new WiringButton[1];
this.outputs = new WiringButton[2];
this.outputs[0] = new WiringButton(214, 230, "Output A", 0);
this.outputs[1] = new WiringButton(214, 210, "Output B", 1);
this.inputs[0] = new WiringButton(214, 230, "Input", 0);
break;
case "add": case "add":
this.inputs = new WiringButton[2]; this.inputs = new WiringButton[2];
this.outputs = new WiringButton[1]; this.outputs = new WiringButton[1];
this.outputs[0] = new WiringButton(214, 230, "Output", 0); this.outputs[0] = new WiringButton(214, 230, "Output", 0);
this.inputs[0] = new WiringButton(214, 210, "Input A", 0); this.inputs[0] = new WiringButton(214, 210, "Input A", 0);
this.inputs[1] = new WiringButton(214, 190, "Input B", 1); this.inputs[1] = new WiringButton(214, 190, "Input B", 1);
break;
case "sub":
this.inputs = new WiringButton[2];
this.outputs = new WiringButton[1];
this.outputs[0] = new WiringButton(214, 230, "Output", 0);
this.inputs[0] = new WiringButton(214, 210, "Input A", 0);
this.inputs[1] = new WiringButton(214, 190, "Input B", 1);
break;
case "mult":
this.inputs = new WiringButton[2];
this.outputs = new WiringButton[1];
this.outputs[0] = new WiringButton(214, 230, "Output", 0);
this.inputs[0] = new WiringButton(214, 210, "Input A", 0);
this.inputs[1] = new WiringButton(214, 190, "Input B", 1);
break;
case "div":
this.inputs = new WiringButton[2];
this.outputs = new WiringButton[1];
this.outputs[0] = new WiringButton(214, 230, "Output", 0);
this.inputs[0] = new WiringButton(214, 210, "Input A", 0);
this.inputs[1] = new WiringButton(214, 190, "Input B", 1);
break;
} }
initialized = true; initialized = true;
} }

Loading…
Cancel
Save