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
009 public class Packet205ClientCommand extends Packet
010 {
011 /**
012 * 0 sent to a netLoginHandler starts the server, 1 sent to NetServerHandler forces a respawn
013 */
014 public int forceRespawn;
015
016 public Packet205ClientCommand() {}
017
018 @SideOnly(Side.CLIENT)
019 public Packet205ClientCommand(int par1)
020 {
021 this.forceRespawn = par1;
022 }
023
024 /**
025 * Abstract. Reads the raw packet data from the data stream.
026 */
027 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
028 {
029 this.forceRespawn = par1DataInputStream.readByte();
030 }
031
032 /**
033 * Abstract. Writes the raw packet data to the data stream.
034 */
035 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
036 {
037 par1DataOutputStream.writeByte(this.forceRespawn & 255);
038 }
039
040 /**
041 * Passes this Packet on to the NetHandler for processing.
042 */
043 public void processPacket(NetHandler par1NetHandler)
044 {
045 par1NetHandler.handleClientCommand(this);
046 }
047
048 /**
049 * Abstract. Return the size of the packet (not counting the header).
050 */
051 public int getPacketSize()
052 {
053 return 1;
054 }
055 }