    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 Packet39AttachEntity extends Packet
    008    {
    009        public int entityId;
    010        public int vehicleEntityId;
    011
    012        public Packet39AttachEntity() {}
    013
    014        public Packet39AttachEntity(Entity par1Entity, Entity par2Entity)
    015        {
    016            this.entityId = par1Entity.entityId;
    017            this.vehicleEntityId = par2Entity != null ? par2Entity.entityId : -1;
    018        }
    019
    020        /**
    021         * Abstract. Return the size of the packet (not counting the header).
    022         */
    023        public int getPacketSize()
    024        {
    025            return 8;
    026        }
    027
    028        /**
    029         * Abstract. Reads the raw packet data from the data stream.
    030         */
    031        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    032        {
    033            this.entityId = par1DataInputStream.readInt();
    034            this.vehicleEntityId = par1DataInputStream.readInt();
    035        }
    036
    037        /**
    038         * Abstract. Writes the raw packet data to the data stream.
    039         */
    040        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    041        {
    042            par1DataOutputStream.writeInt(this.entityId);
    043            par1DataOutputStream.writeInt(this.vehicleEntityId);
    044        }
    045
    046        /**
    047         * Passes this Packet on to the NetHandler for processing.
    048         */
    049        public void processPacket(NetHandler par1NetHandler)
    050        {
    051            par1NetHandler.handleAttachEntity(this);
    052        }
    053
    054        /**
    055         * only false for the abstract Packet class, all real packets return true
    056         */
    057        public boolean isRealPacket()
    058        {
    059            return true;
    060        }
    061
    062        /**
    063         * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
    064         * class
    065         */
    066        public boolean containsSameEntityIDAs(Packet par1Packet)
    067        {
    068            Packet39AttachEntity var2 = (Packet39AttachEntity)par1Packet;
    069            return var2.entityId == this.entityId;
    070        }
    071    }