@Override public void saveTileExtra(NBTTagCompound nbt) { super.saveTileExtra(nbt); for (int i = 0; i < connections.length; i++) { if (connections[i] != null) nbt.setTag("co" + i, connections[i].saveConnection()); } }
@Override public void updatePacket(NBTTagCompound nbt) { super.updatePacket(nbt); for (int i = 0; i < connections.length; i++) { if (connections[i] != null) nbt.setTag("co" + i, connections[i].saveConnection()); } }
@Override public void loadTileExtra(NBTTagCompound nbt) { super.loadTileExtra(nbt); ((TileEntityLittleCable) tileEntity).cable = this; if (connections == null) connections = new Connection[6]; for (int i = 0; i < 6; i++) { if (nbt.hasKey("co" + i)) { connections[i] = new Connection(nbt.getCompoundTag("co" + i)); if (connections[i].isInvalid()) connections[i] = null; } } updateBoxes(); }
@Override @SideOnly(Side.CLIENT) public void receivePacket(NBTTagCompound nbt, NetworkManager net) { super.receivePacket(nbt, net); ((TileEntityLittleCable) tileEntity).cable = this; if (connections == null) connections = new Connection[6]; else Arrays.fill(connections, null); for (int i = 0; i < 6; i++) { if (nbt.hasKey("co" + i)) { connections[i] = new Connection(nbt.getCompoundTag("co" + i)); if (connections[i].isInvalid()) connections[i] = null; } } updateBoxes(); }