1
0
Fork 0

Add nil checks

texture_conversion_wool
FossFanatic 2023-02-13 15:44:23 +00:00
parent 17cae6896e
commit e17fab385b
1 changed files with 12 additions and 2 deletions

View File

@ -803,7 +803,12 @@ end
local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed"))
function mcl_core.get_grass_palette_index(pos)
return mcl_util.get_registered_biome_from_pos(pos)._mcl_grass_palette_index
local reg_biome = mcl_util.get_registered_biome_from_pos(pos)
if reg_biome and reg_biome._mcl_grass_palette_index then
return reg_biome._mcl_grass_palette_index
else
return index
end
end
-- Return appropriate grass block node for pos
@ -812,7 +817,12 @@ function mcl_core.get_grass_block_type(pos)
end
function mcl_core.get_foliage_palette_index(pos)
return mcl_util.get_registered_biome_from_pos(pos)._mcl_foliage_palette_index
local reg_biome = mcl_util.get_registered_biome_from_pos(pos)
if reg_biome and reg_biome._mcl_foliage_palette_index then
return reg_biome._mcl_foliage_palette_index
else
return index
end
end
-- Return appropriate foliage block node for pos