Add init() to network after merge/split

This should remove the need for other networks to have custom split or
merge code just to add a few lines of code. Example was the removal of
the needed for Fluid networks in FM to have custom split/merge code to
add balanceTanks() method.
This commit is contained in:
DarkGuardsman 2013-07-25 07:19:55 -04:00
parent c6dcab98a6
commit a1400a1a12
2 changed files with 10 additions and 4 deletions

View file

@ -18,4 +18,6 @@ public interface INetworkPart extends ITileConnector
/** Sets the networkPart's primary network */ /** Sets the networkPart's primary network */
public void setTileNetwork(NetworkTileEntities fluidNetwok); public void setTileNetwork(NetworkTileEntities fluidNetwok);
public boolean mergeDamage(String result);
} }

View file

@ -168,8 +168,7 @@ public abstract class NetworkTileEntities
NetworkTileEntities newNetwork = this.newInstance(); NetworkTileEntities newNetwork = this.newInstance();
newNetwork.getNetworkMemebers().addAll(this.getNetworkMemebers()); newNetwork.getNetworkMemebers().addAll(this.getNetworkMemebers());
newNetwork.getNetworkMemebers().addAll(network.getNetworkMemebers()); newNetwork.getNetworkMemebers().addAll(network.getNetworkMemebers());
newNetwork.init();
newNetwork.refresh();
} }
/** Called when a peace of the network is remove from the network. Will split the network if it /** Called when a peace of the network is remove from the network. Will split the network if it
@ -230,8 +229,7 @@ public abstract class NetworkTileEntities
} }
} }
} }
newNetwork.init();
newNetwork.cleanUpMembers();
} }
} }
} }
@ -240,6 +238,12 @@ public abstract class NetworkTileEntities
} }
} }
/** Should be called after a network is created from a split or merge */
public void init()
{
cleanUpMembers();
}
@Override @Override
public String toString() public String toString()
{ {