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

@ -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

@ -26,6 +26,11 @@ 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);