    001package net.minecraft.network.packet;
    002
    003import java.io.DataInputStream;
    004import java.io.DataOutputStream;
    005import java.io.IOException;
    006
    007public class Packet100OpenWindow extends Packet
    008{
    009    public int windowId;
    010    public int inventoryType;
    011    public String windowTitle;
    012    public int slotsCount;
    013    public boolean field_94500_e;
    014
    015    public Packet100OpenWindow() {}
    016
    017    public Packet100OpenWindow(int par1, int par2, String par3Str, int par4, boolean par5)
    018    {
    019        this.windowId = par1;
    020        this.inventoryType = par2;
    021        this.windowTitle = par3Str;
    022        this.slotsCount = par4;
    023        this.field_94500_e = par5;
    024    }
    025
    026    /**
    027     * Passes this Packet on to the NetHandler for processing.
    028     */
    029    public void processPacket(NetHandler par1NetHandler)
    030    {
    031        par1NetHandler.handleOpenWindow(this);
    032    }
    033
    034    /**
    035     * Abstract. Reads the raw packet data from the data stream.
    036     */
    037    public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    038    {
    039        this.windowId = par1DataInputStream.readByte() & 255;
    040        this.inventoryType = par1DataInputStream.readByte() & 255;
    041        this.windowTitle = readString(par1DataInputStream, 32);
    042        this.slotsCount = par1DataInputStream.readByte() & 255;
    043        this.field_94500_e = par1DataInputStream.readBoolean();
    044    }
    045
    046    /**
    047     * Abstract. Writes the raw packet data to the data stream.
    048     */
    049    public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    050    {
    051        par1DataOutputStream.writeByte(this.windowId & 255);
    052        par1DataOutputStream.writeByte(this.inventoryType & 255);
    053        writeString(this.windowTitle, par1DataOutputStream);
    054        par1DataOutputStream.writeByte(this.slotsCount & 255);
    055        par1DataOutputStream.writeBoolean(this.field_94500_e);
    056    }
    057
    058    /**
    059     * Abstract. Return the size of the packet (not counting the header).
    060     */
    061    public int getPacketSize()
    062    {
    063        return 4 + this.windowTitle.length();
    064    }
    065}