    001    package net.minecraft.src;
    002
    003    public class EntityAIBreedSheep extends EntityAIMate
    004    {
    005        private final InventoryCrafting field_85150_d = new InventoryCrafting(new ContainerMateAI(this), 2, 1);
    006
    007        public EntityAIBreedSheep(EntityAnimal par1EntityAnimal, float par2)
    008        {
    009            super(par1EntityAnimal, par2);
    010            this.field_85150_d.setInventorySlotContents(0, new ItemStack(Item.dyePowder, 1, 0));
    011            this.field_85150_d.setInventorySlotContents(1, new ItemStack(Item.dyePowder, 1, 0));
    012        }
    013
    014        protected void func_85147_a(EntityAnimal par1EntityAnimal, EntityAnimal par2EntityAnimal, EntityAnimal par3EntityAnimal)
    015        {
    016            super.func_85147_a(par1EntityAnimal, par2EntityAnimal, par3EntityAnimal);
    017
    018            if (par1EntityAnimal instanceof EntitySheep && par2EntityAnimal instanceof EntitySheep && par3EntityAnimal instanceof EntitySheep)
    019            {
    020                int var4 = this.func_85149_a(par1EntityAnimal, par2EntityAnimal);
    021                ((EntitySheep)par3EntityAnimal).setFleeceColor(15 - var4);
    022            }
    023        }
    024
    025        private int func_85149_a(EntityAnimal par1EntityAnimal, EntityAnimal par2EntityAnimal)
    026        {
    027            int var3 = this.func_85148_a(par1EntityAnimal);
    028            int var4 = this.func_85148_a(par2EntityAnimal);
    029            this.field_85150_d.getStackInSlot(0).setItemDamage(var3);
    030            this.field_85150_d.getStackInSlot(1).setItemDamage(var4);
    031            ItemStack var5 = CraftingManager.getInstance().findMatchingRecipe(this.field_85150_d, ((EntitySheep)par1EntityAnimal).worldObj);
    032            int var6;
    033
    034            if (var5 != null && var5.getItem().shiftedIndex == Item.dyePowder.shiftedIndex)
    035            {
    036                var6 = var5.getItemDamage();
    037            }
    038            else
    039            {
    040                var6 = this.theWorld.rand.nextFloat() > 0.5F ? var3 : var4;
    041            }
    042
    043            return var6;
    044        }
    045
    046        private int func_85148_a(EntityAnimal par1EntityAnimal)
    047        {
    048            return 15 - ((EntitySheep)par1EntityAnimal).getFleeceColor();
    049        }
    050    }