Prevent addon pipes from becoming permanent ghosts. Now when the addon is used again the pipes should at least display again.

This commit is contained in:
psxlover 2012-06-15 20:31:57 +03:00
parent 7150cbb30f
commit 6ab4ad9044

View file

@ -60,6 +60,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
private boolean blockNeighborChange = false;
private boolean pipeBound = false;
//Store the pipe key to prevent losing pipes when a user forgets to include an addon
int key;
@TileNetworkData
public int pipeId = -1;
@ -74,7 +77,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
if (pipe != null) {
nbttagcompound.setInteger("pipeId", pipe.itemID);
pipe.writeToNBT(nbttagcompound);
}
} else
nbttagcompound.setInteger("pipeId", key);
}
@Override
@ -82,7 +86,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
super.readFromNBT(nbttagcompound);
int key = nbttagcompound.getInteger("pipeId");
key = nbttagcompound.getInteger("pipeId");
pipe = BlockGenericPipe.createPipe(key);
if (pipe != null) {