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        public static final String[] bedChat = new String[] {"tile.bed.notValid", null, null, "gameMode.changed"};
010    
011        /**
012         * Either 1 or 2. 1 indicates to begin raining, 2 indicates to stop raining.
013         */
014        public int bedState;
015    
016        /** Used only when reason = 3. 0 is survival, 1 is creative. */
017        public int gameMode;
018    
019        public Packet70GameEvent() {}
020    
021        public Packet70GameEvent(int par1, int par2)
022        {
023            this.bedState = par1;
024            this.gameMode = par2;
025        }
026    
027        /**
028         * Abstract. Reads the raw packet data from the data stream.
029         */
030        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
031        {
032            this.bedState = par1DataInputStream.readByte();
033            this.gameMode = par1DataInputStream.readByte();
034        }
035    
036        /**
037         * Abstract. Writes the raw packet data to the data stream.
038         */
039        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
040        {
041            par1DataOutputStream.writeByte(this.bedState);
042            par1DataOutputStream.writeByte(this.gameMode);
043        }
044    
045        /**
046         * Passes this Packet on to the NetHandler for processing.
047         */
048        public void processPacket(NetHandler par1NetHandler)
049        {
050            par1NetHandler.handleBed(this);
051        }
052    
053        /**
054         * Abstract. Return the size of the packet (not counting the header).
055         */
056        public int getPacketSize()
057        {
058            return 2;
059        }
060    }