1
0
Fork 0

Replace get_registered_biome_from_pos with get_palette_indexes_from_pos

This commit is contained in:
FossFanatic 2023-02-14 18:08:59 +00:00
parent fcaa2c4ce1
commit 8fd40eaf46
1 changed files with 13 additions and 8 deletions

View File

@ -1017,13 +1017,18 @@ function mcl_util.check_position_protection(position, player)
return false return false
end end
function mcl_util.get_registered_biome_from_pos(pos) function mcl_util.get_palette_indexes_from_pos(pos)
local mg_name = minetest.get_mapgen_setting("mg_name") local palette_indexes = {grass_palette_index = 0, foliage_palette_index = 0}
if mg_name ~= "v6" and mg_name ~= "singlenode" then
local biome_data = minetest.get_biome_data(pos) local biome_data = minetest.get_biome_data(pos)
local biome = biome_data.biome local biome = biome_data.biome
local biome_name = minetest.get_biome_name(biome) local biome_name = minetest.get_biome_name(biome)
local reg_biome = minetest.registered_biomes[biome_name] local reg_biome = minetest.registered_biomes[biome_name]
return reg_biome if reg_biome then
local gpi = reg_biome._mcl_grass_palette_index
local fpi = reg_biome._mcl_foliage_palette_index
local palette_indexes = {grass_palette_index = gpi, foliage_palette_index = fpi}
return palette_indexes
else
return palette_indexes
end end
end end