Block loot tables cannot be removed with /data remove
Reproduction
1. place/find a block that has a loot table attached
example command:
/setblock ~1 ~ ~ minecraft:chest[facing=north,type=single,waterlogged=false]{LootTable:"minecraft:chests/underwater_ruin_small",LootTableSeed:1254937183670699988L}
2. run get command
/data get block ~1 ~ ~
3. observe that block has LootTable tag, that we want to remove
4. run command to remove LootTable from block
/data remove block ~1 ~ ~ LootTable
5. see that output says the block was modified
6. run get command again to see the changes
7. see that LootTable is still present!
Code Analysis + Potential fix
mojmap, 1.21.4
In
net.minecraft.world.RandomizableContainer#tryLoadLootTable
// after data modify/remove alters the tag, it is reloaded by the block entity default boolean tryLoadLootTable(CompoundTag tag) { // since the new tag removed it, this is false if (tag.contains("LootTable", 8)) { ... } else { // causing the handler to return without updating // the block entities internal state of the loot table // the below is an example fix // setLootTable(null); return false; } }
2025-01-08, 04:25 AM
2025-01-21, 09:12 AM
2
3
-