001package net.minecraft.network.packet;
002
003import java.io.DataInputStream;
004import java.io.DataOutputStream;
005import java.io.IOException;
006
007public class Packet105UpdateProgressbar extends Packet
008{
009    /** The id of the window that the progress bar is in. */
010    public int windowId;
011
012    /**
013     * Which of the progress bars that should be updated. (For furnaces, 0 = progress arrow, 1 = fire icon)
014     */
015    public int progressBar;
016
017    /**
018     * The value of the progress bar. The maximum values vary depending on the progress bar. Presumably the values are
019     * specified as in-game ticks. Some progress bar values increase, while others decrease. For furnaces, 0 is empty,
020     * full progress arrow = about 180, full fire icon = about 250)
021     */
022    public int progressBarValue;
023
024    public Packet105UpdateProgressbar() {}
025
026    public Packet105UpdateProgressbar(int par1, int par2, int par3)
027    {
028        this.windowId = par1;
029        this.progressBar = par2;
030        this.progressBarValue = par3;
031    }
032
033    /**
034     * Passes this Packet on to the NetHandler for processing.
035     */
036    public void processPacket(NetHandler par1NetHandler)
037    {
038        par1NetHandler.handleUpdateProgressbar(this);
039    }
040
041    /**
042     * Abstract. Reads the raw packet data from the data stream.
043     */
044    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
045    {
046        this.windowId = par1DataInputStream.readByte();
047        this.progressBar = par1DataInputStream.readShort();
048        this.progressBarValue = par1DataInputStream.readShort();
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.writeByte(this.windowId);
057        par1DataOutputStream.writeShort(this.progressBar);
058        par1DataOutputStream.writeShort(this.progressBarValue);
059    }
060
061    /**
062     * Abstract. Return the size of the packet (not counting the header).
063     */
064    public int getPacketSize()
065    {
066        return 5;
067    }
068}