You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			57 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Java
		
	
			
		
		
	
	
			57 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Java
		
	
package net.minecraft.entity.ai;
 | 
						|
 | 
						|
import java.util.Iterator;
 | 
						|
import java.util.List;
 | 
						|
import net.minecraft.entity.EntityCreature;
 | 
						|
import net.minecraft.util.AxisAlignedBB;
 | 
						|
 | 
						|
public class EntityAIHurtByTarget extends EntityAITarget
 | 
						|
{
 | 
						|
    boolean entityCallsForHelp;
 | 
						|
    private int field_142052_b;
 | 
						|
    private static final String __OBFID = "CL_00001619";
 | 
						|
 | 
						|
    public EntityAIHurtByTarget(EntityCreature p_i1660_1_, boolean p_i1660_2_)
 | 
						|
    {
 | 
						|
        super(p_i1660_1_, false);
 | 
						|
        this.entityCallsForHelp = p_i1660_2_;
 | 
						|
        this.setMutexBits(1);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Returns whether the EntityAIBase should begin execution.
 | 
						|
     */
 | 
						|
    public boolean shouldExecute()
 | 
						|
    {
 | 
						|
        int i = this.taskOwner.func_142015_aE();
 | 
						|
        return i != this.field_142052_b && this.isSuitableTarget(this.taskOwner.getAITarget(), false);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Execute a one shot task or start executing a continuous task
 | 
						|
     */
 | 
						|
    public void startExecuting()
 | 
						|
    {
 | 
						|
        this.taskOwner.setAttackTarget(this.taskOwner.getAITarget());
 | 
						|
        this.field_142052_b = this.taskOwner.func_142015_aE();
 | 
						|
 | 
						|
        if (this.entityCallsForHelp)
 | 
						|
        {
 | 
						|
            double d0 = this.getTargetDistance();
 | 
						|
            List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getBoundingBox(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
 | 
						|
            Iterator iterator = list.iterator();
 | 
						|
 | 
						|
            while (iterator.hasNext())
 | 
						|
            {
 | 
						|
                EntityCreature entitycreature = (EntityCreature)iterator.next();
 | 
						|
 | 
						|
                if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
 | 
						|
                {
 | 
						|
                    entitycreature.setAttackTarget(this.taskOwner.getAITarget());
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        super.startExecuting();
 | 
						|
    }
 | 
						|
} |