Class Dimension

A class that represents a particular dimension (e.g., The End) within a world.

Hierarchy

  • Dimension

Constructors

Properties

id: string

Remarks

Identifier of the dimension.

Throws

This property can throw when used.

Methods

  • Parameters

    • location: Vector3

      The location at which to return a block.

    Returns undefined | Block

    Block at the specified location.

    Remarks

    Returns a block instance at the given location.

    Throws

    This function can throw errors.

  • Parameters

    • Optional options: EntityQueryOptions

      Additional options that can be used to filter the set of entities returned.

    Returns Entity[]

    An entity array.

    Remarks

    Returns a set of entities based on a set of conditions defined via the EntityQueryOptions set of filter criteria.

    Throws

    This function can throw errors.

    Example

    testThatEntityIsFeatherItem.ts

    const query = {
    type: "item",
    location: targetLocation,
    };
    const items = overworld.getEntities(query);

    for (const item of items) {
    const itemComp = item.getComponent("item") as any;

    if (itemComp) {
    if (itemComp.itemStack.id.endsWith("feather")) {
    console.log("Success! Found a feather", 1);
    }
    }
    }
  • Parameters

    • location: Vector3

      The location at which to return entities.

    Returns Entity[]

    Zero or more entities at the specified location.

    Remarks

    Returns a set of entities at a particular location.

  • Parameters

    • Optional options: EntityQueryOptions

      Additional options that can be used to filter the set of players returned.

    Returns Player[]

    A player array.

    Remarks

    Returns a set of players based on a set of conditions defined via the EntityQueryOptions set of filter criteria.

    Throws

    This function can throw errors.

  • Parameters

    • commandString: string

    Returns CommandResult

    Remarks

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

    Throws

    This function can throw errors.

  • Parameters

    • commandString: string

      Command to run. Note that command strings should not start with slash.

    Returns Promise<CommandResult>

    For commands that return data, returns a CommandResult with an indicator of command results.

    Remarks

    Runs a particular command asynchronously from the context of the broader dimension. Note that there is a maximum queue of 128 asynchronous commands that can be run in a given tick.

    Throws

    This function can throw errors.