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

    A class that wraps the state of a world - a set of dimensions and the environment of Minecraft.

    Index

    Constructors

    Methods

    • Returns Player[]

      Returns an array of all active players within the world.

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

      This function can throw errors.

    • Parameters

      • dimensionId: string

      Returns Dimension

      The requested dimension

      Returns a dimension object.

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

      Throws if the given dimension name is invalid

    • 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

      Returns void

      Sends a message to all players.

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

      This method can throw if the provided RawMessage is in an invalid format. For example, if an empty name string is provided to score.

      // Displays "Apple or Coal"
      let rawMessage = {
      translate: "accessibility.list.or.two",
      with: { rawtext: [{ translate: "item.apple.name" }, { translate: "item.coal.name" }] },
      };
      world.sendMessage(rawMessage);
      // Displays the player's score for objective "obj". Each player will see their own score.
      const rawMessage = { score: { name: "*", objective: "obj" } };
      world.sendMessage(rawMessage);
      // Displays "Hello, world!"
      world.sendMessage("Hello, world!");
      // Displays "First or Second"
      const rawMessage = { translate: "accessibility.list.or.two", with: ["First", "Second"] };
      world.sendMessage(rawMessage);