001package net.minecraft.network.packet;
002
003import java.io.DataInputStream;
004import java.io.DataOutputStream;
005import java.io.IOException;
006
007public class Packet54PlayNoteBlock extends Packet
008{
009    public int xLocation;
010    public int yLocation;
011    public int zLocation;
012
013    /** 1=Double Bass, 2=Snare Drum, 3=Clicks / Sticks, 4=Bass Drum, 5=Harp */
014    public int instrumentType;
015
016    /**
017     * The pitch of the note (between 0-24 inclusive where 0 is the lowest and 24 is the highest).
018     */
019    public int pitch;
020
021    /** The block ID this action is set for. */
022    public int blockId;
023
024    public Packet54PlayNoteBlock() {}
025
026    public Packet54PlayNoteBlock(int par1, int par2, int par3, int par4, int par5, int par6)
027    {
028        this.xLocation = par1;
029        this.yLocation = par2;
030        this.zLocation = par3;
031        this.instrumentType = par5;
032        this.pitch = par6;
033        this.blockId = par4;
034    }
035
036    /**
037     * Abstract. Reads the raw packet data from the data stream.
038     */
039    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
040    {
041        this.xLocation = par1DataInputStream.readInt();
042        this.yLocation = par1DataInputStream.readShort();
043        this.zLocation = par1DataInputStream.readInt();
044        this.instrumentType = par1DataInputStream.read();
045        this.pitch = par1DataInputStream.read();
046        this.blockId = par1DataInputStream.readShort() & 4095;
047    }
048
049    /**
050     * Abstract. Writes the raw packet data to the data stream.
051     */
052    public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
053    {
054        par1DataOutputStream.writeInt(this.xLocation);
055        par1DataOutputStream.writeShort(this.yLocation);
056        par1DataOutputStream.writeInt(this.zLocation);
057        par1DataOutputStream.write(this.instrumentType);
058        par1DataOutputStream.write(this.pitch);
059        par1DataOutputStream.writeShort(this.blockId & 4095);
060    }
061
062    /**
063     * Passes this Packet on to the NetHandler for processing.
064     */
065    public void processPacket(NetHandler par1NetHandler)
066    {
067        par1NetHandler.handleBlockEvent(this);
068    }
069
070    /**
071     * Abstract. Return the size of the packet (not counting the header).
072     */
073    public int getPacketSize()
074    {
075        return 14;
076    }
077}