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.
		
		
		
		
		
			
		
			
				
	
	
		
			73 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
			
		
		
	
	
			73 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
package net.minecraft.entity.ai;
 | 
						|
 | 
						|
import net.minecraft.entity.monster.EntityIronGolem;
 | 
						|
import net.minecraft.entity.passive.EntityVillager;
 | 
						|
 | 
						|
public class EntityAILookAtVillager extends EntityAIBase
 | 
						|
{
 | 
						|
    private EntityIronGolem theGolem;
 | 
						|
    private EntityVillager theVillager;
 | 
						|
    private int lookTime;
 | 
						|
    private static final String __OBFID = "CL_00001602";
 | 
						|
 | 
						|
    public EntityAILookAtVillager(EntityIronGolem p_i1643_1_)
 | 
						|
    {
 | 
						|
        this.theGolem = p_i1643_1_;
 | 
						|
        this.setMutexBits(3);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Returns whether the EntityAIBase should begin execution.
 | 
						|
     */
 | 
						|
    public boolean shouldExecute()
 | 
						|
    {
 | 
						|
        if (!this.theGolem.worldObj.isDaytime())
 | 
						|
        {
 | 
						|
            return false;
 | 
						|
        }
 | 
						|
        else if (this.theGolem.getRNG().nextInt(8000) != 0)
 | 
						|
        {
 | 
						|
            return false;
 | 
						|
        }
 | 
						|
        else
 | 
						|
        {
 | 
						|
            this.theVillager = (EntityVillager)this.theGolem.worldObj.findNearestEntityWithinAABB(EntityVillager.class, this.theGolem.boundingBox.expand(6.0D, 2.0D, 6.0D), this.theGolem);
 | 
						|
            return this.theVillager != null;
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Returns whether an in-progress EntityAIBase should continue executing
 | 
						|
     */
 | 
						|
    public boolean continueExecuting()
 | 
						|
    {
 | 
						|
        return this.lookTime > 0;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Execute a one shot task or start executing a continuous task
 | 
						|
     */
 | 
						|
    public void startExecuting()
 | 
						|
    {
 | 
						|
        this.lookTime = 400;
 | 
						|
        this.theGolem.setHoldingRose(true);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Resets the task
 | 
						|
     */
 | 
						|
    public void resetTask()
 | 
						|
    {
 | 
						|
        this.theGolem.setHoldingRose(false);
 | 
						|
        this.theVillager = null;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Updates the task
 | 
						|
     */
 | 
						|
    public void updateTask()
 | 
						|
    {
 | 
						|
        this.theGolem.getLookHelper().setLookPositionWithEntity(this.theVillager, 30.0F, 30.0F);
 | 
						|
        --this.lookTime;
 | 
						|
    }
 | 
						|
} |