From 15cfa7cf58fa67475d74670d985010af64f3cb17 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Mon, 25 Nov 2013 11:03:31 -0500 Subject: [PATCH] Fixed a few tile network creation issues --- .../fluid/NetworkFluidContainers.java | 7 +++- .../tilenetwork/fluid/NetworkFluidTiles.java | 32 +++++++++++++------ .../tilenetwork/fluid/NetworkPipes.java | 11 +++++-- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidContainers.java b/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidContainers.java index 85a13d4ef..d3eec62e7 100644 --- a/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidContainers.java +++ b/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidContainers.java @@ -14,7 +14,7 @@ import dark.core.prefab.tilenetwork.NetworkUpdateHandler; /** Basically the same as network Fluid tiles class with the only difference being in how it stores * the fluid. When it goes to sort the fluid it will use the fluid properties to adjust its position * in the over all tank. Eg water goes down air goes up. - * + * * @author DarkGuardsman */ public class NetworkFluidContainers extends NetworkFluidTiles { @@ -23,6 +23,11 @@ public class NetworkFluidContainers extends NetworkFluidTiles NetworkUpdateHandler.registerNetworkClass("FluidContainers", NetworkFluidContainers.class); } + public NetworkFluidContainers() + { + super(); + } + public NetworkFluidContainers(INetworkPart... parts) { super(parts); diff --git a/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidTiles.java b/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidTiles.java index edc77a421..53b03de61 100644 --- a/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidTiles.java +++ b/src/dark/core/prefab/tilenetwork/fluid/NetworkFluidTiles.java @@ -34,6 +34,11 @@ public class NetworkFluidTiles extends NetworkTileEntities NetworkUpdateHandler.registerNetworkClass("FluidTiles", NetworkFluidTiles.class); } + public NetworkFluidTiles() + { + super(); + } + public NetworkFluidTiles(INetworkPart... parts) { super(parts); @@ -223,20 +228,27 @@ public class NetworkFluidTiles extends NetworkTileEntities protected void mergeDo(ITileNetwork network) { ITileNetwork newNetwork = NetworkUpdateHandler.createNewNetwork(NetworkUpdateHandler.getID(this.getClass())); - if (newNetwork instanceof NetworkFluidTiles) + if (newNetwork != null) { - FluidStack one = this.getNetworkTank().getFluid(); - FluidStack two = ((NetworkFluidTiles) network).getNetworkTank().getFluid(); + if (newNetwork instanceof NetworkFluidTiles) + { + FluidStack one = this.getNetworkTank().getFluid(); + FluidStack two = ((NetworkFluidTiles) network).getNetworkTank().getFluid(); - this.getNetworkTank().setFluid(null); - ((NetworkFluidTiles) network).getNetworkTank().setFluid(null); + this.getNetworkTank().setFluid(null); + ((NetworkFluidTiles) network).getNetworkTank().setFluid(null); - ((NetworkFluidTiles) newNetwork).getNetworkTank().setFluid(FluidCraftingHandler.mergeFluidStacks(one, two)); - ((NetworkFluidTiles) newNetwork).sharedTankInfo = ((NetworkFluidTiles) newNetwork).getNetworkTank().getInfo(); + ((NetworkFluidTiles) newNetwork).getNetworkTank().setFluid(FluidCraftingHandler.mergeFluidStacks(one, two)); + ((NetworkFluidTiles) newNetwork).sharedTankInfo = ((NetworkFluidTiles) newNetwork).getNetworkTank().getInfo(); + } + newNetwork.getMembers().addAll(this.getMembers()); + newNetwork.getMembers().addAll(network.getMembers()); + newNetwork.onCreated(); + } + else + { + System.out.println("[NetworkFluidTiles] Failed to merge network due to the new network returned null"); } - newNetwork.getMembers().addAll(this.getMembers()); - newNetwork.getMembers().addAll(network.getMembers()); - newNetwork.onCreated(); } @Override diff --git a/src/dark/core/prefab/tilenetwork/fluid/NetworkPipes.java b/src/dark/core/prefab/tilenetwork/fluid/NetworkPipes.java index ed504bbc6..c7ca34d02 100644 --- a/src/dark/core/prefab/tilenetwork/fluid/NetworkPipes.java +++ b/src/dark/core/prefab/tilenetwork/fluid/NetworkPipes.java @@ -14,7 +14,7 @@ import dark.core.prefab.tilenetwork.NetworkUpdateHandler; /** Extension on the fluid container network to provide a more advanced reaction to fluid passing * threw each pipe. As well this doubled as a pressure network for those machines that support the * use of pressure. - * + * * @author Rseifert */ public class NetworkPipes extends NetworkFluidTiles { @@ -26,13 +26,18 @@ public class NetworkPipes extends NetworkFluidTiles NetworkUpdateHandler.registerNetworkClass("FluidPipes", NetworkPipes.class); } + public NetworkPipes() + { + super(); + } + public NetworkPipes(INetworkPart... parts) { super(parts); } /** Adds FLuid to this network from one of the connected Pipes - * + * * @param source - Were this liquid came from * @param stack - LiquidStack to be sent * @param doFill - actually fill the tank or just check numbers @@ -43,7 +48,7 @@ public class NetworkPipes extends NetworkFluidTiles } /** Adds FLuid to this network from one of the connected Pipes - * + * * @param source - Were this liquid came from * @param stack - LiquidStack to be sent * @param doFill - actually fill the tank or just check numbers