    001    package net.minecraft.src;
    002
    003    import java.io.DataInputStream;
    004    import java.io.DataOutputStream;
    005    import java.io.IOException;
    006
    007    public class Packet0KeepAlive extends Packet
    008    {
    009        public int randomId;
    010
    011        public Packet0KeepAlive() {}
    012
    013        public Packet0KeepAlive(int par1)
    014        {
    015            this.randomId = par1;
    016        }
    017
    018        /**
    019         * Passes this Packet on to the NetHandler for processing.
    020         */
    021        public void processPacket(NetHandler par1NetHandler)
    022        {
    023            par1NetHandler.handleKeepAlive(this);
    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.randomId = par1DataInputStream.readInt();
    032        }
    033
    034        /**
    035         * Abstract. Writes the raw packet data to the data stream.
    036         */
    037        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    038        {
    039            par1DataOutputStream.writeInt(this.randomId);
    040        }
    041
    042        /**
    043         * Abstract. Return the size of the packet (not counting the header).
    044         */
    045        public int getPacketSize()
    046        {
    047            return 4;
    048        }
    049
    050        /**
    051         * only false for the abstract Packet class, all real packets return true
    052         */
    053        public boolean isRealPacket()
    054        {
    055            return true;
    056        }
    057
    058        /**
    059         * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
    060         * class
    061         */
    062        public boolean containsSameEntityIDAs(Packet par1Packet)
    063        {
    064            return true;
    065        }
    066
    067        /**
    068         * if this returns false, processPacket is deffered for processReadPackets to handle
    069         */
    070        public boolean isWritePacket()
    071        {
    072            return true;
    073        }
    074    }