|
|
|
@ -44,9 +44,74 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
doDiv();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "NOT":
|
|
|
|
|
doNOT();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "AND":
|
|
|
|
|
doAND();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "OR":
|
|
|
|
|
doOR();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "XOR":
|
|
|
|
|
doXOR();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "NAND":
|
|
|
|
|
doNAND();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "NOR":
|
|
|
|
|
doNOR();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "XNOR":
|
|
|
|
|
doXNOR();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "TRUE":
|
|
|
|
|
outputs[0].floatvalue = 1.0f;
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "FALSE":
|
|
|
|
|
outputs[0].floatvalue = 0.0f;
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doXNOR() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue == 1 ^ inputs[1].floatvalue == 1 ? 0.0f : 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doNOR() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue == 1 || inputs[1].floatvalue == 1 ? 0.0f : 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doNAND() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue == 1 && inputs[1].floatvalue == 1 ? 0.0f : 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doXOR() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue == 1 ^ inputs[1].floatvalue == 1 ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doOR() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue == 1 || inputs[1].floatvalue == 1 ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doAND() {
|
|
|
|
|
System.out.println("ae");
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue == 1 && inputs[1].floatvalue == 1 ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doNOT() {
|
|
|
|
|
this.outputs[0].floatvalue = inputs[0].floatvalue == 0 ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doIncrementDecrement() {
|
|
|
|
|
if (inputs[3].floatvalue > 0) {
|
|
|
|
|
this.outputs[0].floatvalue = 0;
|
|
|
|
@ -133,10 +198,12 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
mode = string;
|
|
|
|
|
switch(string) {
|
|
|
|
|
case "constant":
|
|
|
|
|
hasSettings = true;
|
|
|
|
|
case "TRUE":
|
|
|
|
|
case "FALSE":
|
|
|
|
|
this.inputs = new WiringButton[0];
|
|
|
|
|
this.outputs = new WiringButton[1];
|
|
|
|
|
this.outputs[0] = new WiringButton(214, 240, "Output", 0);
|
|
|
|
|
hasSettings = true;
|
|
|
|
|
break;
|
|
|
|
|
case "inc":
|
|
|
|
|
case "dec":
|
|
|
|
@ -163,6 +230,18 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
this.outputs[1] = new WiringButton(214, 210, "Output B", 1);
|
|
|
|
|
this.inputs[0] = new WiringButton(214, 230, "Input", 0);
|
|
|
|
|
break;
|
|
|
|
|
case "NOT":
|
|
|
|
|
this.inputs = new WiringButton[1];
|
|
|
|
|
this.outputs = new WiringButton[1];
|
|
|
|
|
this.outputs[0] = new WiringButton(214, 230, "Output", 0);
|
|
|
|
|
this.inputs[0] = new WiringButton(214, 210, "Input", 0);
|
|
|
|
|
break;
|
|
|
|
|
case "AND":
|
|
|
|
|
case "OR":
|
|
|
|
|
case "XOR":
|
|
|
|
|
case "NAND":
|
|
|
|
|
case "NOR":
|
|
|
|
|
case "XNOR":
|
|
|
|
|
case "add":
|
|
|
|
|
case "sub":
|
|
|
|
|
case "mult":
|
|
|
|
@ -175,6 +254,7 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
initialized = true;
|
|
|
|
|
update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|