1

I am trying to create a hydration system for my Minecraft adventure map that displays hydration levels on the scoreboard. To restore the players hydration a player should need to drink a water bottle, and so I figured this command would do the trick: /testfor @p {stat.useItem:373}

However I receive an error: (player) did not match the required data structure

Does anyone know why I recieve this error and if there is any way to make the command work? (preferably without using scoreboard values instead as I want to use the scoreboard values to display the hydration levels themselves)

3 Answers 3

3

stat.useItem is not a NBTag, it's a scoreboard objective type. Moreover, if it even was an data tag, you'd be testing for someone who has used an item 373 times, not someone who's used water once.

You are going to need to use scoreboard objectives for this. I feel like your concern may be a misunderstanding though; you can have as many different objectives as you want, and don't have to display the ones you don't want to be seen.

To set up this objective, type:

/scoreboard objectives add drankWater stat.useItem.minecraft.potion

You can then test for people who drank water like this:

/testfor @a[score_drankWater_min=1]

And reset their score to 0 like this:

/scoreboard players set @a[score_drankWater_min=1] drankWater 0
1

You cannot technically detect whether or not it's specifically a water bottle, unless you name it and have it testfor the player to have used it and hold it.

-2

I'm fairly certain you use [ ] in place of { }

You must log in to answer this question.

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