001    package net.minecraft.src;
002    
003    public class EntityAIOwnerHurtByTarget extends EntityAITarget
004    {
005        EntityTameable theDefendingTameable;
006        EntityLiving theOwnerAttacker;
007    
008        public EntityAIOwnerHurtByTarget(EntityTameable par1EntityTameable)
009        {
010            super(par1EntityTameable, 32.0F, false);
011            this.theDefendingTameable = par1EntityTameable;
012            this.setMutexBits(1);
013        }
014    
015        /**
016         * Returns whether the EntityAIBase should begin execution.
017         */
018        public boolean shouldExecute()
019        {
020            if (!this.theDefendingTameable.isTamed())
021            {
022                return false;
023            }
024            else
025            {
026                EntityLiving var1 = this.theDefendingTameable.getOwner();
027    
028                if (var1 == null)
029                {
030                    return false;
031                }
032                else
033                {
034                    this.theOwnerAttacker = var1.getAITarget();
035                    return this.isSuitableTarget(this.theOwnerAttacker, false);
036                }
037            }
038        }
039    
040        /**
041         * Execute a one shot task or start executing a continuous task
042         */
043        public void startExecuting()
044        {
045            this.taskOwner.setAttackTarget(this.theOwnerAttacker);
046            super.startExecuting();
047        }
048    }