From ab6f7b8139149de6e7de9a0e6e981e8bdd5c4b2c Mon Sep 17 00:00:00 2001 From: Astoria Date: Tue, 4 Apr 2023 09:12:33 -0500 Subject: [PATCH] Better truthy values, gui changes, bugfixes! --- .../afloydwiremod/api/AbstractWireTileEntity.java | 2 -- .../afloydwiremod/gui/GuiButtonExtended.java | 2 +- .../brokenmoon/afloydwiremod/gui/GuiWiring.java | 10 ++++++---- .../afloydwiremod/tileentity/ChipTileEntity.java | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java index 8dc227f..0550b06 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java @@ -126,8 +126,6 @@ public abstract class AbstractWireTileEntity extends TileEntity { WireConnection wire = inputs[i].wire; AbstractWireTileEntity otherChip = (AbstractWireTileEntity)this.worldObj.getBlockTileEntity(wire.x, wire.y, wire.z); 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.updateIO(); } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiButtonExtended.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiButtonExtended.java index 62b9a01..b473463 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiButtonExtended.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiButtonExtended.java @@ -10,7 +10,7 @@ public class GuiButtonExtended extends GuiButton { public String type; public int slot; public int scroll; - public static final int width = 50; + public static final int width = 80; public static final int height = 10; 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); diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java index b0e3b64..8bae5ca 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java @@ -24,13 +24,13 @@ public class GuiWiring extends GuiScrollable { //Inputs if(wireEntity.inputs != null && !this.tool.type.equals("input")) { 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 if(wireEntity.outputs != null && !this.tool.type.equals("output")) { 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) { 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); - wireEntity.updateIO(); + wireEntity.update(); + otherEntity.update(); tool.xadd = new ArrayList(); tool.yadd = new ArrayList(); tool.zadd = new ArrayList(); @@ -86,7 +87,8 @@ public class GuiWiring extends GuiScrollable { 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); 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(); tool.yadd = new ArrayList(); diff --git a/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java index 553b6ed..00529a1 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java @@ -84,32 +84,32 @@ public class ChipTileEntity extends AbstractWireTileEntity { } 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() { - 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() { - 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() { - 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() { - 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() { 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() { - 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() {