    001package net.minecraft.entity.ai;
    002
    003import net.minecraft.entity.EntityCreature;
    004
    005public class EntityAIRestrictSun extends EntityAIBase
    006{
    007    private EntityCreature theEntity;
    008
    009    public EntityAIRestrictSun(EntityCreature par1EntityCreature)
    010    {
    011        this.theEntity = par1EntityCreature;
    012    }
    013
    014    /**
    015     * Returns whether the EntityAIBase should begin execution.
    016     */
    017    public boolean shouldExecute()
    018    {
    019        return this.theEntity.worldObj.isDaytime();
    020    }
    021
    022    /**
    023     * Execute a one shot task or start executing a continuous task
    024     */
    025    public void startExecuting()
    026    {
    027        this.theEntity.getNavigator().setAvoidSun(true);
    028    }
    029
    030    /**
    031     * Resets the task
    032     */
    033    public void resetTask()
    034    {
    035        this.theEntity.getNavigator().setAvoidSun(false);
    036    }
    037}