mojira.dev
MC-277345

Container blocks from items with both container and container_loot components lose items from container component when serialized

There are two components that can specify the items contained in a container block: container and container_loot. The container component can specify item ID, and the container_loot component can specify a loot table ID.

The problem here is when both container and container_loot are used.

/give @s chest[container=[{slot:0,item:{id:stone}}],container_loot={loot_table:"blocks/dirt"}]

When you place this chest and open it, the items specified in both container(stone) and container_loot(dirt) appear as expected.

However, if you place the same chest item again, leave the game, join back in, and then open the chest, you will see that the items from the container(stone) component are now gone and only the items from the container_loot(dirt) are present. This is abnormal behavior.

Comments 2

It's worth noting that providing a loot table on a placed container with /data has always wiped the current items contained since loot tables' addition.

Triton365

(Unassigned)

Community Consensus

Platform

Normal

Commands, Data Packs, Loot tables

1.21.1, 1.21.3, 1.21.4, 25w04a, 1.21.8

Retrieved