|
|
@ -8,6 +8,22 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
public String mode = "none";
|
|
|
|
public String mode = "none";
|
|
|
|
private boolean shouldIncrement = true;
|
|
|
|
private boolean shouldIncrement = true;
|
|
|
|
private boolean shouldDecrement = true;
|
|
|
|
private boolean shouldDecrement = true;
|
|
|
|
|
|
|
|
private int timer;
|
|
|
|
|
|
|
|
public int tickAmount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void updateEntity(){
|
|
|
|
|
|
|
|
if(timer == 0){
|
|
|
|
|
|
|
|
switch (mode){
|
|
|
|
|
|
|
|
case "Pulse":
|
|
|
|
|
|
|
|
outputs[0].floatvalue = 0;
|
|
|
|
|
|
|
|
outputs[0].stringvalue = "";
|
|
|
|
|
|
|
|
updateIO();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else{
|
|
|
|
|
|
|
|
timer--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void update() {
|
|
|
|
public void update() {
|
|
|
@ -112,6 +128,24 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
doSpaceShip();
|
|
|
|
doSpaceShip();
|
|
|
|
updateIO();
|
|
|
|
updateIO();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "Pulse":
|
|
|
|
|
|
|
|
doPulse();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void doPulse() {
|
|
|
|
|
|
|
|
if(inputs[0].floatvalue != 0 && timer == 0) {
|
|
|
|
|
|
|
|
outputs[0].floatvalue = inputs[0].floatvalue;
|
|
|
|
|
|
|
|
outputs[0].stringvalue = inputs[0].stringvalue;
|
|
|
|
|
|
|
|
updateIO();
|
|
|
|
|
|
|
|
if(tickAmount == 0){
|
|
|
|
|
|
|
|
outputs[0].floatvalue = 0;
|
|
|
|
|
|
|
|
outputs[0].stringvalue = "";
|
|
|
|
|
|
|
|
updateIO();
|
|
|
|
|
|
|
|
} else{
|
|
|
|
|
|
|
|
timer = tickAmount - 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -258,12 +292,14 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
super.readFromNBT(nbttagcompound);
|
|
|
|
super.readFromNBT(nbttagcompound);
|
|
|
|
this.mode = nbttagcompound.getString("mode");
|
|
|
|
this.mode = nbttagcompound.getString("mode");
|
|
|
|
|
|
|
|
this.tickAmount = nbttagcompound.getInteger("tickAmount");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
super.writeToNBT(nbttagcompound);
|
|
|
|
super.writeToNBT(nbttagcompound);
|
|
|
|
nbttagcompound.setString("mode", mode);
|
|
|
|
nbttagcompound.setString("mode", mode);
|
|
|
|
|
|
|
|
nbttagcompound.setInteger("tickAmount", tickAmount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setMode(String string) {
|
|
|
|
public void setMode(String string) {
|
|
|
@ -304,6 +340,8 @@ public class ChipTileEntity extends AbstractWireTileEntity {
|
|
|
|
this.outputs[1] = new WiringButton(214, 210, "Output B", 1);
|
|
|
|
this.outputs[1] = new WiringButton(214, 210, "Output B", 1);
|
|
|
|
this.inputs[0] = new WiringButton(214, 230, "Input", 0);
|
|
|
|
this.inputs[0] = new WiringButton(214, 230, "Input", 0);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "Pulse":
|
|
|
|
|
|
|
|
hasSettings = true;
|
|
|
|
case "NOT":
|
|
|
|
case "NOT":
|
|
|
|
this.inputs = new WiringButton[1];
|
|
|
|
this.inputs = new WiringButton[1];
|
|
|
|
this.outputs = new WiringButton[1];
|
|
|
|
this.outputs = new WiringButton[1];
|
|
|
|