#Can I detect Hunger with a scoreboard in player.json?

1 messages · Page 1 of 1 (latest)

bold ridge
#

Basically I just want to detect the hunger of a player like how one can detect health****

mild monolith
#

not possible yet, I think

bold ridge
#

dam rip

rustic pivot
# bold ridge Basically I just want to detect the hunger of a player like how one can detect h...

I made this animation controller for that.... and it works. Can be used like a template for a few other things too.```json
{ //works
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.health": {
"initial_state": "load",
"states": {
"load": {
"transitions":[{"query":"q.is_moving"}],
"on_exit": [
"/scoreboard objectives add Player_Info dummy",
"/scoreboard objectives add health dummy Player_Health"
]
},
"query": {
"on_entry": [
"/scoreboard players add @s health 0",
"/scoreboard players operation Health Player_Info = @s health"
],
"transitions": [
{"increment_sb_10":"q.scoreboard('health') < q.health-10"},
{"decrement_sb_10":"q.scoreboard('health') > q.health+10"},
{"increment_sb_5":"q.scoreboard('health') < q.health-5"},
{"decrement_sb_5":"q.scoreboard('health') > q.health+5"},
{"increment_sb":"q.scoreboard('health') < q.health"},
{"decrement_sb":"q.scoreboard('health') > q.health"}
]
},
"increment_sb": {"on_entry":["/scoreboard players add @s health 1"],"transitions":[{"query":"return true;"}]},
"decrement_sb": {"on_entry":["/scoreboard players remove @s health 1"],"transitions":[{"query":"return true;"}]},
"increment_sb_5": {"on_entry":["/scoreboard players add @s health 5"],"transitions":[{"query":"return true;"}]},
"decrement_sb_5": {"on_entry":["/scoreboard players remove @s health 5"],"transitions":[{"query":"return true;"}]},
"increment_sb_10": {"on_entry":["/scoreboard players add @s health 10"],"transitions":[{"query":"return true;"}]},
"decrement_sb_10": {"on_entry":["/scoreboard players remove @s health 10"],"transitions":[{"query":"return true;"}]}
}
}
}
}

#

Important, don't shortcut and skip the load and change default to query transition. I've found that some on_entry stuff in default transition is not done until player is fully loaded, so I just wait until they move, then it never goes back into load until they login again.

#

and take this out... "/scoreboard players operation Health Player_Info = @s health" I was testing with putting a bunch of stuff in one scoreboard so that I did not have to keep switching

#

Oh, and sorry mixed up hunger and health.... let me see if a query for hunger

#

Cannot find anything. Weird since the HUD can know it, must be a variable somewhere.... one of those secret menu things.. I'll look in a few more places and if I run across anything, will post back. Meanwhile, if you need health, its up there...

bold ridge
#

omg i didnt see this

tiny star
rustic pivot
#

no