Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts
    Plugin API

    @minecraft/server

    @minecraft/server as Basalt provides it: the part of Mojang's Script API (2.x) that Basalt binds, with Mojang's names and shapes, plus a few Basalt additions marked as such.

    @minecraft/server as Basalt provides it: the part of Mojang’s Script API (2.x) that Basalt binds, with Mojang’s names and shapes, plus a few Basalt additions marked as such.

    Reads such as Player.location or Dimension.getBlock ask the server and wait for its answer. In a before event or command the server itself waits on, a read the waiting thread would have to answer can’t be waited for: the world can’t be read in block and mob before events, and a player is read as the plugin last saw them in player before events and commands (a first read there throws). Read in system.run instead when that matters.

    import { world } from '@minecraft/server';
    const EnchantmentTypes: {
    get(enchantmentId: string): EnchantmentType | undefined;
    getAll(): EnchantmentType[];
    };

    Every enchantment the server knows.

    const TicksPerSecond = 20;

    Ticks in a second.

    const TicksPerDay = 24000;

    Ticks in a Minecraft day.

    const EffectTypes: {
    /** The effect type for a name, or undefined for an empty one. */
    get(name: string): EffectType | undefined;
    /** PARITY-RISK: Basalt keeps no enumerable effect registry; returns nothing. */
    getAll(): EffectType[];
    };

    The effect registry.

    const EntityTypes: {
    get(name: string): EntityType | undefined;
    getAll(): EntityType[];
    };

    The entity-type registry.

    const ItemTypes: {
    get(name: string): ItemType | undefined;
    getAll(): ItemType[];
    };

    The item-type registry.

    const BlockTypes: {
    get(name: string): BlockType | undefined;
    getAll(): BlockType[];
    };

    The block-type registry.

    const MinecraftDimensionTypes: {
    readonly overworld: "minecraft:overworld";
    readonly nether: "minecraft:nether";
    readonly theEnd: "minecraft:the_end";
    readonly Overworld: "minecraft:overworld";
    readonly Nether: "minecraft:nether";
    readonly TheEnd: "minecraft:the_end";
    };

    The dimension ids, as the legacy @minecraft/server exposed them.

    const world: World;
    Types
    const system: System;
    Types
    const server: Server;

    Basalt’s own.

    Types
    const HudElementsCount = 13;
    const HudVisibilityCount = 2;
    const MoonPhaseCount = 8;