2024-10-24 01:24:22 +02:00
|
|
|
-- Template to register a grass decoration
|
|
|
|
local function register_grass_decoration(offset, scale, biomes)
|
2024-10-26 19:04:10 +02:00
|
|
|
local bmap = {}
|
2024-10-24 01:24:22 +02:00
|
|
|
for b = 1, #biomes do
|
2024-10-26 19:04:10 +02:00
|
|
|
if minetest.registered_biomes[biomes[b]] then -- ignore missing biomes
|
|
|
|
local param2 = minetest.registered_biomes[biomes[b]]._mcl_grass_palette_index or 0
|
|
|
|
if not bmap[param2] then bmap[param2] = {} end
|
|
|
|
table.insert(bmap[param2], biomes[b])
|
|
|
|
else
|
|
|
|
minetest.log("warning", "Biome not found: "..biomes[b])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for param2, bs in pairs(bmap) do
|
2024-10-24 01:24:22 +02:00
|
|
|
mcl_mapgen_core.register_decoration({
|
|
|
|
deco_type = "simple",
|
|
|
|
priority = 1500,
|
|
|
|
place_on = {"group:grass_block_no_snow", "mcl_mud:mud"},
|
|
|
|
sidelen = 16,
|
|
|
|
noise_params = {
|
|
|
|
offset = offset,
|
|
|
|
scale = scale,
|
|
|
|
spread = vector.new(200, 200, 200),
|
|
|
|
seed = 420,
|
|
|
|
octaves = 3,
|
|
|
|
persist = 0.6
|
|
|
|
},
|
2024-10-26 19:04:10 +02:00
|
|
|
biomes = bs,
|
2024-10-24 01:24:22 +02:00
|
|
|
y_min = 1,
|
|
|
|
y_max = vl_biomes.overworld_max,
|
|
|
|
decoration = "mcl_flowers:tallgrass",
|
|
|
|
param2 = param2,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local grass_forest = {"Plains", "Taiga", "Forest", "FlowerForest", "BirchForest", "BirchForestM", "RoofedForest", "Swampland", }
|
|
|
|
local grass_mpf = {"MesaPlateauF_grasstop"}
|
2024-10-26 19:05:24 +02:00
|
|
|
local grass_plains = {"Plains", "SunflowerPlains", "CherryGrove", "JungleEdge", "JungleEdgeM", "MangroveSwamp"}
|
2024-10-24 01:24:22 +02:00
|
|
|
local grass_savanna = {"Savanna", "SavannaM"}
|
|
|
|
local grass_sparse = {"ExtremeHills", "ExtremeHills+", "ExtremeHills+_snowtop", "ExtremeHillsM", "Jungle"}
|
|
|
|
local grass_mpfm = {"MesaPlateauFM_grasstop"}
|
|
|
|
|
|
|
|
-- TODO: register only once for each biome, with better parameters?
|
|
|
|
register_grass_decoration(-0.03, 0.09, grass_forest)
|
|
|
|
register_grass_decoration(-0.015, 0.075, grass_forest)
|
|
|
|
register_grass_decoration(0, 0.06, grass_forest)
|
|
|
|
register_grass_decoration(0.015, 0.045, grass_forest)
|
|
|
|
register_grass_decoration(0.03, 0.03, grass_forest)
|
|
|
|
register_grass_decoration(-0.03, 0.09, grass_mpf)
|
|
|
|
register_grass_decoration(-0.015, 0.075, grass_mpf)
|
|
|
|
register_grass_decoration(0, 0.06, grass_mpf)
|
|
|
|
register_grass_decoration(0.01, 0.045, grass_mpf)
|
|
|
|
register_grass_decoration(0.01, 0.05, grass_forest)
|
|
|
|
register_grass_decoration(0.03, 0.03, grass_plains)
|
|
|
|
register_grass_decoration(0.05, 0.01, grass_plains)
|
|
|
|
register_grass_decoration(0.07, -0.01, grass_plains)
|
|
|
|
register_grass_decoration(0.09, -0.03, grass_plains)
|
|
|
|
register_grass_decoration(0.18, -0.03, grass_savanna)
|
|
|
|
register_grass_decoration(0.05, -0.03, grass_sparse)
|
|
|
|
register_grass_decoration(0.05, 0.05, grass_mpfm)
|
|
|
|
register_grass_decoration(-0.03, 1, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"})
|
|
|
|
|
|
|
|
-- Doubletall grass registration helper
|
|
|
|
local function register_doubletall_grass(offset, scale, biomes)
|
2024-10-26 19:04:10 +02:00
|
|
|
local bmap = {}
|
2024-10-24 01:24:22 +02:00
|
|
|
for b = 1, #biomes do
|
2024-10-26 19:04:10 +02:00
|
|
|
if minetest.registered_biomes[biomes[b]] then -- ignore missing biomes
|
|
|
|
local param2 = minetest.registered_biomes[biomes[b]]._mcl_grass_palette_index or 0
|
|
|
|
if not bmap[param2] then bmap[param2] = {} end
|
|
|
|
table.insert(bmap[param2], biomes[b])
|
|
|
|
else
|
|
|
|
minetest.log("warning", "Biome not found: "..biomes[b])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for param2, bs in pairs(bmap) do
|
2024-10-24 01:24:22 +02:00
|
|
|
mcl_mapgen_core.register_decoration({
|
|
|
|
deco_type = "schematic",
|
|
|
|
priority = 1500,
|
|
|
|
schematic = {
|
|
|
|
size = vector.new(1, 3, 1),
|
|
|
|
data = {
|
|
|
|
{name = "air", prob = 0},
|
|
|
|
{name = "mcl_flowers:double_grass", param1 = 255, param2 = param2},
|
|
|
|
{name = "mcl_flowers:double_grass_top", param1 = 255, param2 = param2},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
place_on = {"group:grass_block_no_snow"},
|
|
|
|
sidelen = 16,
|
|
|
|
noise_params = {
|
|
|
|
offset = offset,
|
|
|
|
scale = scale,
|
|
|
|
spread = vector.new(200, 200, 200),
|
|
|
|
seed = 420,
|
|
|
|
octaves = 3,
|
|
|
|
persist = 0.6,
|
|
|
|
},
|
|
|
|
y_min = 1,
|
|
|
|
y_max = vl_biomes.overworld_max,
|
2024-10-26 19:05:24 +02:00
|
|
|
biomes = bs,
|
2024-10-24 01:24:22 +02:00
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
register_doubletall_grass(-0.0005, -0.3, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"})
|
|
|
|
register_doubletall_grass(-0.01, 0.03, {"Forest", "FlowerForest", "BirchForest", "BirchForestM", "RoofedForest", "Taiga"})
|
2024-10-26 19:05:24 +02:00
|
|
|
register_doubletall_grass(-0.002, 0.03, {"Plains", "SunflowerPlains", "CherryGrove"})
|
2024-10-24 01:24:22 +02:00
|
|
|
register_doubletall_grass(-0.0005, -0.03, {"Savanna", "SavannaM"})
|
|
|
|
|
|
|
|
mcl_mapgen_core.register_decoration({
|
|
|
|
deco_type = "simple",
|
|
|
|
priority = 1500,
|
|
|
|
place_on = {"group:grass_block_no_snow"},
|
|
|
|
sidelen = 16,
|
|
|
|
noise_params = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 0.012,
|
|
|
|
spread = vector.new(100, 100, 100),
|
|
|
|
seed = 354,
|
|
|
|
octaves = 1,
|
|
|
|
persist = 0.5,
|
|
|
|
lacunarity = 1.0,
|
|
|
|
flags = "absvalue"
|
|
|
|
},
|
|
|
|
biomes = {"BambooJungle", "BambooJungleEdge","BambooJungleM", "BambooJungleEdge"},
|
|
|
|
y_max = vl_biomes.overworld_max,
|
|
|
|
y_min = 1,
|
|
|
|
decoration = "mcl_flowers:tallgrass"
|
|
|
|
})
|