diff --git a/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java b/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java index 3515c0bc..2c069a53 100644 --- a/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java +++ b/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipe.java @@ -56,7 +56,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer public enum PacketID { - PIPE_CONNECTIONS, EXTENTION_FULL, EXTENTION_UPDATE; + PIPE_CONNECTIONS, EXTENTION_CREATE, EXTENTION_UPDATE; } @Override @@ -146,7 +146,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer this.renderConnection[4] = dataStream.readBoolean(); this.renderConnection[5] = dataStream.readBoolean(); } - else if (id == PacketID.EXTENTION_FULL) + else if (id == PacketID.EXTENTION_CREATE) { int side = dataStream.readInt(); this.loadOrCreateSubTile(side, PacketManager.readNBTTagCompound(dataStream)); @@ -229,7 +229,10 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer { this.subEntities[side] = (IPipeExtention) tile; this.initSubTile(side); - System.out.println("Creating addon " + (worldObj.isRemote ? "Client" : "Server")); + if (worldObj != null) + { + System.out.println("Creating addon " + (worldObj.isRemote ? "Client" : "Server")); + } } } } @@ -254,9 +257,12 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer { NBTTagCompound tag = new NBTTagCompound(); ((TileEntity) this.subEntities[side]).writeToNBT(tag); - - Packet packet = PacketManager.getPacket(FluidMech.CHANNEL, this, PacketID.EXTENTION_FULL.ordinal(), ForgeDirection.getOrientation(side), tag); - PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 50); + if (tag != null && tag.getTags().size() != 0) + { + System.out.println("Sending TileEntity to Client"); + Packet packet = PacketManager.getPacket(FluidMech.CHANNEL, this, PacketID.EXTENTION_CREATE.ordinal(), ForgeDirection.getOrientation(side), tag); + PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 50); + } } } diff --git a/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipeExtention.java b/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipeExtention.java index 9c024e69..9ce89897 100644 --- a/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipeExtention.java +++ b/src/minecraft/fluidmech/common/machines/pipes/TileEntityPipeExtention.java @@ -20,23 +20,7 @@ import universalelectricity.prefab.tile.TileEntityAdvanced; public abstract class TileEntityPipeExtention extends TileEntityAdvanced implements IPipeExtention, IPacketReceiver { - private TileEntityPipe masterPipe = null; - - /** - * Reads a tile entity from NBT. - */ - public void readFromNBT(NBTTagCompound par1NBTTagCompound) - { - - } - - /** - * Writes a tile entity to NBT. - */ - public void writeToNBT(NBTTagCompound par1NBTTagCompound) - { - super.writeToNBT(par1NBTTagCompound); - } + private TileEntityPipe masterPipe = null; @Override public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)