From 9cf6dbdb5acd87822cfaf2b4d480466c09f1bf00 Mon Sep 17 00:00:00 2001 From: Astoria Date: Mon, 3 Apr 2023 20:37:48 -0500 Subject: [PATCH] Crash fixes on chips with 0 inputs --- src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java | 4 ++-- src/main/java/net/brokenmoon/afloydwiremod/ter/TERWire.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java index 295bbb7..b10f44c 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java @@ -73,7 +73,7 @@ public class GuiWiring extends GuiScrollable { tool.sideadd = new ArrayList(); } } else if(!this.tool.type.equals("unpaired")) { - if(this.tool.type.equals("input") && this.wireEntity.inputs[tool.slot].wire.isMade != true) { + if(this.tool.type.equals("input") && wireEntity.outputs[tool.slot].wire.isMade != true && otherEntity.inputs[guibutton.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(); @@ -82,7 +82,7 @@ public class GuiWiring extends GuiScrollable { tool.zadd = new ArrayList(); tool.sideadd = new ArrayList(); tool.type = "unpaired"; - } else if(this.tool.type.equals("output") && otherEntity.outputs[tool.slot].wire.isMade != true) { + } else if(this.tool.type.equals("output") && otherEntity.outputs[tool.slot].wire.isMade != true && wireEntity.inputs[tool.slot].wire.isMade != true ) { 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); diff --git a/src/main/java/net/brokenmoon/afloydwiremod/ter/TERWire.java b/src/main/java/net/brokenmoon/afloydwiremod/ter/TERWire.java index d08c033..c96f839 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/ter/TERWire.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/ter/TERWire.java @@ -18,7 +18,7 @@ public class TERWire extends TileEntitySpecialRenderer { public void renderWireAt(AbstractWireTileEntity wireEntity, double x, double y, double z, float weird) { if(wireEntity.outputs != null){ for(int it = 0; it < wireEntity.outputs.length; it++){ - if(wireEntity.outputs[it].wire != null && wireEntity.outputs[it].wire.isMade){ + if(wireEntity.outputs[it] != null && wireEntity.outputs[it].wire != null && wireEntity.outputs[it].wire.isMade){ this.renderLineBetweenTwoPoints( wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord, wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z,