Script API - v1.26.10.23
    Preparing search index...
    Index

    Constructors

    • Parameters

      • itemType: string | ItemType
      • Optionalamount: number

      Returns ItemStack

      This function can't be called in read-only mode.

      This function can throw errors.

    Properties

    amount: number

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    isStackable: boolean
    keepOnDeath: boolean

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    localizationKey: string

    This property can throw errors.

    minecraftcommon.EngineError

    This property can't be read in early-execution mode.

    lockMode: ItemLockMode

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    maxAmount: number
    nameTag?: string

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    type: ItemType
    typeId: string
    weight: number

    Methods

    • Returns void

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Returns string[]

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Returns string[]

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Type Parameters

      • T extends string

      Parameters

      • componentId: T

      Returns ItemComponentReturnType<T>

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

      import { world } from "@minecraft/server";

      const player = world.getPlayers()[0];
      const inventory = player.getComponent("inventory");
      const slot = inventory.container.getSlot(player.selectedSlotIndex);
      let durabilityComp = slot.getItem().getComponent("durability");
      player.sendMessage(
      "Item Durability: " + (durabilityComp.maxDurability - durabilityComp.damage) + "/" + durabilityComp.maxDurability
      );
    • Parameters

      • identifier: string

      Returns string | number | boolean | Vector3

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Returns string[]

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Returns number

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Returns string[]

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Returns string[]

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Parameters

      • componentId: string

      Returns boolean

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Parameters

      • tag: string

      Returns boolean

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

    • Parameters

      • itemName: string
      • Optionalstates: Record<string, string | number | boolean>

      Returns boolean

      This function can't be called in read-only mode.

      This function can't be called in early-execution mode.

      import { ItemStack, world } from "@minecraft/server";

      const item1 = new ItemStack("minecraft:iron_sword", 1);
      item1.matches("minecraft:iron_sword");
      import { ItemStack, world } from "@minecraft/server";

      const item1 = new ItemStack("minecraft:acacia_trapdoor", 1);
      item1.matches("minecraft:acacia_trapdoor", {
      direction: 0,
      open_bit: true,
      upside_down_bit: false,
      });
    • Parameters

      • OptionalblockIdentifiers: string[]

      Returns void

      This function can't be called in read-only mode.

      This function can throw errors.

      This function can't be called in early-execution mode.

    • Parameters

      • OptionalblockIdentifiers: string[]

      Returns void

      This function can't be called in read-only mode.

      This function can throw errors.

      This function can't be called in early-execution mode.

    • Parameters

      • identifier: string
      • Optionalvalue: string | number | boolean | Vector3

      Returns void

      This function can't be called in read-only mode.

      This function can throw errors.

      minecraftcommon.ArgumentOutOfBoundsError

      minecraftcommon.UnsupportedFunctionalityError

      This function can't be called in early-execution mode.