Script API - v1.21.120.21
    Preparing search index...

    Class EntityNavigationGenericComponent

    Allows this entity to generate paths by walking, swimming, flying and/or climbing around and jumping up and down a block.

    import { world, system } from "@minecraft/server";

    // This example demonstrates how to work with EntityNavigationGenericComponent
    // This component controls basic navigation behavior for most entities

    system.run(() => {
    const overworld = world.getDimension("overworld");

    // Spawn a dolphin (which uses generic navigation)
    const dolphin = overworld.spawnEntity("minecraft:dolphin", { x: 0, y: 64, z: 0 });

    // Get the navigation.generic component
    const navigationGeneric = dolphin.getComponent("minecraft:navigation.generic");

    if (navigationGeneric) {
    console.log("=== Dolphin Navigation Properties ===");

    // Check various navigation capabilities
    console.log(`Can float: ${navigationGeneric.canFloat}`);
    console.log(`Can swim: ${navigationGeneric.canSwim}`);
    console.log(`Can jump: ${navigationGeneric.canJump}`);
    console.log(`Can walk: ${navigationGeneric.canWalk}`);
    console.log(`Can path from air: ${navigationGeneric.canPathFromAir}`);
    console.log(`Can path over water: ${navigationGeneric.canPathOverWater}`);
    console.log(`Can path over lava: ${navigationGeneric.canPathOverLava}`);

    // Check avoidance behaviors
    console.log(`Avoids water: ${navigationGeneric.avoidWater}`);
    console.log(`Avoids sun: ${navigationGeneric.avoidSun}`);
    console.log(`Avoids damage blocks: ${navigationGeneric.avoidDamageBlocks}`);
    console.log(`Avoids portals: ${navigationGeneric.avoidPortals}`);

    // Check interaction capabilities
    console.log(`Can open doors: ${navigationGeneric.canOpenDoors}`);
    console.log(`Can break doors: ${navigationGeneric.canBreakDoors}`);
    console.log(`Can pass doors: ${navigationGeneric.canPassDoors}`);

    // Check special abilities
    console.log(`Is amphibious: ${navigationGeneric.isAmphibious}`);
    console.log(`Can breach (jump out of water): ${navigationGeneric.canBreach}`);
    console.log(`Can sink: ${navigationGeneric.canSink}`);
    console.log(`Can walk in lava: ${navigationGeneric.canWalkInLava}`);

    console.log(`Component is valid: ${navigationGeneric.isValid}`);

    // Send a summary message to the world
    world.sendMessage(`Dolphin spawned with generic navigation! Check console for details.`);
    } else {
    console.log("Failed to get navigation.generic component from dolphin");
    world.sendMessage("Could not access dolphin navigation component");
    }
    });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    avoidDamageBlocks: boolean

    Tells the pathfinder to avoid blocks that cause damage when finding a path.

    This property can throw when used.

    This property can't be read in early-execution mode.

    avoidPortals: boolean

    Tells the pathfinder to avoid portals (like nether portals) when finding a path.

    This property can throw when used.

    This property can't be read in early-execution mode.

    avoidSun: boolean

    Whether or not the pathfinder should avoid tiles that are exposed to the sun when creating paths.

    This property can throw when used.

    This property can't be read in early-execution mode.

    avoidWater: boolean

    Tells the pathfinder to avoid water when creating a path.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canBreach: boolean

    Tells the pathfinder whether or not it can jump out of water (like a dolphin).

    This property can throw when used.

    This property can't be read in early-execution mode.

    canBreakDoors: boolean

    Tells the pathfinder that it can path through a closed door and break it.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canFloat: boolean

    Tells the pathfinder whether or not it can float.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canJump: boolean

    Tells the pathfinder whether or not it can jump up blocks.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canOpenDoors: boolean

    Tells the pathfinder that it can path through a closed door assuming the AI will open the door.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canOpenIronDoors: boolean

    Tells the pathfinder that it can path through a closed iron door assuming the AI will open the door.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canPassDoors: boolean

    Whether a path can be created through a door.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canPathFromAir: boolean

    Tells the pathfinder that it can start pathing when in the air.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canPathOverLava: boolean

    Tells the pathfinder whether or not it can travel on the surface of the lava.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canPathOverWater: boolean

    Tells the pathfinder whether or not it can travel on the surface of the water.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canSink: boolean

    Tells the pathfinder whether or not it will be pulled down by gravity while in water.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canSwim: boolean

    Tells the pathfinder whether or not it can path anywhere through water and plays swimming animation along that path.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canWalk: boolean

    Tells the pathfinder whether or not it can walk on the ground outside water.

    This property can throw when used.

    This property can't be read in early-execution mode.

    canWalkInLava: boolean

    Tells the pathfinder whether or not it can travel in lava like walking on ground.

    This property can throw when used.

    This property can't be read in early-execution mode.

    entity: Entity

    The entity that owns this component. The entity will be undefined if it has been removed.

    This property can throw when used.

    InvalidEntityError

    This property can't be read in early-execution mode.

    isAmphibious: boolean

    Tells the pathfinder whether or not it can walk on the ground or go underwater.

    This property can throw when used.

    This property can't be read in early-execution mode.

    isValid: boolean

    Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.

    This property can't be read in early-execution mode.

    typeId: string

    Identifier of the component.

    This property can't be read in early-execution mode.

    componentId: "minecraft:navigation.generic" = 'minecraft:navigation.generic'