package net.minecraft.network.packet; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import net.minecraft.item.ItemStack; public class Packet103SetSlot extends Packet { /** The window which is being updated. 0 for player inventory */ public int windowId; /** Slot that should be updated */ public int itemSlot; /** Item stack */ public ItemStack myItemStack; public Packet103SetSlot() {} public Packet103SetSlot(int par1, int par2, ItemStack par3ItemStack) { this.windowId = par1; this.itemSlot = par2; this.myItemStack = par3ItemStack == null ? par3ItemStack : par3ItemStack.copy(); } /** * Passes this Packet on to the NetHandler for processing. */ public void processPacket(NetHandler par1NetHandler) { par1NetHandler.handleSetSlot(this); } /** * Abstract. Reads the raw packet data from the data stream. */ public void readPacketData(DataInputStream par1DataInputStream) throws IOException { this.windowId = par1DataInputStream.readByte(); this.itemSlot = par1DataInputStream.readShort(); this.myItemStack = readItemStack(par1DataInputStream); } /** * Abstract. Writes the raw packet data to the data stream. */ public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException { par1DataOutputStream.writeByte(this.windowId); par1DataOutputStream.writeShort(this.itemSlot); writeItemStack(this.myItemStack, par1DataOutputStream); } /** * Abstract. Return the size of the packet (not counting the header). */ public int getPacketSize() { return 8; } }