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 Packet19EntityAction extends Packet 010 { 011 /** Player ID. */ 012 public int entityId; 013 014 /** 1=sneak, 2=normal */ 015 public int state; 016 017 public Packet19EntityAction() {} 018 019 @SideOnly(Side.CLIENT) 020 public Packet19EntityAction(Entity par1Entity, int par2) 021 { 022 this.entityId = par1Entity.entityId; 023 this.state = par2; 024 } 025 026 /** 027 * Abstract. Reads the raw packet data from the data stream. 028 */ 029 public void readPacketData(DataInputStream par1DataInputStream) throws IOException 030 { 031 this.entityId = par1DataInputStream.readInt(); 032 this.state = par1DataInputStream.readByte(); 033 } 034 035 /** 036 * Abstract. Writes the raw packet data to the data stream. 037 */ 038 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException 039 { 040 par1DataOutputStream.writeInt(this.entityId); 041 par1DataOutputStream.writeByte(this.state); 042 } 043 044 /** 045 * Passes this Packet on to the NetHandler for processing. 046 */ 047 public void processPacket(NetHandler par1NetHandler) 048 { 049 par1NetHandler.handleEntityAction(this); 050 } 051 052 /** 053 * Abstract. Return the size of the packet (not counting the header). 054 */ 055 public int getPacketSize() 056 { 057 return 5; 058 } 059 }