001 package net.minecraft.src;
002
003 import java.io.DataInputStream;
004 import java.io.DataOutputStream;
005 import java.io.IOException;
006
007 public class Packet132TileEntityData extends Packet
008 {
009 /** The X position of the tile entity to update. */
010 public int xPosition;
011
012 /** The Y position of the tile entity to update. */
013 public int yPosition;
014
015 /** The Z position of the tile entity to update. */
016 public int zPosition;
017
018 /** The type of update to perform on the tile entity. */
019 public int actionType;
020
021 /** Custom parameter 1 passed to the tile entity on update. */
022 public NBTTagCompound customParam1;
023
024 public Packet132TileEntityData()
025 {
026 this.isChunkDataPacket = true;
027 }
028
029 public Packet132TileEntityData(int par1, int par2, int par3, int par4, NBTTagCompound par5NBTTagCompound)
030 {
031 this.isChunkDataPacket = true;
032 this.xPosition = par1;
033 this.yPosition = par2;
034 this.zPosition = par3;
035 this.actionType = par4;
036 this.customParam1 = par5NBTTagCompound;
037 }
038
039 /**
040 * Abstract. Reads the raw packet data from the data stream.
041 */
042 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
043 {
044 this.xPosition = par1DataInputStream.readInt();
045 this.yPosition = par1DataInputStream.readShort();
046 this.zPosition = par1DataInputStream.readInt();
047 this.actionType = par1DataInputStream.readByte();
048 this.customParam1 = readNBTTagCompound(par1DataInputStream);
049 }
050
051 /**
052 * Abstract. Writes the raw packet data to the data stream.
053 */
054 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
055 {
056 par1DataOutputStream.writeInt(this.xPosition);
057 par1DataOutputStream.writeShort(this.yPosition);
058 par1DataOutputStream.writeInt(this.zPosition);
059 par1DataOutputStream.writeByte((byte)this.actionType);
060 writeNBTTagCompound(this.customParam1, par1DataOutputStream);
061 }
062
063 /**
064 * Passes this Packet on to the NetHandler for processing.
065 */
066 public void processPacket(NetHandler par1NetHandler)
067 {
068 par1NetHandler.handleTileEntityData(this);
069 }
070
071 /**
072 * Abstract. Return the size of the packet (not counting the header).
073 */
074 public int getPacketSize()
075 {
076 return 25;
077 }
078 }