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