bedrock-kit
    Preparing search index...

    Class Block

    Represents a block definition file from the behavior pack's blocks/ directory.

    Access via addon.blocks.get(id).

    const ore = addon.blocks.get("mypack:copper_ore");
    console.log(ore?.displayName); // "Copper Ore"
    console.log(ore?.texture?.id); // "textures/blocks/copper_ore"
    console.log(ore?.lootTable?.itemIds); // ["minecraft:raw_copper"]

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • id: string
      • filePath: string
      • data: Record<string, unknown>
      • rawText: string
      • addon: AddOn

      Returns Block

    Properties

    data: Record<string, unknown>

    The raw parsed JSON data of the asset file.

    docstrings: CommentBlock[]

    All JSDoc-style comment blocks parsed from this asset's source file, in document order. Empty array when no /** … */ blocks are present.

    filePath: string

    Absolute path to the asset's file on disk. Empty string in browser mode.

    id: string

    The namespaced block identifier, e.g. "minecraft:dirt".

    Accessors

    • get displayName(): string

      The display name for this block from the en_US language file. Tries the tile.* key first (legacy), then block.*. Falls back to the identifier.

      Returns string

    • get texture(): Texture

      The resolved texture for the default (*) face of this block, or undefined if it cannot be resolved from terrain_texture.json or the texture file is not present in the addon.

      Returns Texture