Custom loot table not copying nbt string to display name.
This setup outputs a blank display name ( {display:{Name:'{"text":""}'}} ) and was expecting the name to be "minecraft:pig".
Manually spawning the item works just fine.
/give @s minecraft:spawner{display:{Name:'{"text":"minecraft:pig"}'}}
File format attached:
Attachments
Comments 11
I'm not quite sure what you're trying to say. It really seems like you haven't looked at the attached file. "SpawnData.id" has the JSON output of "minecraft:pig".
I've also found a second issue to naming. This command executes successfully but not everything was applied.
[media]
It seems that the text ends after a colon.
– Correction –
This command does work:
Alright got it. This works as intended.
Explanation:
When using "entity":"this"
, the player that mined the block is used as context to evaluate the text component. Therefore, the coordinates ~ ~ ~
refer to the player's position. Therefore, if the player is standing in a block entity, you can access that information.
(As an aside, in 1.18, the path changed to SpawnData.entity.id
)
To copy NBT from the block entity that was broken, you should use copy_nbt
with "source":"block_entity"
. Check out the vanilla shulker box for how to use it. Of course, that won't allow you to wrap it in a text component, so you'll have to copy somewhere other than display.Name
and work out the rest of the details some other way. Frankly, I am not convinced this is possible as-is with a loot table alone.
As for your question about armor stands...123
is a number, and therefore is a valid JSON object. minecraft:pig
is not a valid JSON object, because it is not a number, quoted string, boolean value, object, or list.1:23
is valid until the colon, where the remainder is discarded.
⚠️ Please do not mark Unreleased Versions as affected. You don't have access to them yet.
-- I am a bot. This action was performed automatically! If you think it was incorrect, please notify us on Discord or Reddit