optional time_of_day arg for mcl_beds.is_night()

This commit is contained in:
cora 2022-09-05 17:55:50 +02:00
parent dadb39dd92
commit 38ea214bfe
1 changed files with 5 additions and 2 deletions

View File

@ -58,9 +58,12 @@ local monster_exceptions = {
["mobs_mc:shulker"] = true, ["mobs_mc:shulker"] = true,
} }
function mcl_beds.is_night() function mcl_beds.is_night(tod)
-- Values taken from Minecraft Wiki with offset of +600 -- 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 return tod > 18541 or tod < 5458
end end