bedrock-kit
    Preparing search index...

    Class Item

    Represents an item definition file from the behavior pack's items/ directory.

    Access via addon.items.get(id).

    const spear = addon.items.get("minecraft:copper_spear");
    console.log(spear?.displayName); // "Copper Spear"
    console.log(spear?.texture?.id); // "textures/items/copper_spear"
    console.log(spear?.recipes.length); // 1

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

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

      Returns Item

    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 item identifier, e.g. "minecraft:copper_spear".

    Accessors

    • get attachable(): Attachable

      The attachable definition for this item, or undefined if none exists. Attachables define how the item looks when held or equipped.

      Returns Attachable

    • get displayName(): string

      The display name for this item from the en_US language file. Falls back to the standard lang key "item.namespace:name.name" via the lang file, which itself falls back to the identifier if the key is missing.

      Returns string

    • get droppedByBlocks(): Block[]

      All blocks that drop this item via their loot table.

      Returns Block[]

    • get entities(): Entity[]

      All unified entities that can drop this item via their loot tables.

      Returns Entity[]

    • get texture(): Texture

      The resolved display texture for this item, or undefined if it cannot be resolved from the resource pack's item_texture.json or the texture file is not present in the addon.

      Returns Texture