    001package net.minecraft.network.packet;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.io.DataInputStream;
    006import java.io.DataOutputStream;
    007import java.io.IOException;
    008
    009public class Packet14BlockDig extends Packet
    010{
    011    /** Block X position. */
    012    public int xPosition;
    013
    014    /** Block Y position. */
    015    public int yPosition;
    016
    017    /** Block Z position. */
    018    public int zPosition;
    019
    020    /** Punched face of the block. */
    021    public int face;
    022
    023    /** Status of the digging (started, ongoing, broken). */
    024    public int status;
    025
    026    public Packet14BlockDig() {}
    027
    028    @SideOnly(Side.CLIENT)
    029    public Packet14BlockDig(int par1, int par2, int par3, int par4, int par5)
    030    {
    031        this.status = par1;
    032        this.xPosition = par2;
    033        this.yPosition = par3;
    034        this.zPosition = par4;
    035        this.face = par5;
    036    }
    037
    038    /**
    039     * Abstract. Reads the raw packet data from the data stream.
    040     */
    041    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    042    {
    043        this.status = par1DataInputStream.read();
    044        this.xPosition = par1DataInputStream.readInt();
    045        this.yPosition = par1DataInputStream.read();
    046        this.zPosition = par1DataInputStream.readInt();
    047        this.face = par1DataInputStream.read();
    048    }
    049
    050    /**
    051     * Abstract. Writes the raw packet data to the data stream.
    052     */
    053    public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    054    {
    055        par1DataOutputStream.write(this.status);
    056        par1DataOutputStream.writeInt(this.xPosition);
    057        par1DataOutputStream.write(this.yPosition);
    058        par1DataOutputStream.writeInt(this.zPosition);
    059        par1DataOutputStream.write(this.face);
    060    }
    061
    062    /**
    063     * Passes this Packet on to the NetHandler for processing.
    064     */
    065    public void processPacket(NetHandler par1NetHandler)
    066    {
    067        par1NetHandler.handleBlockDig(this);
    068    }
    069
    070    /**
    071     * Abstract. Return the size of the packet (not counting the header).
    072     */
    073    public int getPacketSize()
    074    {
    075        return 11;
    076    }
    077}