Regular decorations for legacy nether(except v6)

minetest supports this now
This commit is contained in:
cora 2022-06-18 21:38:20 +02:00
parent 5b366c692d
commit 41f708e03e
2 changed files with 112 additions and 54 deletions

View file

@ -1499,6 +1499,20 @@ local function register_dimension_biomes()
_mcl_biome_type = "hot", _mcl_biome_type = "hot",
_mcl_palette_index = 17, _mcl_palette_index = 17,
}) })
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand"},
sidelen = 16,
fill_ratio = 10,
biomes = { "Nether" },
y_min = -31000,
y_max = mcl_vars.mg_nether_max,
decoration = "mcl_nether:netherrack",
flags = "all_floors",
param2 = 0,
})
minetest.register_biome({ minetest.register_biome({
name = "SoulsandValley", name = "SoulsandValley",
node_filler = "mcl_nether:netherrack", node_filler = "mcl_nether:netherrack",
@ -4100,6 +4114,51 @@ end
-- Decorations in non-Overworld dimensions -- Decorations in non-Overworld dimensions
local function register_dimension_decorations() local function register_dimension_decorations()
--[[ NETHER ]] --[[ NETHER ]]
--NETHER WASTES (Nether)
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:magma"},
sidelen = 16,
fill_ratio = 0.04,
biomes = {"Nether"},
y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_max - 1,
flags = "all_floors",
decoration = "mcl_fire:eternal_fire",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:netherrack"},
sidelen = 16,
fill_ratio = 0.013,
biomes = {"Nether"},
y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_max - 1,
flags = "all_floors",
decoration = "mcl_mushrooms:mushroom_brown",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:netherrack"},
sidelen = 16,
fill_ratio = 0.012,
biomes = {"Nether"},
y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_max - 1,
flags = "all_floors",
decoration = "mcl_mushrooms:mushroom_red",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:soul_sand"},
sidelen = 16,
fill_ratio = 0.0032,
biomes = {"Nether","SoulsandValley"},
y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_max - 1,
flags = "all_floors",
decoration = "mcl_nether:nether_wart",
})
-- WARPED FOREST -- WARPED FOREST
minetest.register_decoration({ minetest.register_decoration({
@ -4109,7 +4168,7 @@ local function register_dimension_decorations()
fill_ratio = 0.02, fill_ratio = 0.02,
biomes = {"WarpedForest"}, biomes = {"WarpedForest"},
y_min = mcl_vars.mg_lava_nether_max + 1, y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_lava_nether_max - 10, y_max = mcl_vars.mg_nether_max - 10,
flags = "all_floors", flags = "all_floors",
decoration = "mcl_crimson:warped_fungus", decoration = "mcl_crimson:warped_fungus",
}) })

View file

@ -1754,70 +1754,69 @@ else
nether_wart_chance = 170 nether_wart_chance = 170
end end
-- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart -- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart
-- Minetest's API does not support decorations in caves yet. :-( -- (only v6)
local function generate_nether_decorations(minp, maxp, seed) local function generate_nether_decorations(minp, maxp, seed)
local pr_nether = PseudoRandom(seed+667) if mg_name == "v6" then
local pr_nether = PseudoRandom(seed+667)
if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then
return return
end
minetest.log("action", "[mcl_mapgen_core] Nether decorations " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp))
-- TODO: Generate everything based on Perlin noise instead of PseudoRandom
local bpos
local rack = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:netherrack"})
local magma = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:magma"})
local ssand = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:soul_sand"})
-- Helper function to spawn “fake” decoration
local function special_deco(nodes, spawn_func)
for n = 1, #nodes do
bpos = {x = nodes[n].x, y = nodes[n].y + 1, z = nodes[n].z }
spawn_func(bpos)
end end
end minetest.log("action", "[mcl_mapgen_core] Nether decorations " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp))
-- Eternal fire on netherrack -- TODO: Generate everything based on Perlin noise instead of PseudoRandom
special_deco(rack, function(bpos)
-- Eternal fire on netherrack
if pr_nether:next(1,100) <= 3 then
minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"})
end
end)
-- Eternal fire on magma cubes local bpos
special_deco(magma, function(bpos) local rack = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:netherrack"})
if pr_nether:next(1,150) == 1 then local magma = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:magma"})
minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"}) local ssand = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:soul_sand"})
end
end)
-- Mushrooms on netherrack -- Helper function to spawn “fake” decoration
-- Note: Spawned *after* the fire because of light level checks local function special_deco(nodes, spawn_func)
special_deco(rack, function(bpos) for n = 1, #nodes do
local l = minetest.get_node_light(bpos, 0.5) bpos = {x = nodes[n].x, y = nodes[n].y + 1, z = nodes[n].z }
if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then
-- TODO: Make mushrooms appear in groups, use Perlin noise spawn_func(bpos)
if pr_nether:next(1,2) == 1 then
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"})
else
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"})
end end
end end
end) -- Eternal fire on netherrack
special_deco(rack, function(bpos)
-- Eternal fire on netherrack
if pr_nether:next(1,100) <= 3 then
minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"})
end
end)
-- Nether wart on soul sand -- Eternal fire on magma cubes
-- TODO: Spawn in Nether fortresses special_deco(magma, function(bpos)
special_deco(ssand, function(bpos) if pr_nether:next(1,150) == 1 then
if pr_nether:next(1, nether_wart_chance) == 1 then minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"})
minetest.set_node(bpos, {name = "mcl_nether:nether_wart"}) end
end end)
end)
-- Mushrooms on netherrack
-- Note: Spawned *after* the fire because of light level checks
special_deco(rack, function(bpos)
local l = minetest.get_node_light(bpos, 0.5)
if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then
-- TODO: Make mushrooms appear in groups, use Perlin noise
if pr_nether:next(1,2) == 1 then
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"})
else
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"})
end
end
end)
-- Nether wart on soul sand
-- TODO: Spawn in Nether fortresses
special_deco(ssand, function(bpos)
if pr_nether:next(1, nether_wart_chance) == 1 then
minetest.set_node(bpos, {name = "mcl_nether:nether_wart"})
end
end)
end
end end
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.register_on_generated(function(minp, maxp, blockseed)