From 4b5476dbff1f884a69338629c1d3c674c3e4a818 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 2 Aug 2022 11:37:43 +0200 Subject: [PATCH] fix end sky and void crash --- mods/ENVIRONMENT/mcl_weather/rain.lua | 4 +++- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 2 +- mods/ENVIRONMENT/mcl_weather/snow.lua | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index e416d76e72..2cf95022e1 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -177,7 +177,9 @@ function mcl_weather.rain.make_weather() if mcl_weather.is_underwater(player) or not mcl_weather.has_rain(pos) then mcl_weather.rain.remove_sound(player) mcl_weather.remove_spawners_player(player) - mcl_weather.set_sky_box_clear(player) + if mcl_worlds.has_weather(pos) then + mcl_weather.set_sky_box_clear(player) + end else if mcl_weather.has_snow(pos) then mcl_weather.rain.remove_sound(player) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index fe65721c5f..b70702b4c2 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -95,7 +95,7 @@ mcl_weather.skycolor = { for _, player in ipairs(players) do local pos = player:get_pos() local dim = mcl_worlds.pos_to_dimension(pos) - local has_weather = ((mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) + local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) if dim == "overworld" then if (mcl_weather.state == "none") then -- Clear weather diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index 4afed56915..a756c6e7f4 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -66,8 +66,8 @@ function mcl_weather.has_snow(pos) if mgname == "singlenode" or mgname == "v6" then return false end local bn = minetest.get_biome_name(minetest.get_biome_data(pos).biome) local bd = minetest.registered_biomes[bn] - if bd._mcl_biome_type == "snowy" then return true end - if bd._mcl_biome_type == "cold" then + if bd and bd._mcl_biome_type == "snowy" then return true end + if bd and bd._mcl_biome_type == "cold" then if bn == "Taiga" and pos.y > 140 then return true end if bn == "MegaSpruceTaiga" and pos.y > 100 then return true end end