template specialization for param2

This commit is contained in:
kno10 2024-10-24 17:09:49 +02:00
parent c2a1833aeb
commit 54d1c4f774
32 changed files with 334 additions and 112 deletions

View file

@ -148,16 +148,39 @@ end
local pending_decorations = {} local pending_decorations = {}
local gennotify_map = {} local gennotify_map = {}
function mcl_mapgen_core.register_decoration(def, callback) function mcl_mapgen_core.register_decoration(def, callback)
def = table.copy(def) -- defensive deep copy, needed for water lily
if def.gen_callback and not def.name then error("gen_callback requires a named decoration.") end if def.gen_callback and not def.name then error("gen_callback requires a named decoration.") end
if callback then error("Callbacks have been redesigned.") end if callback then error("Callbacks have been redesigned.") end
-- customize foliage colors
if (def._mcl_foliage_palette_index or 0) > 0 then
if type(def.schematic) ~= "string" then error("Can currently only be used with file schematics.") end
-- Load the schema and apply foliage palette
local schem = minetest.read_schematic(def.schematic, {})
schem.name = def.schematic -- preserve the file name
local cache = {}
for _, node in ipairs(schem.data) do
local kind = cache[node.name]
if kind == nil then
local ndef = minetest.registered_nodes[node.name]
kind = ndef and (ndef.groups.foliage_palette and "color")
or (ndef.groups.foliage_palette_wallmounted and "colorwallmounted")
or false
cache[node.name] = kind
end
if kind == "color" then
node.param2 = def._mcl_foliage_palette_index
elseif kind == "colorwallmounted" then
node.param2 = def._mcl_foliage_palette_index * 8 + (node.param2 % 8)
end
end
def.schematic = schem
end
if pending_decorations == nil then if pending_decorations == nil then
minetest.log("warning", "Decoration registered after mapgen core initialization: "..tostring(def.name)) minetest.log("warning", "Decoration registered after mapgen core initialization: "..tostring(def.name))
minetest.register_decoration(def) minetest.register_decoration(def)
if def.gen_callback then if def.gen_callback then
def.deco_id = minetest.get_decoration_id(def.name) def.deco_id = minetest.get_decoration_id(def.name)
if not def.deco_id then if not def.deco_id then
error("Failed to get the decoration id for "..tostring(key)) error("Failed to get the decoration id for "..tostring(def.name))
else else
minetest.set_gen_notify({decoration = true}, {def.deco_id}) minetest.set_gen_notify({decoration = true}, {def.deco_id})
gennotify_map["decoration#" .. def.deco_id] = def gennotify_map["decoration#" .. def.deco_id] = def
@ -177,6 +200,10 @@ local function sort_decorations()
local sc = string.split(def.schematic, "/") local sc = string.split(def.schematic, "/")
name = string.format("%s:%04d", sc[#sc], i) name = string.format("%s:%04d", sc[#sc], i)
end end
if not name and type(def.schematic) == "table" and def.schematic.name then
local sc = string.split(def.schematic.name, "/")
name = string.format("%s:%04d", sc[#sc], i)
end
if not name and type(def.schematic) == "table" and def.schematic.data then if not name and type(def.schematic) == "table" and def.schematic.data then
name = "" name = ""
for _, v in ipairs(def.schematic.data) do for _, v in ipairs(def.schematic.data) do
@ -193,18 +220,16 @@ local function sort_decorations()
table.sort(keys) table.sort(keys)
for _, key in ipairs(keys) do for _, key in ipairs(keys) do
local def = map[key] local def = map[key]
if def.name and minetest.get_decoration_id(def.name) then
minetest.log("warning", "Decoration ID not unique: "..def.name)
end
local deco_id = minetest.register_decoration(def) local deco_id = minetest.register_decoration(def)
if not deco_id then if not deco_id then
error("Failed to register decoration"..tostring(key)) error("Failed to register decoration "..tostring(def.name).." - name not unique?")
end end
if def.gen_callback then if def.gen_callback then
deco_id = minetest.get_decoration_id(def.name) minetest.set_gen_notify({decoration = true}, {deco_id})
if not deco_id then gennotify_map["decoration#" .. deco_id] = def
error("Failed to get the decoration id for "..tostring(key))
else
minetest.set_gen_notify({decoration = true}, {deco_id})
gennotify_map["decoration#" .. deco_id] = def
end
end end
end end
pending_decorations = nil -- as we will not run again pending_decorations = nil -- as we will not run again

View file

@ -285,6 +285,7 @@ local function set_water_palette(minp,maxp,data2,area,nodes)
local biomemap = minetest.get_mapgen_object("biomemap") local biomemap = minetest.get_mapgen_object("biomemap")
if not biomemap then return end if not biomemap then return end
local aream = VoxelArea(vector.new(minp.x, 0, minp.z), vector.new(maxp.x, 0, maxp.z)) local aream = VoxelArea(vector.new(minp.x, 0, minp.z), vector.new(maxp.x, 0, maxp.z))
-- FIXME: this relies on the voxelmanip already being written.
local nodes = minetest.find_nodes_in_area(minp, maxp, nodes) local nodes = minetest.find_nodes_in_area(minp, maxp, nodes)
local lvm_used = false local lvm_used = false
for n=1, #nodes do for n=1, #nodes do
@ -303,6 +304,7 @@ local function set_water_palette(minp,maxp,data2,area,nodes)
return lvm_used return lvm_used
end end
--[[
local function set_seagrass_param2(minp,maxp,data2,area,nodes) local function set_seagrass_param2(minp,maxp,data2,area,nodes)
local nodes = minetest.find_nodes_in_area(minp, maxp, nodes) local nodes = minetest.find_nodes_in_area(minp, maxp, nodes)
local lvm_used = false local lvm_used = false
@ -313,6 +315,7 @@ local function set_seagrass_param2(minp,maxp,data2,area,nodes)
end end
return lvm_used return lvm_used
end end
]]
-- Below the bedrock, generate air/void -- Below the bedrock, generate air/void
local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
@ -367,17 +370,19 @@ local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, bl
return lvm_used, lvm_used, deco, ores return lvm_used, lvm_used, deco, ores
end end
--[[ replaced with decoration hack to replace grass nodes
local function block_fixes_grass(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function block_fixes_grass(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Set param2 (=color) of nodes which use the grass colour palette. -- Set param2 (=color) of nodes which use the grass colour palette.
return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and
set_grass_palette(minp,maxp,data2,area,{"group:grass_palette"}) set_grass_palette(minp,maxp,data2,area,{"group:grass_palette"})
end end]]
--[[ replaced with schematic specialization per biome
local function block_fixes_foliage(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function block_fixes_foliage(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Set param2 (=color) of nodes which use the foliage colour palette. -- Set param2 (=color) of nodes which use the foliage colour palette.
return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and
set_foliage_palette(minp,maxp,data2,area,{"group:foliage_palette", "group:foliage_palette_wallmounted"}) set_foliage_palette(minp,maxp,data2,area,{"group:foliage_palette", "group:foliage_palette_wallmounted"})
end end]]
local function block_fixes_water(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function block_fixes_water(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Set param2 (=color) of nodes which use the water colour palette. -- Set param2 (=color) of nodes which use the water colour palette.
@ -385,11 +390,13 @@ local function block_fixes_water(vm, data, data2, emin, emax, area, minp, maxp,
set_water_palette(minp,maxp,data2,area,{"group:water_palette"}) set_water_palette(minp,maxp,data2,area,{"group:water_palette"})
end end
--[[ no longer necessary, we generate them with param2=3
local function block_fixes_seagrass(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function block_fixes_seagrass(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Set param2 of seagrass to 3. -- Set param2 of seagrass to 3.
return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and
set_seagrass_param2(minp, maxp, data2, area, {"group:seagrass"}) set_seagrass_param2(minp, maxp, data2, area, {"group:seagrass"})
end end
]]
-- End block fixes: -- End block fixes:
local function end_basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function end_basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
@ -412,10 +419,10 @@ mcl_mapgen_core.register_generator("world_structure", world_structure, nil, 1, t
mcl_mapgen_core.register_generator("end_fixes", end_basic, nil, 9999, true) mcl_mapgen_core.register_generator("end_fixes", end_basic, nil, 9999, true)
if mg_name ~= "v6" and mg_name ~= "singlenode" then if mg_name ~= "v6" and mg_name ~= "singlenode" then
mcl_mapgen_core.register_generator("block_fixes_grass", block_fixes_grass, nil, 9999, true) -- replaced with decoration hack: mcl_mapgen_core.register_generator("block_fixes_grass", block_fixes_grass, nil, 9999, true)
mcl_mapgen_core.register_generator("block_fixes_foliage", block_fixes_foliage, nil, 9999, true) -- replaced with schema specialization: mcl_mapgen_core.register_generator("block_fixes_foliage", block_fixes_foliage, nil, 9999, true)
mcl_mapgen_core.register_generator("block_fixes_water", block_fixes_water, nil, 9999, true) mcl_mapgen_core.register_generator("block_fixes_water", block_fixes_water, nil, 9999, true)
mcl_mapgen_core.register_generator("block_fixes_seagrass", block_fixes_seagrass, nil, 9999, true) -- replaced with using param2=3 during generation mcl_mapgen_core.register_generator("block_fixes_seagrass", block_fixes_seagrass, nil, 9999, true)
end end
if mg_name == "v6" then if mg_name == "v6" then
@ -423,6 +430,7 @@ if mg_name == "v6" then
end end
-- still needed? -- still needed?
--[[
minetest.register_lbm({ minetest.register_lbm({
label = "Fix grass palette indexes", -- This LBM fixes any incorrect grass palette indexes. label = "Fix grass palette indexes", -- This LBM fixes any incorrect grass palette indexes.
name = "mcl_mapgen_core:fix_grass_palette_indexes", name = "mcl_mapgen_core:fix_grass_palette_indexes",
@ -435,8 +443,9 @@ minetest.register_lbm({
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
end end
end end
}) })]]
--[[ FIXME: not yet replaced
minetest.register_lbm({ minetest.register_lbm({
label = "Fix foliage palette indexes", -- Set correct palette indexes of foliage in old mapblocks. label = "Fix foliage palette indexes", -- Set correct palette indexes of foliage in old mapblocks.
name = "mcl_mapgen_core:fix_foliage_palette_indexes", name = "mcl_mapgen_core:fix_foliage_palette_indexes",
@ -490,8 +499,10 @@ minetest.register_lbm({
end end
end end
}) })
]]--
--[[ No longer necessary? Ugly? -- Can we get rid of this ugly hack?
--[[
-- We go outside x and y for where trees are placed next to a biome that has already been generated. -- We go outside x and y for where trees are placed next to a biome that has already been generated.
-- We go above maxp.y because trees can often get placed close to the top of a generated area and folliage may not -- We go above maxp.y because trees can often get placed close to the top of a generated area and folliage may not
-- be coloured correctly. -- be coloured correctly.

View file

@ -107,5 +107,6 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 4,
}) })

View file

@ -183,5 +183,6 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 4,
}) })

View file

@ -45,6 +45,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
-- Melon -- Melon

View file

@ -38,6 +38,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 13,
}) })
-- Melon -- Melon
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({

View file

@ -47,6 +47,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_2.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_2.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "schematic", deco_type = "schematic",
@ -65,6 +66,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 12,
}) })
-- Melon -- Melon
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({

View file

@ -41,6 +41,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 13,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -60,6 +61,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 13,
}) })
-- Melon -- Melon

View file

@ -43,6 +43,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_birch.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_birch.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 8,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "schematic", deco_type = "schematic",
@ -65,4 +66,5 @@ mcl_mapgen_core.register_decoration({
rotation = "random", rotation = "random",
spawn_by = "group:flower", spawn_by = "group:flower",
priority = 1550, priority = 1550,
_mcl_foliage_palette_index = 8,
}) })

View file

@ -43,6 +43,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_birch_tall.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_birch_tall.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 8,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -66,4 +67,5 @@ mcl_mapgen_core.register_decoration({
rotation = "random", rotation = "random",
spawn_by = "group:flower", spawn_by = "group:flower",
priority = 1550, priority = 1550,
_mcl_foliage_palette_index = 8,
}) })

View file

@ -47,6 +47,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_dark_oak.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_dark_oak.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 7,
}) })
local ratio_mushroom = 0.0001 local ratio_mushroom = 0.0001

View file

@ -1,28 +1,62 @@
-- Large flowers -- Large flowers
local function register_large_flower(name, biomes, seed, offset) local function register_large_flower(name, biomes, seed, offset)
mcl_mapgen_core.register_decoration({ local ndef = minetest.registered_nodes["mcl_flowers:"..name]
deco_type = "schematic", local has_param2 = ndef and ndef.groups.grass_palette
schematic = { local tdef = minetest.registered_nodes["mcl_flowers:"..name]
size = vector.new(1, 2, 1), local thas_param2 = tdef and tdef.groups.grass_palette
data = { if has_param2 then
{name = "mcl_flowers:" .. name }, for b = 1, #biomes do
{name = "mcl_flowers:" .. name .. "_top" }, local param2 = minetest.registered_biomes[biomes[b]]._mcl_grass_palette_index
local tparam2 = thas_param2 and param2 or nil
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
schematic = {
size = vector.new(1, 2, 1),
data = {
{name = "mcl_flowers:" .. name, param2 = param2 },
{name = "mcl_flowers:" .. name .. "_top", param2 = tparam2 },
},
},
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 16,
noise_params = {
offset = offset,
scale = 0.01,
spread = vector.new(300, 300, 300),
seed = seed,
octaves = 5,
persist = 0.62,
},
y_min = 1,
y_max = vl_biomes.overworld_max,
biomes = {biomes[b]},
})
end
else
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
schematic = {
size = vector.new(1, 2, 1),
data = {
{name = "mcl_flowers:" .. name },
{name = "mcl_flowers:" .. name .. "_top" },
},
}, },
}, place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, sidelen = 16,
sidelen = 16, noise_params = {
noise_params = { offset = offset,
offset = offset, scale = 0.01,
scale = 0.01, spread = vector.new(300, 300, 300),
spread = vector.new(300, 300, 300), seed = seed,
seed = seed, octaves = 5,
octaves = 5, persist = 0.62,
persist = 0.62, },
}, y_min = 1,
y_min = 1, y_max = vl_biomes.overworld_max,
y_max = vl_biomes.overworld_max, biomes = biomes,
biomes = biomes, })
}) end
end end
register_large_flower("rose_bush", {"Forest"}, 9350, -0.008) register_large_flower("rose_bush", {"Forest"}, 9350, -0.008)
@ -34,23 +68,49 @@ register_large_flower("lilac", {"FlowerForest"}, 10600, 0.003)
register_large_flower("sunflower", {"SunflowerPlains"}, 2940, 0.01) register_large_flower("sunflower", {"SunflowerPlains"}, 2940, 0.01)
local function register_flower(name, biomes, seed, offset) local function register_flower(name, biomes, seed, offset)
mcl_mapgen_core.register_decoration({ local ndef = minetest.registered_nodes["mcl_flowers:"..name]
deco_type = "simple", local has_param2 = ndef and ndef.groups.grass_palette
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, if has_param2 then
sidelen = 16, for b = 1, #biomes do
noise_params = { local param2 = minetest.registered_biomes[biomes[b]]._mcl_grass_palette_index
offset = offset, mcl_mapgen_core.register_decoration({
scale = 0.006, deco_type = "simple",
spread = vector.new(100, 100, 100), place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
seed = seed, sidelen = 16,
octaves = 3, noise_params = {
persist = 0.6 offset = offset,
}, scale = 0.006,
y_min = 1, spread = vector.new(100, 100, 100),
y_max = vl_biomes.overworld_max, seed = seed,
biomes = biomes, octaves = 3,
decoration = "mcl_flowers:" .. name, persist = 0.6
}) },
y_min = 1,
y_max = vl_biomes.overworld_max,
biomes = {biomes[b]},
decoration = "mcl_flowers:" .. name,
param2 = param2
})
end
else
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 16,
noise_params = {
offset = offset,
scale = 0.006,
spread = vector.new(100, 100, 100),
seed = seed,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = vl_biomes.overworld_max,
biomes = biomes,
decoration = "mcl_flowers:" .. name,
})
end
end end
local flower_biomes1 = {"Plains", "SunflowerPlains", "RoofedForest", "Forest", "BirchForest", "BirchForestM", "Taiga", "ColdTaiga", "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Savanna", "SavannaM", "ExtremeHills", "ExtremeHillsM", "ExtremeHills+", "ExtremeHills+_snowtop"} local flower_biomes1 = {"Plains", "SunflowerPlains", "RoofedForest", "Forest", "BirchForest", "BirchForestM", "Taiga", "ColdTaiga", "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Savanna", "SavannaM", "ExtremeHills", "ExtremeHillsM", "ExtremeHills+", "ExtremeHills+_snowtop"}

View file

@ -1,24 +1,30 @@
-- Sugar canes -- Sugar canes
mcl_mapgen_core.register_decoration({ for _, biome in ipairs(vl_biomes.overworld_biomes) do
deco_type = "simple", mcl_mapgen_core.register_decoration({
place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"}, deco_type = "simple",
sidelen = 16, place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"},
noise_params = { sidelen = 16,
offset = -0.3, noise_params = {
scale = 0.7, offset = -0.3,
spread = vector.new(200, 200, 200), scale = 0.7,
seed = 2, spread = vector.new(200, 200, 200),
octaves = 3, seed = 2,
persist = 0.7 octaves = 3,
}, persist = 0.7
y_min = 1, },
y_max = vl_biomes.overworld_max, y_min = 1,
decoration = "mcl_core:reeds", y_max = vl_biomes.overworld_max,
height = 1, decoration = "mcl_core:reeds",
height_max = 3, height = 1,
spawn_by = {"mcl_core:water_source", "group:frosted_ice"}, -- TODO: river water source, too? height_max = 3,
num_spawn_by = 1, spawn_by = {"mcl_core:water_source", "mcl_core:river_water_source", "group:frosted_ice"},
}) num_spawn_by = 1,
biomes = {biome},
param2 = biome._mcl_foliage_palette_index
})
end
-- additional reeds in swamps
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"}, place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"},
@ -39,5 +45,6 @@ mcl_mapgen_core.register_decoration({
height_max = 3, height_max = 3,
spawn_by = {"mcl_core:water_source", "group:frosted_ice"}, spawn_by = {"mcl_core:water_source", "group:frosted_ice"},
num_spawn_by = 1, num_spawn_by = 1,
param2 = 5 -- Swampland foliage palette index
}) })

