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

[GameTest][Scripting]- block.getComponent('inventory') not working properly

XMLWordPrintable

    • Unconfirmed
    • Multiple

      The following GameTest function:

      block.getComponent('minecraft:inventory')

      Fails to get the Inventory component from every other block excluding chests and trapped chests. Blocks like shulker boxes, barrels, furnaces and hoppers don't work with it.

       

      The following code was used to test the bug:

      import { world } from "@minecraft/server";
      
      world.events.blockPlace.subscribe(({ block, player }) => {
          player.tell(String('§7' + block.typeId + '§r - §b' + (block.getComponent('inventory')?.container.size ?? '§cNoInventory')));
      });

       

      This is the chat output that the code sends when placing the following block types:

      • minecraft:stone (Stone is just for looks thb. Idk why I included it in to the test)
      • minecraft:chest (+Large Chest)
      • minecraft:trapped_chest (+Large Trapped Chest)
      • minecraft:barrel
      • minecraft:shulker_box

        1. Screenshot (389).png
          276 kB
          DeathSinger4221
        2. Screenshot (390).png
          29 kB
          DeathSinger4221

            UrbanMinecraft DeathSinger4221
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: