diff --git a/src/dark/core/tile/network/NetworkTileEntities.java b/src/dark/core/tile/network/NetworkTileEntities.java index d3b467cd2..c608bad54 100644 --- a/src/dark/core/tile/network/NetworkTileEntities.java +++ b/src/dark/core/tile/network/NetworkTileEntities.java @@ -25,15 +25,21 @@ public abstract class NetworkTileEntities this.networkMember.addAll(Arrays.asList(parts)); } + /** Should be called after a network is created from a split or merge */ + public void init() + { + cleanUpMembers(); + } + /** Creates a new instance of this network to be used to merge or split networks while still * maintaining each class that extends the base network class - * + * * @return - new network instance using the current networks properties */ public abstract NetworkTileEntities newInstance(); /** Adds a TileEntity to the network. extends this to catch non-network parts and add them to * other tile lists - * + * * @param tileEntity - tileEntity instance * @param member - add to network member list * @return */ @@ -127,9 +133,22 @@ public abstract class NetworkTileEntities return this.networkMember; } + /** Override this to write any data to the time. Called before a merge, split, or major edit of the + * network */ + public void writeDataToTiles() + { + + } + /** Override this to write any data to the time. Called after a merge, split, or major edit of the + * network */ + public void readDataFromTiles() + { + + } + /** Combines two networks together into one. Calls to preMerge and doMerge instead of doing the * merge process itself - * + * * @param network * @param mergePoint */ public void merge(NetworkTileEntities network, INetworkPart mergePoint) @@ -145,20 +164,21 @@ public abstract class NetworkTileEntities /** Processing that needs too be done before the network merges. Use this to do final network * merge calculations and to cause network merge failure - * + * * @param network the network that is to merge with this one * @param part the part at which started the network merge. Use this to cause damage if two * networks merge with real world style failures - * + * * @return false if the merge needs to be canceled. - * + * * Cases in which the network should fail to merge are were the two networks merge with error. * Or, in the case of pipes the two networks merge and the merge point was destroyed by * combination of liquids. - * + * * Ex Lava and water */ public boolean preMergeProcessing(NetworkTileEntities network, INetworkPart part) { + this.writeDataToTiles(); return true; } @@ -168,6 +188,7 @@ public abstract class NetworkTileEntities NetworkTileEntities newNetwork = this.newInstance(); newNetwork.getNetworkMemebers().addAll(this.getNetworkMemebers()); newNetwork.getNetworkMemebers().addAll(network.getNetworkMemebers()); + newNetwork.readDataFromTiles(); newNetwork.init(); } @@ -238,12 +259,6 @@ public abstract class NetworkTileEntities } } - /** Should be called after a network is created from a split or merge */ - public void init() - { - cleanUpMembers(); - } - @Override public String toString() { @@ -251,7 +266,7 @@ public abstract class NetworkTileEntities } /** invalidates/remove a tile from the networks that surround and connect to it - * + * * @param tileEntity - tile */ public static void invalidate(TileEntity tileEntity) {