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

Example

ridePlayerOnBoat.js

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

Constructors

Properties

controllingSeat: number

Remarks

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

Throws

This property can throw when used.

crouchingSkipInteract: boolean

Remarks

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

Throws

This property can throw when used.

entity: Entity

Remarks

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

interactText: string

Remarks

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

Throws

This property can throw when used.

passengerMaxWidth: number

Remarks

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

Throws

This property can throw when used.

pullInEntities: boolean

Remarks

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

Throws

This property can throw when used.

riderCanInteract: boolean

Remarks

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

Throws

This property can throw when used.

seatCount: number

Remarks

Number of seats for riders defined for this entity.

Throws

This property can throw when used.

typeId: string

Remarks

Identifier of the component.

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.

    Remarks

    Adds an entity to this entity as a rider.

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

    Throws

    This function can throw errors.

  • Parameters

    • rider: Entity

      Entity that should be ejected from this entity.

    Returns void

    Remarks

    Ejects the specified rider of this entity.

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

    Throws

    This function can throw errors.

  • Returns void

    Remarks

    Ejects all riders of this entity.

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

    Throws

    This function can throw errors.

  • Returns string[]

    Remarks

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

    Throws

    This function can throw errors.

  • Returns Entity[]

    Remarks

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

    Throws

    This function can throw errors.

  • Returns Seat[]

    Remarks

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

    Throws

    This function can throw errors.

  • Returns boolean

    Whether the component is valid.

    Remarks

    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.