Is there a way to target the arrow from an OP bow via command block?
Solution 1:
Target selectors do not support direct NBT data input. You must assign a label to the target using /scoreboard
first, and then target the entity based on its label.
Prerequisites:
Objective to hold the value.
/scoreboard objectives add SpecialArrow dummy
Clock commands:
The following must be run in numerical order on a clock.
-
Assign a score based on the arrow's NBT data. Note that you must properly declare tag-types; in this case, "damage" has a tag-type of
double
, so you must include a decimal, while "inGround" has a tag-type ofbyte
, so its value is appended with a "b". The command assigns a score of 1 if the arrow has a particular damage as well as not being in the ground./scoreboard players set @e[type=Arrow] SpecialArrow 1 {damage:63.0,inGround:0b}
-
Perform the commands you'd like, targeting arrows with a
SpecialArrow
score of exactly 1./execute @e[type=Arrow,score_SpecialArrow_min=1,score_SpecialArrow=1] ~ ~ ~ summon ThrownPotion ~ ~ ~ {Potion:{id:potion,Damage:8197}}
-
Afterwards, the score is set to 2 if that particular arrow is now in the ground.
/scoreboard players set @e[type=Arrow] SpecialArrow 2 {damage:63.0,inGround:1b}
-
And finally, the /kill command, targeting based on score.
/kill @e[type=Arrow,score_SpecialArrow_min=2]