From 3eb1d6cb2e77147e07855a76ff92f9784ff585df Mon Sep 17 00:00:00 2001 From: Astoria Date: Fri, 7 Apr 2023 19:27:27 -0500 Subject: [PATCH] Bugfixes! --- .../api/AbstractWireTileEntity.java | 16 ++++++++-------- .../mixin/MixinNetServerHandler.java | 2 +- .../afloydwiremod/tileentity/ChipTileEntity.java | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java index 01102ab..e45a9d8 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileEntity.java @@ -103,31 +103,31 @@ public abstract class AbstractWireTileEntity extends TileEntity { public void prepForDelete() { if(outputs != null) { for (int i = 0; i < outputs.length; ++i) { - if (outputs[i].wire != null && outputs[i].wire.thisslot > -1) { + if (outputs[i].wire != null) { WireConnection wire = outputs[i].wire; AbstractWireTileEntity otherChip = (AbstractWireTileEntity)this.worldObj.getBlockTileEntity(wire.x, wire.y, wire.z); - if(otherChip != null && otherChip.outputs != null) { + if(otherChip != null) { outputs[i].floatvalue = 0; outputs[i].stringvalue = ""; outputs[i].wire.isMade = false; - otherChip.inputs[wire.thatslot].wire.isMade = false; + otherChip.inputs[wire.thatslot].wire = new WireConnection(); this.updateIO(); otherChip.updateIO(); - worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord); - worldObj.markBlockNeedsUpdate(wire.x, wire.y, wire.z); } + worldObj.markBlockNeedsUpdate(wire.x, wire.y, wire.z); } } } if(inputs != null) { for (int i = 0; i < inputs.length; ++i) { - if (inputs[i].wire != null && inputs[i].wire.thisslot > -1) { + if (inputs[i].wire != null) { 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.length > wire.thatslot) { - otherChip.outputs[wire.thatslot].wire.isMade = false; + if(otherChip != null) { + otherChip.outputs[wire.thatslot].wire = new WireConnection(); otherChip.updateIO(); } + worldObj.markBlockNeedsUpdate(wire.x, wire.y, wire.z); } } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java index 7328d45..593e94b 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinNetServerHandler.java @@ -57,7 +57,7 @@ public class MixinNetServerHandler implements INetHandler { break; case 1: AbstractWireTileEntity otherEntity; - if(!packet.backwired) { + if(packet.backwired) { otherEntity = (AbstractWireTileEntity)this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x1, packet.y1, packet.z1); otherEntity.inputs[packet.slot2].wire = new WireConnection(packet.x2, packet.y2, packet.z2, packet.slot1, packet.slot2); } else{ diff --git a/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java index c500841..171ad9b 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/ChipTileEntity.java @@ -375,6 +375,7 @@ public class ChipTileEntity extends AbstractWireTileEntity { break; } initialized = true; + worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord); update(); } }