    001    package net.minecraft.network.packet;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.io.DataInputStream;
    006    import java.io.DataOutputStream;
    007    import java.io.IOException;
    008
    009    public class Packet7UseEntity extends Packet
    010    {
    011        /** The entity of the player (ignored by the server) */
    012        public int playerEntityId;
    013
    014        /** The entity the player is interacting with */
    015        public int targetEntity;
    016
    017        /**
    018         * Seems to be true when the player is pointing at an entity and left-clicking and false when right-clicking.
    019         */
    020        public int isLeftClick;
    021
    022        public Packet7UseEntity() {}
    023
    024        @SideOnly(Side.CLIENT)
    025        public Packet7UseEntity(int par1, int par2, int par3)
    026        {
    027            this.playerEntityId = par1;
    028            this.targetEntity = par2;
    029            this.isLeftClick = par3;
    030        }
    031
    032        /**
    033         * Abstract. Reads the raw packet data from the data stream.
    034         */
    035        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
    036        {
    037            this.playerEntityId = par1DataInputStream.readInt();
    038            this.targetEntity = par1DataInputStream.readInt();
    039            this.isLeftClick = par1DataInputStream.readByte();
    040        }
    041
    042        /**
    043         * Abstract. Writes the raw packet data to the data stream.
    044         */
    045        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
    046        {
    047            par1DataOutputStream.writeInt(this.playerEntityId);
    048            par1DataOutputStream.writeInt(this.targetEntity);
    049            par1DataOutputStream.writeByte(this.isLeftClick);
    050        }
    051
    052        /**
    053         * Passes this Packet on to the NetHandler for processing.
    054         */
    055        public void processPacket(NetHandler par1NetHandler)
    056        {
    057            par1NetHandler.handleUseEntity(this);
    058        }
    059
    060        /**
    061         * Abstract. Return the size of the packet (not counting the header).
    062         */
    063        public int getPacketSize()
    064        {
    065            return 9;
    066        }
    067    }