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