|
|
@ -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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|