001package net.minecraft.item;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import net.minecraft.creativetab.CreativeTabs;
006import net.minecraft.entity.player.EntityPlayer;
007import net.minecraft.entity.projectile.EntityFishHook;
008import net.minecraft.world.World;
009
010public class ItemFishingRod extends Item
011{
012    public ItemFishingRod(int par1)
013    {
014        super(par1);
015        this.setMaxDamage(64);
016        this.setMaxStackSize(1);
017        this.setCreativeTab(CreativeTabs.tabTools);
018    }
019
020    @SideOnly(Side.CLIENT)
021
022    /**
023     * Returns True is the item is renderer in full 3D when hold.
024     */
025    public boolean isFull3D()
026    {
027        return true;
028    }
029
030    @SideOnly(Side.CLIENT)
031
032    /**
033     * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities
034     * hands.
035     */
036    public boolean shouldRotateAroundWhenRendering()
037    {
038        return true;
039    }
040
041    /**
042     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
043     */
044    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
045    {
046        if (par3EntityPlayer.fishEntity != null)
047        {
048            int var4 = par3EntityPlayer.fishEntity.catchFish();
049            par1ItemStack.damageItem(var4, par3EntityPlayer);
050            par3EntityPlayer.swingItem();
051        }
052        else
053        {
054            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
055
056            if (!par2World.isRemote)
057            {
058                par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
059            }
060
061            par3EntityPlayer.swingItem();
062        }
063
064        return par1ItemStack;
065    }
066}