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

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

    Index

    Constructors

    Properties

    id: string

    Identifier of the dimension.

    This property can throw when used.

    Methods

    • Parameters

      • location: Vector3

        The location at which to return a block.

      Returns Block

      Block at the specified location.

      Returns a block instance at the given location. This method was introduced as of version 1.17.10.21.

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

      This function can throw errors.

    • Parameters

      • Optionaloptions: EntityQueryOptions

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

      Returns Entity[]

      An entity array.

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

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

      This function can throw errors.

      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.

      Returns a set of entities at a particular location.

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

    • Parameters

      • Optionaloptions: EntityQueryOptions

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

      Returns Player[]

      A player array.

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

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

      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.

      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.

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

      This function can throw errors.