    001    package net.minecraft.network.packet;
    002
    003    import cpw.mods.fml.relauncher.Side;
    004    import cpw.mods.fml.relauncher.SideOnly;
    005    import java.io.DataInputStream;
    006    import java.io.DataOutputStream;
    007    import java.io.IOException;
    008
    009    public class Packet108EnchantItem extends Packet
    010    {
    011        public int windowId;
    012
    013        /**
    014         * The position of the enchantment on the enchantment table window, starting with 0 as the topmost one.
    015         */
    016        public int enchantment;
    017
    018        public Packet108EnchantItem() {}
    019
    020        @SideOnly(Side.CLIENT)
    021        public Packet108EnchantItem(int par1, int par2)
    022        {
    023            this.windowId = par1;
    024            this.enchantment = par2;
    025        }
    026
    027        /**
    028         * Passes this Packet on to the NetHandler for processing.
    029         */
    030        public void processPacket(NetHandler par1NetHandler)
    031        {
    032            par1NetHandler.handleEnchantItem(this);
    033        }
    034
    035        /**
    036         * Abstract. Reads the raw packet data from the data stream.
    037         */
    038        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    039        {
    040            this.windowId = par1DataInputStream.readByte();
    041            this.enchantment = par1DataInputStream.readByte();
    042        }
    043
    044        /**
    045         * Abstract. Writes the raw packet data to the data stream.
    046         */
    047        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    048        {
    049            par1DataOutputStream.writeByte(this.windowId);
    050            par1DataOutputStream.writeByte(this.enchantment);
    051        }
    052
    053        /**
    054         * Abstract. Return the size of the packet (not counting the header).
    055         */
    056        public int getPacketSize()
    057        {
    058            return 2;
    059        }
    060    }