TransWikia.com

How do I summon an item that has an owner and a pickup delay of -1?

Arqade Asked by Samuel Joseph on July 23, 2020

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?

One Answer

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:

  1. 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"]}
    
  2. 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]
    
  3. 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]
    
  4. 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]
    
  5. 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]
    
  6. 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.

Answered by ExpertCoder14 on July 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP