001    package net.minecraft.src;
002    
003    public class ItemSaddle extends Item
004    {
005        public ItemSaddle(int par1)
006        {
007            super(par1);
008            this.maxStackSize = 1;
009            this.setCreativeTab(CreativeTabs.tabTransport);
010        }
011    
012        /**
013         * dye sheep, place saddles, etc ...
014         */
015        public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving)
016        {
017            if (par2EntityLiving instanceof EntityPig)
018            {
019                EntityPig var3 = (EntityPig)par2EntityLiving;
020    
021                if (!var3.getSaddled() && !var3.isChild())
022                {
023                    var3.setSaddled(true);
024                    --par1ItemStack.stackSize;
025                }
026    
027                return true;
028            }
029            else
030            {
031                return false;
032            }
033        }
034    
035        /**
036         * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
037         * the damage on the stack.
038         */
039        public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
040        {
041            this.itemInteractionForEntity(par1ItemStack, par2EntityLiving);
042            return true;
043        }
044    }