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 import net.minecraft.item.ItemStack; 009 010 public class Packet107CreativeSetSlot extends Packet 011 { 012 public int slot; 013 public ItemStack itemStack; 014 015 public Packet107CreativeSetSlot() {} 016 017 @SideOnly(Side.CLIENT) 018 public Packet107CreativeSetSlot(int par1, ItemStack par2ItemStack) 019 { 020 this.slot = par1; 021 this.itemStack = par2ItemStack; 022 } 023 024 /** 025 * Passes this Packet on to the NetHandler for processing. 026 */ 027 public void processPacket(NetHandler par1NetHandler) 028 { 029 par1NetHandler.handleCreativeSetSlot(this); 030 } 031 032 /** 033 * Abstract. Reads the raw packet data from the data stream. 034 */ 035 public void readPacketData(DataInputStream par1DataInputStream) throws IOException 036 { 037 this.slot = par1DataInputStream.readShort(); 038 this.itemStack = readItemStack(par1DataInputStream); 039 } 040 041 /** 042 * Abstract. Writes the raw packet data to the data stream. 043 */ 044 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException 045 { 046 par1DataOutputStream.writeShort(this.slot); 047 writeItemStack(this.itemStack, par1DataOutputStream); 048 } 049 050 /** 051 * Abstract. Return the size of the packet (not counting the header). 052 */ 053 public int getPacketSize() 054 { 055 return 8; 056 } 057 }