diff --git a/lib/automation.lua b/lib/automation.lua index b473eae..064f9db 100644 --- a/lib/automation.lua +++ b/lib/automation.lua @@ -111,6 +111,10 @@ function attack_entities(target_kind, minimum) end function check_food(hunger) + if not hunger then + hunger = client.hunger + end + if hunger.food >= 20 then return end diff --git a/lib/events.lua b/lib/events.lua index 3b23b35..0d70437 100644 --- a/lib/events.lua +++ b/lib/events.lua @@ -61,9 +61,11 @@ function update_listeners() message = function() info("bot successfully logged in!") end, + }, + spawn = { eat = function() sleep(5000) - check_food(client.hunger) + check_food() end, }, death = {