more of the last

This commit is contained in:
Rseifert 2013-04-02 01:42:53 -04:00
parent c4f9bb386f
commit 9e032eddd4
2 changed files with 13 additions and 23 deletions

View file

@ -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);
}
}
}

View file

@ -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)