    001    package net.minecraft.entity.ai;
    002
    003    import net.minecraft.entity.EntityLiving;
    004
    005    public class EntityAISwimming extends EntityAIBase
    006    {
    007        private EntityLiving theEntity;
    008
    009        public EntityAISwimming(EntityLiving par1EntityLiving)
    010        {
    011            this.theEntity = par1EntityLiving;
    012            this.setMutexBits(4);
    013            par1EntityLiving.getNavigator().setCanSwim(true);
    014        }
    015
    016        /**
    017         * Returns whether the EntityAIBase should begin execution.
    018         */
    019        public boolean shouldExecute()
    020        {
    021            return this.theEntity.isInWater() || this.theEntity.handleLavaMovement();
    022        }
    023
    024        /**
    025         * Updates the task
    026         */
    027        public void updateTask()
    028        {
    029            if (this.theEntity.getRNG().nextFloat() < 0.8F)
    030            {
    031                this.theEntity.getJumpHelper().setJumping();
    032            }
    033        }
    034    }