bedrock-kit
    Preparing search index...

    Class LootTable

    Represents a loot table file from the behavior pack's loot_tables/ directory.

    Access via addon.lootTables.get(relativePath), entity.lootTables, or block.lootTable.

    const table = addon.lootTables.get("loot_tables/entities/zombie.json");
    console.log(table?.itemIds); // ["minecraft:rotten_flesh", ...]
    console.log(table?.sourceEntities.map(e => e.id));

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

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

      Returns LootTable

    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 relative path from the behavior pack root, used as the unique key. e.g. "loot_tables/entities/zombie.json".

    Accessors

    • get itemIds(): string[]

      A flat, deduplicated list of all item identifiers that can drop from this loot table.

      Returns string[]

    • get items(): Item[]

      All custom items (defined in this addon) that can drop from this loot table. Vanilla items are excluded since they are not loaded into the addon.

      Returns Item[]