Arqade Asked by CrackedJudgement on December 26, 2020
So I’m wanting to detect a certain amount of a named entity, I have the majority of the command, but I cant figure out how to add the amount. Here’s my current command.
/testfor @a {Inventory:[{id:"minecraft:gold_nugget",tag:{display:{Name:"Enchanting Token"}}}]}
You can use testfor
to find players with an exact count in a single slot like so:
testfor @a {Inventory:[{id:"minecraft:gold_nugget",Count:26b,tag:{display:{Name:"Enchanting Token"}}}]}
If you want to detect items across multiple slots, or detect a minimum amount of items, you'll need to use command stats. Create a scoreboard objective numItems
, then use
scoreboard players add @a numItems 0
stats entity @a set AffectedItems @s numItems
clear @a minecraft:gold_nugget -1 0 {display:{Name:"Enchanting Tokens"}}
stats entity @a clear AffectedItems
say Players with at least five Enchanting Tokens: @a[score_numItems_min=5]
Answered by AjaxGb on December 26, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP