Skip to content

Latest commit

 

History

History
43 lines (26 loc) · 1.05 KB

File metadata and controls

43 lines (26 loc) · 1.05 KB

World

Description: https://docs.microsoft.com/en-us/minecraft/creator/scriptapi/mojang-minecraft/World

Code structure

class World {
  readonly "events": Events;

  getDimension(dimensionName: "overworld" | "nether" | "the end"): Dimension;
  
  getPlayers(options?: EntityQueryOptions): EntityIterator;
}

Credit: @types/mojang-minecraft/index.d.ts

Code examples:

Events

Subscribe to events without unsubscribing:

import { world } from "mojang-minecraft";

world.events.tick.subscribe(() => {});

Check out Events class for more infomation

getDimension

Version 1.18.10 or above

import { world } from "mojang-minecraft";

world.getDimension().runCommand("say hello");

Check out Dimension class for more infomation