mojira.dev
MCPE-165001

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

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

[media]

Attachments

Comments 2

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Is this still an issue in the latest version? If yes, could you please attach an example addon with which the issue can be observed?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki

Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

DeathSinger4221

(Unassigned)

Unconfirmed

Multiple

GameTest, getComponent(), scripting-api, scripts

1.19.50

Retrieved