1
0
Fork 0

Make the palette fix LBM not run on v6 & singlenode

This fixes a crash when loading a world that doesn't have any biomes and the LBM tries to give the grassy nodes a biome colour.
This commit is contained in:
FossFanatic 2023-02-01 14:23:49 +00:00 committed by Gitea
parent 855659a2a1
commit cbb3260471
1 changed files with 9 additions and 7 deletions

View File

@ -424,13 +424,15 @@ minetest.register_lbm({
nodenames = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"}, nodenames = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass", "mcl_flowers:double_grass", "mcl_flowers:double_grass_top", "mcl_flowers:fern", "mcl_flowers:double_fern", "mcl_flowers:double_fern_top", "mcl_core:reeds", "mcl_core:dirt_with_grass_snow"},
run_at_every_load = true, run_at_every_load = true,
action = function(pos, node) action = function(pos, node)
local biome_data = minetest.get_biome_data(pos) if mg_name ~= "v6" and mg_name ~= "singlenode" then
local biome = biome_data.biome local biome_data = minetest.get_biome_data(pos)
local biome_name = minetest.get_biome_name(biome) local biome = biome_data.biome
local reg_biome = minetest.registered_biomes[biome_name] local biome_name = minetest.get_biome_name(biome)
if node.param2 ~= reg_biome._mcl_grass_palette_index then local reg_biome = minetest.registered_biomes[biome_name]
node.param2 = reg_biome._mcl_grass_palette_index if node.param2 ~= reg_biome._mcl_grass_palette_index then
minetest.set_node(pos, node) node.param2 = reg_biome._mcl_grass_palette_index
minetest.set_node(pos, node)
end
end end
end, end,
}) })