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