Even further improvements to some foliage code

This commit is contained in:
FossFanatic 2023-02-12 08:28:21 +00:00
parent 3590ff6dfb
commit 0400d9a2a5
1 changed files with 2 additions and 14 deletions

View File

@ -803,17 +803,7 @@ end
local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed")) local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed"))
function mcl_core.get_grass_palette_index(pos) function mcl_core.get_grass_palette_index(pos)
local biome_data = minetest.get_biome_data(pos) return mcl_util.get_registered_biome_from_pos(pos)._mcl_grass_palette_index
local index = 0
if biome_data then
local biome = biome_data.biome
local biome_name = minetest.get_biome_name(biome)
local reg_biome = minetest.registered_biomes[biome_name]
if reg_biome then
index = reg_biome._mcl_grass_palette_index
end
end
return index
end end
-- Return appropriate grass block node for pos -- Return appropriate grass block node for pos
@ -822,9 +812,7 @@ function mcl_core.get_grass_block_type(pos)
end end
function mcl_core.get_foliage_palette_index(pos) function mcl_core.get_foliage_palette_index(pos)
local reg_biome = mcl_util.get_registered_biome_from_pos(pos) return mcl_util.get_registered_biome_from_pos(pos)._mcl_foliage_palette_index
local index = reg_biome._mcl_foliage_palette_index
return index
end end
-- Return appropriate foliage block node for pos -- Return appropriate foliage block node for pos