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

    Class EntityNavigationHoverComponent

    Allows this entity to generate paths in the air (for example, like the Minecraft Bees do.) Keeps them from falling out of the skies and doing predictive movement.

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

    // This example demonstrates how to work with EntityNavigationHoverComponent
    // This component is used by entities that can hover/fly like bees and ghasts

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

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

    // Get the navigation.hover component
    const navigationHover = bee.getComponent("minecraft:navigation.hover");

    if (navigationHover) {
    console.log("=== Bee Hover Navigation Properties ===");

    // Check flight and hovering capabilities
    console.log(`Can path from air: ${navigationHover.canPathFromAir}`);
    console.log(`Can float: ${navigationHover.canFloat}`);
    console.log(`Can jump: ${navigationHover.canJump}`);
    console.log(`Can swim: ${navigationHover.canSwim}`);
    console.log(`Can walk: ${navigationHover.canWalk}`);

    // Check pathfinding over different surfaces
    console.log(`Can path over water: ${navigationHover.canPathOverWater}`);
    console.log(`Can path over lava: ${navigationHover.canPathOverLava}`);

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

    // Check door interaction (usually false for flying entities)
    console.log(`Can open doors: ${navigationHover.canOpenDoors}`);
    console.log(`Can break doors: ${navigationHover.canBreakDoors}`);
    console.log(`Can pass doors: ${navigationHover.canPassDoors}`);
    console.log(`Can open iron doors: ${navigationHover.canOpenIronDoors}`);

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

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

    // Send a summary message to the world
    world.sendMessage(`Bee spawned with hover navigation! It can fly around freely.`);

    // Fun fact: Display what makes hover navigation special
    if (navigationHover.canPathFromAir) {
    console.log("🐝 This bee can navigate through the air without needing solid ground!");
    }
    } else {
    console.log("Failed to get navigation.hover component from bee");
    world.sendMessage("Could not access bee hover 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.hover" = 'minecraft:navigation.hover'