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