View file

@ -1,41 +1,30 @@
-- TODO: move to mcl_ocean? -- TODO: move to mcl_ocean with a late registration (when biomes are registered)?
local function register_seagrass_decoration(grasstype, offset, scale, biomes) local function register_seagrass_decoration(offset, scale, biomes)
local seed, nodes, surfaces, param2, param2_max, y_max local surfaces = {"mcl_core:dirt", "mcl_core:sand", "mcl_core:gravel", "mcl_core:redsand"}
if grasstype == "seagrass" then local nodes = {"mcl_ocean:seagrass_dirt", "mcl_ocean:seagrass_sand", "mcl_ocean:seagrass_gravel", "mcl_ocean:seagrass_redsand"}
seed = 16
surfaces = {"mcl_core:dirt", "mcl_core:sand", "mcl_core:gravel", "mcl_core:redsand"}
nodes = {"mcl_ocean:seagrass_dirt", "mcl_ocean:seagrass_sand", "mcl_ocean:seagrass_gravel", "mcl_ocean:seagrass_redsand"}
y_max = 0
elseif grasstype == "kelp" then
seed = 32
param2 = 16
param2_max = 96
surfaces = {"mcl_core:dirt", "mcl_core:sand", "mcl_core:gravel"}
nodes = {"mcl_ocean:kelp_dirt", "mcl_ocean:kelp_sand", "mcl_ocean:kelp_gravel"}
y_max = -6
end
local noise = {
offset = offset,
scale = scale,
spread = vector.new(100, 100, 100),
seed = seed,
octaves = 3,
persist = 0.6,
}
for s = 1, #surfaces do for s = 1, #surfaces do
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
name = "Seagrass on "..surfaces[s],
deco_type = "simple", deco_type = "simple",
priority = 1500, priority = 1500,
place_on = {surfaces[s]}, place_on = {surfaces[s]},
sidelen = 16, sidelen = 16,
noise_params = noise, noise_params = {
offset = offset,
scale = scale,
spread = vector.new(100, 100, 100),
seed = 16,
octaves = 3,
persist = 0.6,
},
biomes = biomes, biomes = biomes,
y_min = vl_biomes.DEEP_OCEAN_MIN, y_min = vl_biomes.DEEP_OCEAN_MIN,
y_max = y_max, y_max = 0,
decoration = nodes[s], decoration = nodes[s],
param2 = param2, --param2 = 3, -- always use meshoption 3
param2_max = param2_max, param2 = 0,
param2_max = 3,
place_offset_y = -1, place_offset_y = -1,
flags = "force_placement", flags = "force_placement",
}) })
@ -44,7 +33,7 @@ end
-- TODO: use temperature classes, rather than hardcoding biome lists here? -- TODO: use temperature classes, rather than hardcoding biome lists here?
-- Also would allow for more/less seagrass depending on temperature class -- Also would allow for more/less seagrass depending on temperature class
register_seagrass_decoration("seagrass", 0, 0.5, { register_seagrass_decoration(0, 0.5, {
"ColdTaiga_ocean", "ColdTaiga_ocean",
"ExtremeHills_ocean", "ExtremeHills_ocean",
"ExtremeHillsM_ocean", "ExtremeHillsM_ocean",
@ -116,7 +105,37 @@ register_seagrass_decoration("seagrass", 0, 0.5, {
"ExtremeHills_beach", "ExtremeHills_beach",
}) })
register_seagrass_decoration("kelp", -0.5, 1, { local function register_kelp_decoration(offset, scale, biomes)
local surfaces = {"mcl_core:dirt", "mcl_core:sand", "mcl_core:gravel"}
local nodes = {"mcl_ocean:kelp_dirt", "mcl_ocean:kelp_sand", "mcl_ocean:kelp_gravel"}
for s = 1, #surfaces do
mcl_mapgen_core.register_decoration({
name = "Kelp on "..surfaces[s],
deco_type = "simple",
priority = 1500,
place_on = {surfaces[s]},
sidelen = 16,
noise_params = {
offset = offset,
scale = scale,
spread = vector.new(100, 100, 100),
seed = 32,
octaves = 3,
persist = 0.6,
},
biomes = biomes,
y_min = vl_biomes.DEEP_OCEAN_MIN,
y_max = -6,
decoration = nodes[s],
param2 = 16,
param2_max = 96, -- height * 16
place_offset_y = -1,
flags = "force_placement",
})
end
end
register_kelp_decoration(-0.5, 1, {
"ExtremeHillsM_ocean", "ExtremeHillsM_ocean",
"ExtremeHills+_ocean", "ExtremeHills+_ocean",
"MegaTaiga_ocean", "MegaTaiga_ocean",

View file

@ -55,6 +55,7 @@ for i = 1, 4 do
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_"..i..".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_"..i..".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 7,
}) })
end end
@ -77,6 +78,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 7,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -100,6 +102,7 @@ mcl_mapgen_core.register_decoration({
rotation = "random", rotation = "random",
spawn_by = "group:flower", spawn_by = "group:flower",
priority = 1550, priority = 1550,
_mcl_foliage_palette_index = 7,
}) })
-- Rare balloon oak -- Rare balloon oak
@ -121,6 +124,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_balloon.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_balloon.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 7,
}) })
-- Birch -- Birch
@ -141,6 +145,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_birch.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_birch.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 7,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -164,5 +169,6 @@ mcl_mapgen_core.register_decoration({
rotation = "random", rotation = "random",
spawn_by = "group:flower", spawn_by = "group:flower",
priority = 1550, priority = 1550,
_mcl_foliage_palette_index = 7,
}) })

View file

@ -54,6 +54,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 7,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -77,6 +78,7 @@ mcl_mapgen_core.register_decoration({
rotation = "random", rotation = "random",
spawn_by = "group:flower", spawn_by = "group:flower",
priority = 1550, priority = 1550,
_mcl_foliage_palette_index = 7,
}) })
-- Birch -- Birch
@ -97,4 +99,5 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_birch.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_birch.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 7,
}) })

View file

@ -34,6 +34,36 @@ local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superfl
-- Biomes by water temperature, for decorations and structures -- Biomes by water temperature, for decorations and structures
vl_biomes.by_water_temp = {} vl_biomes.by_water_temp = {}
vl_biomes.overworld_biomes = {}
-- TODO: also add a list of nether and end biomes
-- Fix the grass color via decoration mechanism,
-- by replacing node_top with node_top and param2 set
-- TODO: this can be removed when param2 support to biomes is added
-- <https://github.com/minetest/minetest/issues/15319>
vl_biomes.fix_grass_color = function(def)
if (def._mcl_grass_palette_index or 0) == 0 then return end -- not necessary
-- for now, only support node_top.
local name = def.node_top
local ndef = minetest.registered_nodes[name]
if ndef and (ndef.groups.grass_palette or 0) ~= 0 and ndef.paramtype2 == "color" then -- no mixed types
local param2 = def._mcl_grass_palette_index
mcl_mapgen_core.register_decoration({
name = "Set "..name.." param2 in "..def.name,
priority = 10, -- run early to not modify other decorations
deco_type = "simple",
place_on = {name},
biomes = { def.name },
y_min = def.y_min or vl_biomes.overworld_min,
y_max = def.y_max or vl_biomes.overworld_max,
fill_ratio = 10, -- everything
decoration = name,
param2 = param2,
flags = "force_placement",
place_offset_y = -1, -- replace the node itself
})
end
end
-- Register a biome -- Register a biome
-- This API has a few extensions over minetest.register_biome: -- This API has a few extensions over minetest.register_biome:
@ -121,10 +151,16 @@ vl_biomes.register_biome = function(def)
end end
end end
minetest.register_biome(def) minetest.register_biome(def)
if is_overworld and def.y_max > 0 then table.insert(vl_biomes.overworld_biomes, def.name) end
vl_biomes.fix_grass_color(def)
-- minetest.log("action", "registering biome "..tostring(def.name)) -- minetest.log("action", "registering biome "..tostring(def.name))
for _, sdef in ipairs(subbiomes) do for _, sdef in ipairs(subbiomes) do
-- minetest.log("action", "registering subbiome "..tostring(sdef.name)) -- minetest.log("action", "registering subbiome "..tostring(sdef.name))
minetest.register_biome(sdef) minetest.register_biome(sdef)
if is_overworld and sdef.y_max > 0 then -- omit _ocean
table.insert(vl_biomes.overworld_biomes, sdef.name)
end
vl_biomes.fix_grass_color(sdef) -- usually a no-op
end end
end end
@ -148,6 +184,7 @@ function vl_biomes.register_spruce_decoration(seed, offset, sprucename, biomes,
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/" .. sprucename, schematic = mod_mcl_core .. "/schematics/" .. sprucename,
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
-- not supported by spruceleaves: _mcl_foliage_palette_index = foliage_color,
}) })
end end

View file

@ -47,6 +47,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
-- Huge jungle tree (4 variants) -- Huge jungle tree (4 variants)
@ -62,6 +63,7 @@ for i = 1, 4 do
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_huge_"..i..".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_huge_"..i..".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
end end
@ -77,6 +79,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "schematic", deco_type = "schematic",
@ -89,6 +92,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_2.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_2.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "schematic", deco_type = "schematic",
@ -101,6 +105,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_3.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_3.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "schematic", deco_type = "schematic",
@ -113,6 +118,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_4.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_4.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
-- Jungle bush -- Jungle bush
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -132,6 +138,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 12,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "schematic", deco_type = "schematic",
@ -150,6 +157,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves_2.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves_2.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 12,
}) })
-- Melon -- Melon

View file

@ -38,6 +38,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 13,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -51,6 +52,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 13,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -70,6 +72,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 13,
}) })
-- Melon -- Melon

View file

@ -47,6 +47,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
-- Huge jungle tree (4 variants) -- Huge jungle tree (4 variants)
@ -62,6 +63,7 @@ for i = 1, 4 do
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_huge_"..i..".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_huge_"..i..".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
end end
@ -76,6 +78,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_2.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree_2.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 12,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "schematic", deco_type = "schematic",
@ -94,6 +97,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 12,
}) })
-- Melon -- Melon
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({

View file

@ -40,6 +40,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 13,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -53,6 +54,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 13,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -72,6 +74,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
_mcl_foliage_palette_index = 13,
}) })
-- Lots of melons in Jungle Edge M -- Lots of melons in Jungle Edge M

View file

@ -71,6 +71,7 @@ mcl_mapgen_core.register_decoration({
flags = "place_center_x, place_center_z, force_placement", flags = "place_center_x, place_center_z, force_placement",
rotation = "random", rotation = "random",
gen_callback = mangrove_root_gennotify, gen_callback = mangrove_root_gennotify,
_mcl_foliage_palette_index = 6,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
name = "mcl_biomes:mangrove_tree_2", name = "mcl_biomes:mangrove_tree_2",
@ -85,6 +86,7 @@ mcl_mapgen_core.register_decoration({
flags = "place_center_x, place_center_z, force_placement", flags = "place_center_x, place_center_z, force_placement",
rotation = "random", rotation = "random",
gen_callback = mangrove_root_gennotify, gen_callback = mangrove_root_gennotify,
_mcl_foliage_palette_index = 6,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
name = "mcl_biomes:mangrove_tree_3", name = "mcl_biomes:mangrove_tree_3",
@ -99,6 +101,7 @@ mcl_mapgen_core.register_decoration({
flags = "place_center_x, place_center_z, force_placement", flags = "place_center_x, place_center_z, force_placement",
rotation = "random", rotation = "random",
gen_callback = mangrove_root_gennotify, gen_callback = mangrove_root_gennotify,
_mcl_foliage_palette_index = 6,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
name = "mcl_biomes:mangrove_tree_4", name = "mcl_biomes:mangrove_tree_4",
@ -113,6 +116,7 @@ mcl_mapgen_core.register_decoration({
flags = "place_center_x, place_center_z, force_placement", flags = "place_center_x, place_center_z, force_placement",
rotation = "random", rotation = "random",
gen_callback = mangrove_root_gennotify, gen_callback = mangrove_root_gennotify,
_mcl_foliage_palette_index = 6,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
name = "mcl_biomes:mangrove_tree_5", name = "mcl_biomes:mangrove_tree_5",
@ -127,6 +131,7 @@ mcl_mapgen_core.register_decoration({
flags = "place_center_x, place_center_z, force_placement", flags = "place_center_x, place_center_z, force_placement",
rotation = "random", rotation = "random",
gen_callback = mangrove_root_gennotify, gen_callback = mangrove_root_gennotify,
_mcl_foliage_palette_index = 6,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
name = "mcl_biomes:mangrove_bee_nest", name = "mcl_biomes:mangrove_bee_nest",
@ -151,6 +156,7 @@ mcl_mapgen_core.register_decoration({
spawn_by = "group:flower", spawn_by = "group:flower",
priority = 1550, priority = 1550,
gen_callback = mangrove_root_gennotify, gen_callback = mangrove_root_gennotify,
_mcl_foliage_palette_index = 6,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
deco_type = "simple", deco_type = "simple",

View file

@ -40,12 +40,13 @@ mcl_mapgen_core.register_decoration({
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80, sidelen = 80,
fill_ratio = 0.0004, fill_ratio = 0.0004,
biomes = {"JungleEdge", "JungleEdgeM", "Savanna"}, biomes = {"Savanna"},
y_min = 1, y_min = 1,
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 3,
}) })
-- Acacia (many variants) -- Acacia (many variants)
for a = 1, 7 do for a = 1, 7 do
@ -60,6 +61,7 @@ for a = 1, 7 do
schematic = mod_mcl_core .. "/schematics/mcl_core_acacia_" .. a .. ".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_acacia_" .. a .. ".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 3,
}) })
end end

View file

@ -40,6 +40,7 @@ for a = 1, 7 do
schematic = mod_mcl_core .. "/schematics/mcl_core_acacia_" .. a .. ".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_acacia_" .. a .. ".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 3,
}) })
end end

View file

@ -51,6 +51,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 2,
}) })
-- Rare spruce in Ice Plains -- Rare spruce in Ice Plains
@ -71,6 +72,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_5.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_5.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
-- not supported by spruce leaves _mcl_foliage_palette_index = 2,
}) })
-- Place tall grass on snow in Ice Plains -- Place tall grass on snow in Ice Plains
@ -93,9 +95,10 @@ mcl_mapgen_core.register_decoration({
schematic = { schematic = {
size = vector.new(1, 2, 1), size = vector.new(1, 2, 1),
data = { data = {
{name = "mcl_core:dirt_with_grass", force_place = true, }, {name = "mcl_core:dirt_with_grass", force_place = true, param2 = 10 },
{name = "mcl_flowers:tallgrass", param2 = 10}, {name = "mcl_flowers:tallgrass", param2 = 10},
}, },
}, },
place_y_offset = -1,
}) })

View file

@ -74,6 +74,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_lollipop.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_lollipop.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
-- not supported by spruce leaves _mcl_foliage_palette_index = 2,
}) })
-- Matchstick spruce: Very few leaves, tall trunk -- Matchstick spruce: Very few leaves, tall trunk
@ -94,10 +95,10 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_matchstick.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_matchstick.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
-- not supported by spruce leaves _mcl_foliage_palette_index = 2,
}) })
vl_biomes.register_spruce_decoration(11000, 0.00150, "mcl_core_spruce_5.mts", {"ColdTaiga"}) vl_biomes.register_spruce_decoration(11000, 0.00150, "mcl_core_spruce_5.mts", {"ColdTaiga"})
vl_biomes.register_spruce_decoration(2500, 0.00325, "mcl_core_spruce_1.mts", {"ColdTaiga"}) vl_biomes.register_spruce_decoration(2500, 0.00325, "mcl_core_spruce_1.mts", {"ColdTaiga"})
vl_biomes.register_spruce_decoration(7000, 0.00425, "mcl_core_spruce_3.mts", {"ColdTaiga"}) vl_biomes.register_spruce_decoration(7000, 0.00425, "mcl_core_spruce_3.mts", {"ColdTaiga"})
vl_biomes.register_spruce_decoration(9000, 0.00325, "mcl_core_spruce_4.mts", {"ColdTaiga"}) vl_biomes.register_spruce_decoration(9000, 0.00325, "mcl_core_spruce_4.mts", {"ColdTaiga"})

View file

@ -54,6 +54,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_swamp.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_swamp.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 5,
}) })
-- Lily pad -- Lily pad
@ -75,7 +76,7 @@ for d = 1, lilydepth do
deco_type = "schematic", deco_type = "schematic",
schematic = { schematic = {
size = vector.new(1, height, 1), size = vector.new(1, height, 1),
data = lily_schem, data = table.copy(lily_schem),
}, },
place_on = "mcl_core:dirt", place_on = "mcl_core:dirt",
sidelen = 16, sidelen = 16,

View file

@ -54,6 +54,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_lollipop.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_lollipop.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
-- not supported by spruce leaves _mcl_foliage_palette_index = 10,
}) })
-- Matchstick spruce: Very few leaves, tall trunk -- Matchstick spruce: Very few leaves, tall trunk
@ -74,6 +75,7 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.overworld_max, y_max = vl_biomes.overworld_max,
schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_matchstick.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_spruce_matchstick.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
-- not supported by spruce leaves _mcl_foliage_palette_index = 10,
}) })
-- Common spruce -- Common spruce

View file

@ -88,7 +88,6 @@ vl_biomes.register_spruce_decoration(3000, 0.0008, "mcl_core_spruce_huge_up_1.mt
vl_biomes.register_spruce_decoration(4000, 0.0008, "mcl_core_spruce_huge_up_2.mts", {"MegaTaiga"}) vl_biomes.register_spruce_decoration(4000, 0.0008, "mcl_core_spruce_huge_up_2.mts", {"MegaTaiga"})
vl_biomes.register_spruce_decoration(6000, 0.0008, "mcl_core_spruce_huge_up_3.mts", {"MegaTaiga"}) vl_biomes.register_spruce_decoration(6000, 0.0008, "mcl_core_spruce_huge_up_3.mts", {"MegaTaiga"})
-- Common spruce -- Common spruce
vl_biomes.register_spruce_decoration(2500, 0.00325, "mcl_core_spruce_1.mts", {"MegaTaiga"}) vl_biomes.register_spruce_decoration(2500, 0.00325, "mcl_core_spruce_1.mts", {"MegaTaiga"})
vl_biomes.register_spruce_decoration(7000, 0.00425, "mcl_core_spruce_3.mts", {"MegaTaiga"}) vl_biomes.register_spruce_decoration(7000, 0.00425, "mcl_core_spruce_3.mts", {"MegaTaiga"})

View file

@ -59,6 +59,7 @@ for i = 1, 4 do
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_" .. i .. ".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_" .. i .. ".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 11,
}) })
end end
-- Small “classic” oak (many biomes) -- Small “classic” oak (many biomes)
@ -80,6 +81,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 11,
}) })
-- Spruce -- Spruce
@ -87,3 +89,4 @@ vl_biomes.register_spruce_decoration(11000, 0.000025, "mcl_core_spruce_5.mts", {
vl_biomes.register_spruce_decoration(2500, 0.00005, "mcl_core_spruce_1.mts", {"ExtremeHills"}) vl_biomes.register_spruce_decoration(2500, 0.00005, "mcl_core_spruce_1.mts", {"ExtremeHills"})
vl_biomes.register_spruce_decoration(7000, 0.00005, "mcl_core_spruce_3.mts", {"ExtremeHills"}) vl_biomes.register_spruce_decoration(7000, 0.00005, "mcl_core_spruce_3.mts", {"ExtremeHills"})
vl_biomes.register_spruce_decoration(9000, 0.00005, "mcl_core_spruce_4.mts", {"ExtremeHills"}) vl_biomes.register_spruce_decoration(9000, 0.00005, "mcl_core_spruce_4.mts", {"ExtremeHills"})

View file

@ -58,6 +58,7 @@ for i = 1, 4 do
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_" .. i .. ".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_" .. i .. ".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 11,
}) })
end end
@ -80,6 +81,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 11,
}) })
mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({
@ -100,6 +102,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 11,
}) })
-- Spruce -- Spruce
@ -128,7 +131,7 @@ mcl_mapgen_core.register_decoration({
schematic = { schematic = {
size = vector.new(1, 2, 1), size = vector.new(1, 2, 1),
data = { data = {
{name = "mcl_core:dirt_with_grass", force_place = true, }, {name = "mcl_core:dirt_with_grass", force_place = true, param2 = 8 },
{name = "mcl_flowers:tallgrass", param2 = 8}, {name = "mcl_flowers:tallgrass", param2 = 8},
}, },
}, },

View file

@ -62,6 +62,7 @@ for i = 1, 4 do
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_" .. i .. ".mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_large_" .. i .. ".mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 11,
}) })
end end
-- Small “classic” oak (many biomes) -- Small “classic” oak (many biomes)
@ -83,6 +84,7 @@ mcl_mapgen_core.register_decoration({
schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts", schematic = mod_mcl_core .. "/schematics/mcl_core_oak_classic.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
_mcl_foliage_palette_index = 11,
}) })
-- Spruce -- Spruce