    001package net.minecraft.network.packet;
    002
    003import java.io.DataInputStream;
    004import java.io.DataOutputStream;
    005import java.io.IOException;
    006
    007public class Packet29DestroyEntity extends Packet
    008{
    009    /** ID of the entity to be destroyed on the client. */
    010    public int[] entityId;
    011
    012    public Packet29DestroyEntity() {}
    013
    014    public Packet29DestroyEntity(int ... par1ArrayOfInteger)
    015    {
    016        this.entityId = par1ArrayOfInteger;
    017    }
    018
    019    /**
    020     * Abstract. Reads the raw packet data from the data stream.
    021     */
    022    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    023    {
    024        this.entityId = new int[par1DataInputStream.readByte()];
    025
    026        for (int i = 0; i < this.entityId.length; ++i)
    027        {
    028            this.entityId[i] = par1DataInputStream.readInt();
    029        }
    030    }
    031
    032    /**
    033     * Abstract. Writes the raw packet data to the data stream.
    034     */
    035    public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    036    {
    037        par1DataOutputStream.writeByte(this.entityId.length);
    038
    039        for (int i = 0; i < this.entityId.length; ++i)
    040        {
    041            par1DataOutputStream.writeInt(this.entityId[i]);
    042        }
    043    }
    044
    045    /**
    046     * Passes this Packet on to the NetHandler for processing.
    047     */
    048    public void processPacket(NetHandler par1NetHandler)
    049    {
    050        par1NetHandler.handleDestroyEntity(this);
    051    }
    052
    053    /**
    054     * Abstract. Return the size of the packet (not counting the header).
    055     */
    056    public int getPacketSize()
    057    {
    058        return 1 + this.entityId.length * 4;
    059    }
    060}