001    package net.minecraft.src;
002    
003    import java.io.DataInputStream;
004    import java.io.DataOutputStream;
005    import java.io.IOException;
006    
007    public class Packet103SetSlot extends Packet
008    {
009        /** The window which is being updated. 0 for player inventory */
010        public int windowId;
011    
012        /** Slot that should be updated */
013        public int itemSlot;
014    
015        /** Item stack */
016        public ItemStack myItemStack;
017    
018        public Packet103SetSlot() {}
019    
020        public Packet103SetSlot(int par1, int par2, ItemStack par3ItemStack)
021        {
022            this.windowId = par1;
023            this.itemSlot = par2;
024            this.myItemStack = par3ItemStack == null ? par3ItemStack : par3ItemStack.copy();
025        }
026    
027        /**
028         * Passes this Packet on to the NetHandler for processing.
029         */
030        public void processPacket(NetHandler par1NetHandler)
031        {
032            par1NetHandler.handleSetSlot(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.itemSlot = par1DataInputStream.readShort();
042            this.myItemStack = readItemStack(par1DataInputStream);
043        }
044    
045        /**
046         * Abstract. Writes the raw packet data to the data stream.
047         */
048        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
049        {
050            par1DataOutputStream.writeByte(this.windowId);
051            par1DataOutputStream.writeShort(this.itemSlot);
052            writeItemStack(this.myItemStack, par1DataOutputStream);
053        }
054    
055        /**
056         * Abstract. Return the size of the packet (not counting the header).
057         */
058        public int getPacketSize()
059        {
060            return 8;
061        }
062    }