001 package net.minecraft.entity.ai; 002 003 import net.minecraft.entity.EntityLiving; 004 import net.minecraft.entity.passive.EntityTameable; 005 006 public class EntityAIOwnerHurtByTarget extends EntityAITarget 007 { 008 EntityTameable theDefendingTameable; 009 EntityLiving theOwnerAttacker; 010 011 public EntityAIOwnerHurtByTarget(EntityTameable par1EntityTameable) 012 { 013 super(par1EntityTameable, 32.0F, false); 014 this.theDefendingTameable = 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.theDefendingTameable.isTamed()) 024 { 025 return false; 026 } 027 else 028 { 029 EntityLiving var1 = this.theDefendingTameable.getOwner(); 030 031 if (var1 == null) 032 { 033 return false; 034 } 035 else 036 { 037 this.theOwnerAttacker = var1.getAITarget(); 038 return this.isSuitableTarget(this.theOwnerAttacker, 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.theOwnerAttacker); 049 super.startExecuting(); 050 } 051 }