1

So i'm making this world with lots of commands and when a trident hits the ground, it makes a cow named bob spawn. and when an arrow hits the ground, it gives a diamond. two is not enough for my next idea so i was wondering if it's possible to make it so that it only works if the trident that's named touches the ground. So like, let's say there is a trident. when it hits the ground it spawns a cow named bob. well im wanting a trident that is called trident2 to give you a netherite ingot. I want it to be this command:

/execute at @e[type=trident,nbt={inGround:1b}] run give @p netherite_ingot

but instead the trident is called trident2. is this possible?

1 Answer 1

1

If you want to target and entity with a specific nbt, have that entity somewhere and run

/data get entity <your entity>

And look where the info is hidden. With the trident, we can see the name is stored in

Trident.tag.display.Name

And so, the nbt structure we want is

nbt={Trident:{tag:{display:{Name:'{"text":"trident2"}'}}}}

Thus, our final command will look like this:

/execute at @e[type=trident,nbt={inGround:1b,Trident:{tag:{display:{Name:'{"text":"trident2"}'}}}}] run give @p netherite_ingot
/execute as @e[type=trident,nbt={inGround:1b,Trident:{tag:{display:{Name:'{"text":"trident2"}'}}}}] run kill @s
2
  • is there a way to kill the trident when it is in the ground? Nov 7, 2021 at 15:53
  • Yes, added to the answer. All you had to do is exexute as instead of at and change what is after run to kill @s
    – BunnyMerz
    Nov 7, 2021 at 20:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .