package common.ai;

import common.entity.types.EntityLiving;
import common.pathfinding.PathNavigateGround;

public class EntityAISwimming extends EntityAIBase
{
    private EntityLiving theEntity;

    public EntityAISwimming(EntityLiving entitylivingIn)
    {
        this.theEntity = entitylivingIn;
        this.setMutexBits(4);
        ((PathNavigateGround)entitylivingIn.getNavigator()).setCanSwim(true);
    }

    /**
     * Returns whether the EntityAIBase should begin execution.
     */
    public boolean shouldExecute()
    {
        return this.theEntity.isInLiquid() || this.theEntity.isInMolten();
    }

    /**
     * Updates the task
     */
    public void updateTask()
    {
        if (this.theEntity.getRNG().floatv() < 0.8F)
        {
            this.theEntity.getJumpHelper().setJumping();
        }
    }
}
