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