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 ItemFishingRod extends Item
007    {
008        public ItemFishingRod(int par1)
009        {
010            super(par1);
011            this.setMaxDamage(64);
012            this.setMaxStackSize(1);
013            this.setTabToDisplayOn(CreativeTabs.tabTools);
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.fishEntity != null)
043            {
044                int var4 = par3EntityPlayer.fishEntity.catchFish();
045                par1ItemStack.damageItem(var4, par3EntityPlayer);
046                par3EntityPlayer.swingItem();
047            }
048            else
049            {
050                par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
051    
052                if (!par2World.isRemote)
053                {
054                    par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
055                }
056    
057                par3EntityPlayer.swingItem();
058            }
059    
060            return par1ItemStack;
061        }
062    }