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