3

On my private (vanilla 1.9) Minecraft server, me and my friends are trying to make custom arrows, such as TNT, ender, high explosive etc. These arrows have NBT data such as a tag "tntarrow" for a TNT arrow. However, when an arrow gets shot, it seems to 'lose' it's NBT data for some reason, so we have no way of telling normal, TNT and ender arrows apart in the air.

Is there any way of working out what kind of arrow (normal, TNT, ender etc) an arrow is while flying, so that when arrows land I can apply my own commands to activate the custom arrow's effects? I'm happy to re-purpose tipped arrows that give buffs (strength, speed, healing etc) if that is possible.

Just to clarify, if I give a player an arrow with a tag "tntarrow", like so:

/give player arrow 1 0 {Tags:["tntarrow"]}

Then, when it's shot, this selector doesn't work:

@e[type=Arrow,tag=tntarrow]

So, I would like to have some way of having only certain arrows being selected.

If it is possible to re-purpose tipped arrows, then I would also like to know how to do that. (For me to re-purpose them, I need to remove potion effects and have a way of selecting them.)

4

Adding Tags to the item will not be set as the entity's Tags data. All the item data itself will be lost except for Potion and CustomPotionEffects, which are copied to the arrow entity if existent.

Tipped arrows will be necessary, but you can apply custom effects to reduce any issues should it strike a player or mob, such as setting the duration to 0. Currently the Instant Healing effect does not function on tipped arrows, but you may need to switch to something else should it work in the future.

The amplifier would be how you'd differentiate arrows from one another.

Example arrows to provide:

/give @p minecraft:tipped_arrow 64 0 {CustomPotionEffects:[{Id:6b,Duration:0,Amplifier:0b}]}

/give @p minecraft:tipped_arrow 64 0 {CustomPotionEffects:[{Id:6b,Duration:0,Amplifier:1b}]}

Then you'd label those arrows based on the effects it has, with the amplifier making each one unique:

/scoreboard players tag @e[type=Arrow,tag=!tntarrow] add tntarrow {CustomPotionEffects:[{Id:6b,Duration:0,Amplifier:0b}]}

/scoreboard players tag @e[type=Arrow,tag=!custom2] add custom2 {CustomPotionEffects:[{Id:6b,Duration:0,Amplifier:1b}]}

And finally, target based on that label:

/say @e[type=Arrow,tag=tntarrow] is a "tntarrow".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.