From c4c3afa375016f2a6813d48406df54875482ebf5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 7 Jun 2017 01:04:58 +0200 Subject: [PATCH] Fix mcl_hunger init --- mods/PLAYER/mcl_hunger/init.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index e3cc6e83aa..c17435ca53 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -88,15 +88,18 @@ end -- API START -- mcl_hunger.get_hunger = function(player) - return tonumber(player:get_attribute("mcl_hunger:hunger")) or 20 + local hunger = player:get_attribute("mcl_hunger:hunger") or 20 + return tonumber(hunger) end mcl_hunger.get_saturation = function(player) - return tonumber(player:get_attribute("mcl_hunger:saturation")) or mcl_hunger.SATURATION_INIT + local saturation = player:get_attribute("mcl_hunger:saturation") or mcl_hunger.SATURATION_INIT + return tonumber(saturation) end mcl_hunger.get_exhaustion = function(player) - return tonumber(player:get_attribute("mcl_hunger:exhaustion")) or 0 + local exhaustion = player:get_attribute("mcl_hunger:exhaustion") or 0 + return tonumber(exhaustion) end mcl_hunger.set_hunger = function(player, hunger, update_hudbars)