    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 Packet26EntityExpOrb extends Packet
    008    {
    009        /** Entity ID for the XP Orb */
    010        public int entityId;
    011        public int posX;
    012        public int posY;
    013        public int posZ;
    014
    015        /** The Orbs Experience points value. */
    016        public int xpValue;
    017
    018        public Packet26EntityExpOrb() {}
    019
    020        public Packet26EntityExpOrb(EntityXPOrb par1EntityXPOrb)
    021        {
    022            this.entityId = par1EntityXPOrb.entityId;
    023            this.posX = MathHelper.floor_double(par1EntityXPOrb.posX * 32.0D);
    024            this.posY = MathHelper.floor_double(par1EntityXPOrb.posY * 32.0D);
    025            this.posZ = MathHelper.floor_double(par1EntityXPOrb.posZ * 32.0D);
    026            this.xpValue = par1EntityXPOrb.getXpValue();
    027        }
    028
    029        /**
    030         * Abstract. Reads the raw packet data from the data stream.
    031         */
    032        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    033        {
    034            this.entityId = par1DataInputStream.readInt();
    035            this.posX = par1DataInputStream.readInt();
    036            this.posY = par1DataInputStream.readInt();
    037            this.posZ = par1DataInputStream.readInt();
    038            this.xpValue = par1DataInputStream.readShort();
    039        }
    040
    041        /**
    042         * Abstract. Writes the raw packet data to the data stream.
    043         */
    044        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    045        {
    046            par1DataOutputStream.writeInt(this.entityId);
    047            par1DataOutputStream.writeInt(this.posX);
    048            par1DataOutputStream.writeInt(this.posY);
    049            par1DataOutputStream.writeInt(this.posZ);
    050            par1DataOutputStream.writeShort(this.xpValue);
    051        }
    052
    053        /**
    054         * Passes this Packet on to the NetHandler for processing.
    055         */
    056        public void processPacket(NetHandler par1NetHandler)
    057        {
    058            par1NetHandler.handleEntityExpOrb(this);
    059        }
    060
    061        /**
    062         * Abstract. Return the size of the packet (not counting the header).
    063         */
    064        public int getPacketSize()
    065        {
    066            return 18;
    067        }
    068    }