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