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