setblock and data keep a container's loot table

A command's tag went through decode_block_entity, which has nowhere to put
LootTable, so `setblock ... chest{LootTable:...}` made an empty chest
(`data get` showed `Items: []`). An empty container given a LootTable is
now rolled as a loaded chunk's are, and the roll is kept with its chunk
(RolledLoot), so it saves, and `data get` shows, LootTable and
LootTableSeed until its items change (tryLoadLootTable / trySaveLootTable).
`data merge` and `data modify` go through the same path.

command_exec: setblock a seeded loot chest, then data get it whole and its
LootTableSeed (870/870 match the 26.3 oracle).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-26 18:02:34 +01:00
parent a42857ab48
commit fbbed63f04
3 changed files with 85 additions and 3 deletions
+6
View File
@@ -241,6 +241,12 @@ def world_blocks():
cmd('/clone 0 205 0 4 207 4 6 205 6 masked'),
cmd('/execute if blocks 0 205 0 4 207 4 6 205 6 all'),
cmd('/setblock 3 206 3 minecraft:air'),
# A container keeps its loot table and seed until its items change
# (RandomizableContainer.tryLoadLootTable / trySaveLootTable).
cmd('/setblock 7 206 7 minecraft:chest{LootTable:"minecraft:chests/simple_dungeon",LootTableSeed:42L}'),
cmd('/data get block 7 206 7'),
cmd('/data get block 7 206 7 LootTableSeed'),
cmd('/setblock 7 206 7 minecraft:air'),
# A hopper placed into power turns `enabled=false` and keeps its block entity.
cmd('/setblock 5 205 5 minecraft:redstone_block'),
cmd('/setblock 5 206 5 minecraft:hopper'),