TransWikia.com

Test for certain amount of item in hand

Arqade Asked on July 6, 2021

Are there any commands that can test for a player holding at least 3 arrows in his main hand?

2 Answers

Well, you could give a tag to te player if they hold an arrow, and remove the tag if they hold only one or two arrows.

/scoreboard players tag @a add HoldsArrows {SelectedItem:{id:"minecraft:arrow"}}
/scoreboard players tag @a[tag=HoldsArrows] remove HoldsArrows {SelectedItem:{id:"minecraft:arrow",Count:1b}}
/scoreboard players tag @a[tag=HoldsArrows] remove HoldsArrows {SelectedItem:{id:"minecraft:arrow",Count:2b}}

Answered by Aeldrion on July 6, 2021

1.13+ Update to Aeldrion's answer

  • /scoreboard players tag has been replaced with /tag.

1.13+ commands:

/scoreboard players tag @a add HoldsArrows {SelectedItem:{id:"minecraft:arrow"}}
/scoreboard players tag @a[tag=HoldsArrows] remove HoldsArrows {SelectedItem:{id:"minecraft:arrow",Count:1b}}
/scoreboard players tag @a[tag=HoldsArrows] remove HoldsArrows {SelectedItem:{id:"minecraft:arrow",Count:2b}}

Answered by ExpertCoder14 on July 6, 2021

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