|
|
|
@ -24,6 +24,10 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
doIncrementDecrement();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "mem":
|
|
|
|
|
doMemory();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "dup":
|
|
|
|
|
doDup();
|
|
|
|
|
updateIO();
|
|
|
|
@ -80,9 +84,65 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
outputs[0].floatvalue = 0.0f;
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "==":
|
|
|
|
|
doEquals();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "!=":
|
|
|
|
|
doNotEquals();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case ">":
|
|
|
|
|
doGreater();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case ">=":
|
|
|
|
|
doGreaterEq();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "<":
|
|
|
|
|
doLess();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "<=":
|
|
|
|
|
doLessEq();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
case "<=>":
|
|
|
|
|
doSpaceShip();
|
|
|
|
|
updateIO();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doSpaceShip() {
|
|
|
|
|
outputs[0].floatvalue = Float.compare(inputs[0].floatvalue, inputs[1].floatvalue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doLessEq() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue <= inputs[1].floatvalue ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doLess() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue < inputs[1].floatvalue ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doGreaterEq() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue >= inputs[1].floatvalue ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doGreater() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue > inputs[1].floatvalue ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doNotEquals() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue != inputs[1].floatvalue ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doEquals() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue == inputs[1].floatvalue ? 1.0f : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doXNOR() {
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue != 0 ^ inputs[1].floatvalue != 0 ? 0.0f : 1.0f;
|
|
|
|
|
}
|
|
|
|
@ -181,6 +241,19 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doMemory() {
|
|
|
|
|
if (inputs[2].floatvalue > 0) {
|
|
|
|
|
this.outputs[0].floatvalue = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.inputs[1].floatvalue > 0 && shouldIncrement) {
|
|
|
|
|
this.outputs[0].floatvalue = this.inputs[0].floatvalue;
|
|
|
|
|
shouldIncrement = false;
|
|
|
|
|
} else if (this.inputs[1].floatvalue == 0.0 && !shouldIncrement) {
|
|
|
|
|
shouldIncrement = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
|
super.readFromNBT(nbttagcompound);
|
|
|
|
@ -207,6 +280,7 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
break;
|
|
|
|
|
case "inc":
|
|
|
|
|
case "dec":
|
|
|
|
|
case "mem":
|
|
|
|
|
this.inputs = new WiringButton[3];
|
|
|
|
|
this.outputs = new WiringButton[1];
|
|
|
|
|
this.outputs[0] = new WiringButton(214, 240, "Output", 0);
|
|
|
|
@ -246,6 +320,13 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
|
case "sub":
|
|
|
|
|
case "mult":
|
|
|
|
|
case "div":
|
|
|
|
|
case "==":
|
|
|
|
|
case "!=":
|
|
|
|
|
case ">":
|
|
|
|
|
case ">=":
|
|
|
|
|
case "<":
|
|
|
|
|
case "<=":
|
|
|
|
|
case "<=>":
|
|
|
|
|
this.inputs = new WiringButton[2];
|
|
|
|
|
this.outputs = new WiringButton[1];
|
|
|
|
|
this.outputs[0] = new WiringButton(214, 230, "Output", 0);
|
|
|
|
|