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

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

    Index

    Constructors

    Properties

    events: Events

    Contains a set of events that are applicable to the entirety of the world.

    scoreboard: Scoreboard

    Returns the general global scoreboard that applies to the world.

    Methods

    • Beta

      Parameters

      • id: string
      • value: string

      Returns void

      A method that is internal-only, used for broadcasting specific messages between client and server.

    • Beta

      Returns number

      Returns the absolute time since the start of the world.

    • Returns Player[]

      Returns an array of all active players within the world.

      This function can throw errors.

    • Parameters

      • dimensionId: string

      Returns Dimension

      The requested dimension

      Returns a dimension object.

      Throws if the given dimension name is invalid

    • Beta

      Parameters

      • identifier: string

      Returns undefined | string | number | boolean

      Returns the value for the property, or undefined if the property has not been set.

      Returns a property value.

      This function can throw errors.

    • Beta

      Parameters

      • Optionaloptions: EntityQueryOptions

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

      Returns PlayerIterator

      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 throw errors.

    • Beta

      Returns number

      Sets the current game time of the day.

    • Beta

      Parameters

      Returns void

      Plays a particular music track for all players.

    • Beta

      Parameters

      Returns void

      Plays a sound for all players.

    • Beta

      Parameters

      Returns void

      Queues an additional music track for players. If a track is not playing, a music track will play.

    • Beta

      Parameters

      • identifier: string

      Returns boolean

      Removes a specified property.

      This function can throw errors.

    • Beta

      Parameters

      Returns void

      Sends a message to all players.

      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);
    • Parameters

      Returns void

    • Beta

      Parameters

      • identifier: string
      • value: string | number | boolean

        Data value of the property to set.

      Returns void

      Sets a specified property to a value.

      This function can throw errors.

    • Beta

      Parameters

      • timeOfDay: number

      Returns void

      Returns the current game time of the day.

    • Beta

      Returns void

      Stops any music tracks from playing.