#How to set custom NBT data to items?

1 messages · Page 1 of 1 (latest)

subtle hill
#

Lets say I have a diamond pickaxe that I'll use for a weapon or something. I want to add {FrostPick:1b} to the pickaxe, however I get a NBT Compound error. The wiki barely says anything about setting a NBT Compound so I'm asking you for a minor assistance.

cedar sentinel
#

add nbt from "{FrostPick:1b}" to nbt of player's tool

subtle hill
#

Let's say it's in a scenario where I am giving the item.

#

give 1 diamond pickaxe with nbt {FrostPick:1b} to player

cedar sentinel
#
command /givepickaxe:
  trigger:
    set {_item} to diamond pickaxe
    add nbt from "{FrostPick:1b}" to nbt of {_item}
    give {_item} to player
subtle hill
#

Oh... Does it have to be using a variable?

cedar sentinel
#

yeah because you either add it (to something) or set it (for something)

subtle hill
#

Ah, gotcha.

#

One more thing.

#

If I was to check it, is it just
if {_item} has nbt "{FrostPick:1b}"

#

@cedar sentinel

cedar sentinel
#

maybe something like if nbt compound of {_item} has tag "{FrostPick:1b}":

cedar sentinel
subtle hill
#

Sorry- I saw you went offline.

cedar sentinel
#

even if i did go offline it would mean i have something else to do

subtle hill
#

Fair.

#

Thank you.