Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-154810

GameTest: Accessing ItemEnchantsComponent returns an error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • None
    • 1.18.30
    • None
    • Unconfirmed
    • Windows

      When accessing the enchantments component of an ItemStack, the enchantments are not iterable and will crash the game if Array.from() is called on it.

      ```

      const inventory = player.getComponent("inventory");

      const container = inventory.container;

      for (let i=0; i<container.size; i++)

      { const itemStack = container.getItem(i); const enchantmentComponent = itemStack.getComponent("enchantments"); const enchantments = enchantmentComponent.enchantments; // Not a function error enchantments.next(); // Crashes game Array.from(enchantments); }

      ```

            lowlines lowlines
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: