    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    public class ItemCarrotOnAStick extends Item
    007    {
    008        public ItemCarrotOnAStick(int par1)
    009        {
    010            super(par1);
    011            this.setCreativeTab(CreativeTabs.tabTransport);
    012            this.setMaxStackSize(1);
    013            this.setMaxDamage(25);
    014        }
    015
    016        @SideOnly(Side.CLIENT)
    017
    018        /**
    019         * Returns True is the item is renderer in full 3D when hold.
    020         */
    021        public boolean isFull3D()
    022        {
    023            return true;
    024        }
    025
    026        @SideOnly(Side.CLIENT)
    027
    028        /**
    029         * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities
    030         * hands.
    031         */
    032        public boolean shouldRotateAroundWhenRendering()
    033        {
    034            return true;
    035        }
    036
    037        /**
    038         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
    039         */
    040        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    041        {
    042            if (par3EntityPlayer.isRiding() && par3EntityPlayer.ridingEntity instanceof EntityPig)
    043            {
    044                EntityPig var4 = (EntityPig)par3EntityPlayer.ridingEntity;
    045
    046                if (var4.getAIControlledByPlayer().isControlledByPlayer() && par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage() >= 7)
    047                {
    048                    var4.getAIControlledByPlayer().boostSpeed();
    049                    par1ItemStack.damageItem(7, par3EntityPlayer);
    050
    051                    if (par1ItemStack.stackSize == 0)
    052                    {
    053                        return new ItemStack(Item.fishingRod);
    054                    }
    055                }
    056            }
    057
    058            return par1ItemStack;
    059        }
    060    }