Better truthy values, gui changes, bugfixes!

main
Astoria 2 years ago
parent 6baf9edc67
commit ab6f7b8139

@ -126,8 +126,6 @@ public abstract class AbstractWireTileEntity extends TileEntity {
WireConnection wire = inputs[i].wire; WireConnection wire = inputs[i].wire;
AbstractWireTileEntity otherChip = (AbstractWireTileEntity)this.worldObj.getBlockTileEntity(wire.x, wire.y, wire.z); AbstractWireTileEntity otherChip = (AbstractWireTileEntity)this.worldObj.getBlockTileEntity(wire.x, wire.y, wire.z);
if(otherChip != null && otherChip.outputs != null) { if(otherChip != null && otherChip.outputs != null) {
otherChip.outputs[wire.thatslot].floatvalue = 0;
otherChip.outputs[wire.thatslot].stringvalue = "";
otherChip.outputs[wire.thatslot].wire.isMade = false; otherChip.outputs[wire.thatslot].wire.isMade = false;
otherChip.updateIO(); otherChip.updateIO();
} }

@ -10,7 +10,7 @@ public class GuiButtonExtended extends GuiButton {
public String type; public String type;
public int slot; public int slot;
public int scroll; public int scroll;
public static final int width = 50; public static final int width = 80;
public static final int height = 10; public static final int height = 10;
public GuiButtonExtended(int id, int xPosition, String s, String extra, int slot) { public GuiButtonExtended(int id, int xPosition, String s, String extra, int slot) {
super(id, xPosition / 2 - (width / 2), 50 - height + (height * (id + 1)), width, height, s); super(id, xPosition / 2 - (width / 2), 50 - height + (height * (id + 1)), width, height, s);

@ -24,13 +24,13 @@ public class GuiWiring extends GuiScrollable {
//Inputs //Inputs
if(wireEntity.inputs != null && !this.tool.type.equals("input")) { if(wireEntity.inputs != null && !this.tool.type.equals("input")) {
for (int i = 0; i < wireEntity.inputs.length; i++) { for (int i = 0; i < wireEntity.inputs.length; i++) {
this.controlList.add(new GuiButtonExtended(i, this.width - 50, wireEntity.inputs[i].buttonString, "Input", wireEntity.inputs[i].slot)); this.controlList.add(new GuiButtonExtended(i, this.width - GuiButtonExtended.width, wireEntity.inputs[i].buttonString, "Input", wireEntity.inputs[i].slot));
} }
} }
//Outputs //Outputs
if(wireEntity.outputs != null && !this.tool.type.equals("output")) { if(wireEntity.outputs != null && !this.tool.type.equals("output")) {
for (int i = 0; i < wireEntity.outputs.length; i++) { for (int i = 0; i < wireEntity.outputs.length; i++) {
this.controlList.add(new GuiButtonExtended(i, this.width + 50, wireEntity.outputs[i].buttonString, "Output", wireEntity.outputs[i].slot)); this.controlList.add(new GuiButtonExtended(i, this.width + GuiButtonExtended.width, wireEntity.outputs[i].buttonString, "Output", wireEntity.outputs[i].slot));
} }
} }
} }
@ -76,7 +76,8 @@ public class GuiWiring extends GuiScrollable {
if(this.tool.type.equals("input") && wireEntity.outputs[guibutton.slot].wire.isMade != true && otherEntity.inputs[tool.slot].wire.isMade != true) { if(this.tool.type.equals("input") && wireEntity.outputs[guibutton.slot].wire.isMade != true && otherEntity.inputs[tool.slot].wire.isMade != true) {
wireEntity.outputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width); wireEntity.outputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width);
otherEntity.inputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot); otherEntity.inputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot);
wireEntity.updateIO(); wireEntity.update();
otherEntity.update();
tool.xadd = new ArrayList<Integer>(); tool.xadd = new ArrayList<Integer>();
tool.yadd = new ArrayList<Integer>(); tool.yadd = new ArrayList<Integer>();
tool.zadd = new ArrayList<Integer>(); tool.zadd = new ArrayList<Integer>();
@ -86,7 +87,8 @@ public class GuiWiring extends GuiScrollable {
if(otherEntity != null) { if(otherEntity != null) {
otherEntity.outputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width); otherEntity.outputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width);
wireEntity.inputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot); wireEntity.inputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot);
otherEntity.updateIO(); wireEntity.update();
otherEntity.update();
} }
tool.xadd = new ArrayList<Integer>(); tool.xadd = new ArrayList<Integer>();
tool.yadd = new ArrayList<Integer>(); tool.yadd = new ArrayList<Integer>();

@ -84,32 +84,32 @@ public class ChipTileEntity extends AbstractWireTileEntity {
} }
private void doXNOR() { private void doXNOR() {
outputs[0].floatvalue = inputs[0].floatvalue == 1 ^ inputs[1].floatvalue == 1 ? 0.0f : 1.0f; outputs[0].floatvalue = inputs[0].floatvalue != 0 ^ inputs[1].floatvalue != 0 ? 0.0f : 1.0f;
} }
private void doNOR() { private void doNOR() {
outputs[0].floatvalue = inputs[0].floatvalue == 1 || inputs[1].floatvalue == 1 ? 0.0f : 1.0f; outputs[0].floatvalue = inputs[0].floatvalue != 0 || inputs[1].floatvalue != 0 ? 0.0f : 1.0f;
} }
private void doNAND() { private void doNAND() {
outputs[0].floatvalue = inputs[0].floatvalue == 1 && inputs[1].floatvalue == 1 ? 0.0f : 1.0f; outputs[0].floatvalue = inputs[0].floatvalue != 0 && inputs[1].floatvalue != 0 ? 0.0f : 1.0f;
} }
private void doXOR() { private void doXOR() {
outputs[0].floatvalue = inputs[0].floatvalue == 1 ^ inputs[1].floatvalue == 1 ? 1.0f : 0.0f; outputs[0].floatvalue = inputs[0].floatvalue != 0 ^ inputs[1].floatvalue != 0 ? 1.0f : 0.0f;
} }
private void doOR() { private void doOR() {
outputs[0].floatvalue = inputs[0].floatvalue == 1 || inputs[1].floatvalue == 1 ? 1.0f : 0.0f; outputs[0].floatvalue = inputs[0].floatvalue != 0 || inputs[1].floatvalue != 0 ? 1.0f : 0.0f;
} }
private void doAND() { private void doAND() {
System.out.println("ae"); System.out.println("ae");
outputs[0].floatvalue = inputs[0].floatvalue == 1 && inputs[1].floatvalue == 1 ? 1.0f : 0.0f; outputs[0].floatvalue = inputs[0].floatvalue != 0 && inputs[1].floatvalue != 0 ? 1.0f : 0.0f;
} }
private void doNOT() { private void doNOT() {
this.outputs[0].floatvalue = inputs[0].floatvalue == 0 ? 1.0f : 0.0f; this.outputs[0].floatvalue = inputs[0].floatvalue != 0 ? 0.0f : 1.0f;
} }
private void doIncrementDecrement() { private void doIncrementDecrement() {

Loading…
Cancel
Save