001 package net.minecraft.item; 002 003 import cpw.mods.fml.relauncher.Side; 004 import cpw.mods.fml.relauncher.SideOnly; 005 import net.minecraft.creativetab.CreativeTabs; 006 import net.minecraft.entity.passive.EntityPig; 007 import net.minecraft.entity.player.EntityPlayer; 008 import net.minecraft.world.World; 009 010 public class ItemCarrotOnAStick extends Item 011 { 012 public ItemCarrotOnAStick(int par1) 013 { 014 super(par1); 015 this.setCreativeTab(CreativeTabs.tabTransport); 016 this.setMaxStackSize(1); 017 this.setMaxDamage(25); 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.isRiding() && par3EntityPlayer.ridingEntity instanceof EntityPig) 047 { 048 EntityPig var4 = (EntityPig)par3EntityPlayer.ridingEntity; 049 050 if (var4.getAIControlledByPlayer().isControlledByPlayer() && par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage() >= 7) 051 { 052 var4.getAIControlledByPlayer().boostSpeed(); 053 par1ItemStack.damageItem(7, par3EntityPlayer); 054 055 if (par1ItemStack.stackSize == 0) 056 { 057 ItemStack var5 = new ItemStack(Item.fishingRod); 058 var5.setTagCompound(par1ItemStack.stackTagCompound); 059 return var5; 060 } 061 } 062 } 063 064 return par1ItemStack; 065 } 066 }