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