How do I summon an item that has an owner and a pickup delay of -1?
I am trying to make an item that has no pickup delay, and also a different item that has an owner. The commands I have tried are:
/summon item ~ ~-1 ~ {Item:{id:"minecraft:stone",Count:1b},PickupDelay:-1}
and
/summon item ~ ~-1 ~ {Item:{id:"minecraft:stone",Count:1b},Owner:playerx}
Is there a different format for the nbt tags for owner and pickup delay?
Owner
is not a TAG_String
, it is a TAG_Int_Array
that represents the entity’s UUID. Therefore, you can’t just type a player name. You’ll have to get the UUID values from the player you want and copy them to the item entity.
Use a command chain to run the following:
-
Summon an item. The 0s are placeholders for where we will use commands to fill in the real UUID.
/summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:stone",Count:1b},Owner:[I;0,0,0,0],Tags:["itemToModify"]}
-
Replace the first UUID value with the one from the player.
/data modify entity @e[tag=itemToModify,limit=1] Owner[0] set from entity playerx UUID[0]
-
Replace the second UUID value with the one from the player.
/data modify entity @e[tag=itemToModify,limit=1] Owner[1] set from entity playerx UUID[1]
-
Replace the third UUID value with the one from the player.
/data modify entity @e[tag=itemToModify,limit=1] Owner[2] set from entity playerx UUID[2]
-
Replace the fourth UUID value with the one from the player.
/data modify entity @e[tag=itemToModify,limit=1] Owner[3] set from entity playerx UUID[3]
-
Remove the tag.
/tag @e[tag=itemToModify,limit=1] remove itemToModify
I haven’t tested this yet. If you spot something wrong about this solution or it doesn’t work, let me know in the comments below.