mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-27 02:19:33 +01:00
Add nil checks
This commit is contained in:
parent
17cae6896e
commit
e17fab385b
1 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue