001 package net.minecraft.src; 002 003 public class EntityAIOwnerHurtTarget extends EntityAITarget 004 { 005 EntityTameable theEntityTameable; 006 EntityLiving theTarget; 007 008 public EntityAIOwnerHurtTarget(EntityTameable par1EntityTameable) 009 { 010 super(par1EntityTameable, 32.0F, false); 011 this.theEntityTameable = 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.theEntityTameable.isTamed()) 021 { 022 return false; 023 } 024 else 025 { 026 EntityLiving var1 = this.theEntityTameable.getOwner(); 027 028 if (var1 == null) 029 { 030 return false; 031 } 032 else 033 { 034 this.theTarget = var1.getLastAttackingEntity(); 035 return this.isSuitableTarget(this.theTarget, 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.theTarget); 046 super.startExecuting(); 047 } 048 }