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

    Class EntityRideableComponent

    When added, this component adds the capability that an entity can be ridden by another entity.

    import { EntityComponentTypes } from "@minecraft/server";
    import { Test, register } from "@minecraft/server-gametest";
    import { MinecraftBlockTypes, MinecraftEntityTypes } from "@minecraft/vanilla-data";

    function minibiomes(test: Test) {
    const minecart = test.spawn(MinecraftEntityTypes.Minecart, { x: 9, y: 7, z: 7 });
    const pig = test.spawn(MinecraftEntityTypes.Pig, { x: 9, y: 7, z: 7 });

    test.setBlockType(MinecraftBlockTypes.Cobblestone, { x: 10, y: 7, z: 7 });

    const minecartRideableComp = minecart.getComponent(EntityComponentTypes.Rideable);

    minecartRideableComp?.addRider(pig);

    test.succeedWhenEntityPresent(MinecraftEntityTypes.Pig, { x: 8, y: 3, z: 1 }, true);
    }
    register("ChallengeTests", "minibiomes", minibiomes).structureName("gametests:minibiomes").maxTicks(160);
    import { world } from "@minecraft/server";

    const boat = world.getDimension("overworld").spawnEntity("minecraft:boat", { x: 0, y: 5, z: 0 });
    const riderEntity = world.getAllPlayers()[0]; // Assuming you have an 'riderEntity' instance
    const rideable = boat.getComponent("rideable");
    rideable.controllingSeat;
    rideable.crouchingSkipInteract;
    rideable.interactText;
    rideable.pullInEntities;
    rideable.riderCanInteract;
    rideable.seatCount;
    rideable.addRider(riderEntity);
    rideable.ejectRider(riderEntity);
    rideable.ejectRiders();
    rideable.getFamilyTypes();
    rideable.getRiders();
    rideable.getSeats();
    rideable.isValid;

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    controllingSeat: number

    Zero-based index of the seat that can used to control this entity.

    This property can throw when used.

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

    crouchingSkipInteract: boolean

    Determines whether interactions are not supported if the entity is crouching.

    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.

    interactText: string

    Set of text that should be displayed when a player is looking to ride on this entity (commonly with touch-screen controls).

    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.

    passengerMaxWidth: number

    The max width a mob can be to be a passenger.

    This property can throw when used.

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

    pullInEntities: boolean

    If true, this entity will pull in entities that are in the correct family_types into any available seat.

    This property can throw when used.

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

    riderCanInteract: boolean

    If true, this entity will be picked when looked at by the rider.

    This property can throw when used.

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

    seatCount: number

    Number of seats for riders defined for this entity.

    This property can throw when used.

    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:rideable" = 'minecraft:rideable'

    Methods

    • Parameters

      • rider: Entity

        Entity that will become the rider of this entity.

      Returns boolean

      True if the rider entity was successfully added.

      Adds an entity to this entity as a rider.

      This function can't be called in read-only mode.

      This function can throw errors.

      import { EntityComponentTypes } from "@minecraft/server";
      import { Test, register } from "@minecraft/server-gametest";
      import { MinecraftBlockTypes, MinecraftEntityTypes } from "@minecraft/vanilla-data";

      function minibiomes(test: Test) {
      const minecart = test.spawn(MinecraftEntityTypes.Minecart, { x: 9, y: 7, z: 7 });
      const pig = test.spawn(MinecraftEntityTypes.Pig, { x: 9, y: 7, z: 7 });

      test.setBlockType(MinecraftBlockTypes.Cobblestone, { x: 10, y: 7, z: 7 });

      const minecartRideableComp = minecart.getComponent(EntityComponentTypes.Rideable);

      minecartRideableComp?.addRider(pig);

      test.succeedWhenEntityPresent(MinecraftEntityTypes.Pig, { x: 8, y: 3, z: 1 }, true);
      }
      register("ChallengeTests", "minibiomes", minibiomes).structureName("gametests:minibiomes").maxTicks(160);

      This function can't be called in early-execution mode.

    • Parameters

      • rider: Entity

        Entity that should be ejected from this entity.

      Returns void

      Ejects the specified rider of this entity.

      This function can't be called in read-only mode.

      This function can throw errors.

      This function can't be called in early-execution mode.

    • Returns void

      Ejects all riders of this entity.

      This function can't be called in read-only mode.

      This function can throw errors.

      This function can't be called in early-execution mode.

    • Returns string[]

      A string-list of entity types that this entity can support as riders.

      This function can throw errors.

      This function can't be called in early-execution mode.

    • Returns Entity[]

      Gets a list of the all the entities currently riding this entity.

      This function can throw errors.

      This function can't be called in early-execution mode.

    • Returns Seat[]

      Gets a list of positions and number of riders for each position for entities riding this entity.

      This function can throw errors.

      This function can't be called in early-execution mode.