From b5d76afb8c0e7f9a842675e014e9156f78252cf8 Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 19:56:04 +1100 Subject: [PATCH 1/2] fix switching barrel types not updating fluid net --- .../tileentity/machine/storage/TileEntityBarrel.java | 12 ++++++++---- .../machine/storage/TileEntityMachineFluidTank.java | 10 +++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java index a6a8d4b80..a383f491a 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java @@ -48,6 +48,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable { protected FluidNode node; + protected FluidType lastType; public FluidTank tank; public short mode = 0; @@ -102,18 +103,21 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom // In buffer mode, acts like a pipe block, providing fluid to its own node // otherwise, it is a regular providing/receiving machine, blocking further propagation if(mode == 1) { - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = this.createNode(tank.getTankType()); UniNodespace.createNode(worldObj, this.node); + lastType = tank.getTankType(); } } - this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); - if(node != null && node.hasValidNet()) node.net.addReceiver(this); + if(node != null && node.hasValidNet()) { + node.net.addProvider(this); + node.net.addReceiver(this); + } } else { if(this.node != null) { UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index c63fefddc..ff27156ca 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -57,6 +57,7 @@ import java.util.Random; public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable { protected FluidNode node; + protected FluidType lastType; public FluidTank tank; public short mode = 0; @@ -116,18 +117,21 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements // In buffer mode, acts like a pipe block, providing fluid to its own node // otherwise, it is a regular providing/receiving machine, blocking further propagation if(mode == 1) { - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); if(this.node == null || this.node.expired) { this.node = this.createNode(tank.getTankType()); UniNodespace.createNode(worldObj, this.node); + lastType = tank.getTankType(); } } - this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); - if(node != null && node.hasValidNet()) node.net.addReceiver(this); + if(node != null && node.hasValidNet()) { + node.net.addProvider(this); + node.net.addReceiver(this); + } } else { if(this.node != null) { UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); From 177e5a245efab35fae21f6b329eab82fbe220c7f Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 20:00:01 +1100 Subject: [PATCH 2/2] dingleberry blues --- .../tileentity/machine/storage/TileEntityMachineFluidTank.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index ff27156ca..cf6e8dccc 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -121,7 +121,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = this.createNode(tank.getTankType()); UniNodespace.createNode(worldObj, this.node); lastType = tank.getTankType();