001 package net.minecraft.network.packet; 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 Packet16BlockItemSwitch extends Packet 010 { 011 /** The block/item id to be equipped. */ 012 public int id; 013 014 public Packet16BlockItemSwitch() {} 015 016 @SideOnly(Side.CLIENT) 017 public Packet16BlockItemSwitch(int par1) 018 { 019 this.id = par1; 020 } 021 022 /** 023 * Abstract. Reads the raw packet data from the data stream. 024 */ 025 public void readPacketData(DataInputStream par1DataInputStream) throws IOException 026 { 027 this.id = par1DataInputStream.readShort(); 028 } 029 030 /** 031 * Abstract. Writes the raw packet data to the data stream. 032 */ 033 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException 034 { 035 par1DataOutputStream.writeShort(this.id); 036 } 037 038 /** 039 * Passes this Packet on to the NetHandler for processing. 040 */ 041 public void processPacket(NetHandler par1NetHandler) 042 { 043 par1NetHandler.handleBlockItemSwitch(this); 044 } 045 046 /** 047 * Abstract. Return the size of the packet (not counting the header). 048 */ 049 public int getPacketSize() 050 { 051 return 2; 052 } 053 054 /** 055 * only false for the abstract Packet class, all real packets return true 056 */ 057 public boolean isRealPacket() 058 { 059 return true; 060 } 061 062 /** 063 * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet 064 * class 065 */ 066 public boolean containsSameEntityIDAs(Packet par1Packet) 067 { 068 return true; 069 } 070 }