Minecraft Java Edition – Why Special Loot Table Can Only Be Received Using /give and Not /summon

minecraft-commandsminecraft-java-edition

I tried the custom loot tables here:

(with his website: http://minecraft.tools/en/loots.php ). I successfully obtained my chest with the custom loot using:

/give @p minecraft:chest 1 0
{BlockEntityTag:{LootTable:"mctools:chests/loot_table"}}

The problem is that I want to summon the chest instead of giving it to the player. I tried the command:

/setblock ~1 ~ ~ chest 0 replace
{BlockEntityTag:{LootTable:"mctools:chests/loot_table"}}

The chest did place, but when I opened it, the chest was always empty. Why can't I retrieve my loot this way? And if possible, how can this be done?

Best Answer

The BlockEntityTag is the data that will be given to the block when the item is placed. Since you're setting the block directly, you can just use

/setblock ~1 ~ ~ chest 0 replace {LootTable:"mctools:chests/loot_table"}