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 Packet70GameEvent extends Packet
008 {
009 /**
010 * The client prints clientMessage[eventType] to chat when this packet is received.
011 */
012 public static final String[] clientMessage = new String[] {"tile.bed.notValid", null, null, "gameMode.changed"};
013
014 /** 0: Invalid bed, 1: Rain starts, 2: Rain stops, 3: Game mode changed. */
015 public int eventType;
016
017 /**
018 * When reason==3, the game mode to set. See EnumGameType for a list of values.
019 */
020 public int gameMode;
021
022 public Packet70GameEvent() {}
023
024 public Packet70GameEvent(int par1, int par2)
025 {
026 this.eventType = par1;
027 this.gameMode = par2;
028 }
029
030 /**
031 * Abstract. Reads the raw packet data from the data stream.
032 */
033 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
034 {
035 this.eventType = par1DataInputStream.readByte();
036 this.gameMode = par1DataInputStream.readByte();
037 }
038
039 /**
040 * Abstract. Writes the raw packet data to the data stream.
041 */
042 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
043 {
044 par1DataOutputStream.writeByte(this.eventType);
045 par1DataOutputStream.writeByte(this.gameMode);
046 }
047
048 /**
049 * Passes this Packet on to the NetHandler for processing.
050 */
051 public void processPacket(NetHandler par1NetHandler)
052 {
053 par1NetHandler.handleGameEvent(this);
054 }
055
056 /**
057 * Abstract. Return the size of the packet (not counting the header).
058 */
059 public int getPacketSize()
060 {
061 return 2;
062 }
063 }