From 38ea214bfe080ceb4233fe16539249de70c859f0 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 5 Sep 2022 17:55:50 +0200 Subject: [PATCH] optional time_of_day arg for mcl_beds.is_night() --- mods/ITEMS/mcl_beds/functions.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index f9f7435aa8..70324cb8ff 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -58,9 +58,12 @@ local monster_exceptions = { ["mobs_mc:shulker"] = true, } -function mcl_beds.is_night() +function mcl_beds.is_night(tod) -- Values taken from Minecraft Wiki with offset of +600 - local tod = ( minetest.get_timeofday() * 24000 ) % 24000 + if not tod then + tod = minetest.get_timeofday() + end + tod = ( tod * 24000 ) % 24000 return tod > 18541 or tod < 5458 end