Fixed a few tile network creation issues

This commit is contained in:
DarkGuardsman 2013-11-25 11:03:31 -05:00
parent 127b145bf6
commit 15cfa7cf58
3 changed files with 36 additions and 14 deletions

View file

@ -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 /** 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 * 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. * in the over all tank. Eg water goes down air goes up.
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
public class NetworkFluidContainers extends NetworkFluidTiles public class NetworkFluidContainers extends NetworkFluidTiles
{ {
@ -23,6 +23,11 @@ public class NetworkFluidContainers extends NetworkFluidTiles
NetworkUpdateHandler.registerNetworkClass("FluidContainers", NetworkFluidContainers.class); NetworkUpdateHandler.registerNetworkClass("FluidContainers", NetworkFluidContainers.class);
} }
public NetworkFluidContainers()
{
super();
}
public NetworkFluidContainers(INetworkPart... parts) public NetworkFluidContainers(INetworkPart... parts)
{ {
super(parts); super(parts);

View file

@ -34,6 +34,11 @@ public class NetworkFluidTiles extends NetworkTileEntities
NetworkUpdateHandler.registerNetworkClass("FluidTiles", NetworkFluidTiles.class); NetworkUpdateHandler.registerNetworkClass("FluidTiles", NetworkFluidTiles.class);
} }
public NetworkFluidTiles()
{
super();
}
public NetworkFluidTiles(INetworkPart... parts) public NetworkFluidTiles(INetworkPart... parts)
{ {
super(parts); super(parts);
@ -223,20 +228,27 @@ public class NetworkFluidTiles extends NetworkTileEntities
protected void mergeDo(ITileNetwork network) protected void mergeDo(ITileNetwork network)
{ {
ITileNetwork newNetwork = NetworkUpdateHandler.createNewNetwork(NetworkUpdateHandler.getID(this.getClass())); ITileNetwork newNetwork = NetworkUpdateHandler.createNewNetwork(NetworkUpdateHandler.getID(this.getClass()));
if (newNetwork instanceof NetworkFluidTiles) if (newNetwork != null)
{ {
FluidStack one = this.getNetworkTank().getFluid(); if (newNetwork instanceof NetworkFluidTiles)
FluidStack two = ((NetworkFluidTiles) network).getNetworkTank().getFluid(); {
FluidStack one = this.getNetworkTank().getFluid();
FluidStack two = ((NetworkFluidTiles) network).getNetworkTank().getFluid();
this.getNetworkTank().setFluid(null); this.getNetworkTank().setFluid(null);
((NetworkFluidTiles) network).getNetworkTank().setFluid(null); ((NetworkFluidTiles) network).getNetworkTank().setFluid(null);
((NetworkFluidTiles) newNetwork).getNetworkTank().setFluid(FluidCraftingHandler.mergeFluidStacks(one, two)); ((NetworkFluidTiles) newNetwork).getNetworkTank().setFluid(FluidCraftingHandler.mergeFluidStacks(one, two));
((NetworkFluidTiles) newNetwork).sharedTankInfo = ((NetworkFluidTiles) newNetwork).getNetworkTank().getInfo(); ((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 @Override

View file

@ -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 /** 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 * threw each pipe. As well this doubled as a pressure network for those machines that support the
* use of pressure. * use of pressure.
* *
* @author Rseifert */ * @author Rseifert */
public class NetworkPipes extends NetworkFluidTiles public class NetworkPipes extends NetworkFluidTiles
{ {
@ -26,13 +26,18 @@ public class NetworkPipes extends NetworkFluidTiles
NetworkUpdateHandler.registerNetworkClass("FluidPipes", NetworkPipes.class); NetworkUpdateHandler.registerNetworkClass("FluidPipes", NetworkPipes.class);
} }
public NetworkPipes()
{
super();
}
public NetworkPipes(INetworkPart... parts) public NetworkPipes(INetworkPart... parts)
{ {
super(parts); super(parts);
} }
/** Adds FLuid to this network from one of the connected Pipes /** Adds FLuid to this network from one of the connected Pipes
* *
* @param source - Were this liquid came from * @param source - Were this liquid came from
* @param stack - LiquidStack to be sent * @param stack - LiquidStack to be sent
* @param doFill - actually fill the tank or just check numbers * @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 /** Adds FLuid to this network from one of the connected Pipes
* *
* @param source - Were this liquid came from * @param source - Were this liquid came from
* @param stack - LiquidStack to be sent * @param stack - LiquidStack to be sent
* @param doFill - actually fill the tank or just check numbers * @param doFill - actually fill the tank or just check numbers