From 98dad0b191244b4dddedfc638a50f09869f5c88f Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 27 Oct 2022 19:34:58 +0200 Subject: [PATCH] Generate netherrack under the bedrock ceiling this is a somewhat ugly hack that uses minetest.generate_decorations which generates decorations regardless of biome so additional steps had to be taken to ensure no other decorations "spill over" due to this. --- mods/CORE/mcl_init/init.lua | 1 + mods/MAPGEN/mcl_biomes/init.lua | 33 +++++++++++++++++++++------- mods/MAPGEN/mcl_mapgen_core/api.lua | 10 ++++++--- mods/MAPGEN/mcl_mapgen_core/init.lua | 7 ++++-- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/mods/CORE/mcl_init/init.lua b/mods/CORE/mcl_init/init.lua index 6773949b7..3acce957f 100644 --- a/mods/CORE/mcl_init/init.lua +++ b/mods/CORE/mcl_init/init.lua @@ -138,6 +138,7 @@ mcl_vars.mg_nether_min = -29067 -- Carefully chosen to be at a mapchunk border mcl_vars.mg_nether_max = mcl_vars.mg_nether_min + 128 mcl_vars.mg_bedrock_nether_bottom_min = mcl_vars.mg_nether_min mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max +mcl_vars.mg_nether_deco_max = mcl_vars.mg_nether_max -11 -- this is so ceiling decorations don't spill into other biomes as bedrock generation calls minetest.generate_decorations to put netherrack under the bedrock if not superflat then mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4 mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4 diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 8da0caa3d..789c4cc81 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -1531,6 +1531,23 @@ local function register_dimension_biomes() --[[ REALMS ]] --[[ THE NETHER ]] + -- the following decoration is a hack to cover exposed bedrock in netherrack - be careful not to put any ceiling decorations in a way that would apply to this (they would get generated regardless of biome) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"mcl_core:bedrock"}, + sidelen = 16, + fill_ratio = 10, + biomes = { "Nether" }, + y_min = mcl_vars.mg_lava_nether_max, + y_max = mcl_vars.mg_nether_max + 15, + height = 6, + max_height = 10, + decoration = "mcl_nether:netherrack", + flags = "all_ceilings", + param2 = 0, + }) + + minetest.register_biome({ name = "Nether", node_filler = "mcl_nether:netherrack", @@ -1554,7 +1571,7 @@ local function register_dimension_biomes() fill_ratio = 10, biomes = { "Nether" }, y_min = -31000, - y_max = mcl_vars.mg_nether_max, + y_max = mcl_vars.mg_nether_deco_max, decoration = "mcl_nether:netherrack", flags = "all_floors", param2 = 0, @@ -1583,7 +1600,7 @@ local function register_dimension_biomes() fill_ratio = 10, biomes = { "SoulsandValley" }, y_min = -31000, - y_max = mcl_vars.mg_nether_max, + y_max = mcl_vars.mg_nether_deco_max, decoration = "mcl_blackstone:soul_soil", flags = "all_floors, all_ceilings", param2 = 0, @@ -1598,7 +1615,7 @@ local function register_dimension_biomes() clust_size = 15, biomes = { "SoulsandValley" }, y_min = mcl_vars.mg_nether_min, - y_max = mcl_vars.mg_nether_max + 80, + y_max = mcl_vars.mg_nether_deco_max, noise_params = { offset = 0, scale = 1, @@ -1633,7 +1650,7 @@ local function register_dimension_biomes() fill_ratio = 10, biomes = { "CrimsonForest" }, y_min = -31000, - y_max = mcl_vars.mg_nether_max, + y_max = mcl_vars.mg_nether_deco_max, decoration = "mcl_crimson:crimson_nylium", flags = "all_floors", param2 = 0, @@ -1660,7 +1677,7 @@ local function register_dimension_biomes() fill_ratio = 10, biomes = { "WarpedForest" }, y_min = -31000, - y_max = mcl_vars.mg_nether_max, + y_max = mcl_vars.mg_nether_deco_max, decoration = "mcl_crimson:warped_nylium", flags = "all_floors", param2 = 0, @@ -1688,7 +1705,7 @@ local function register_dimension_biomes() fill_ratio = 10, biomes = { "BasaltDelta" }, y_min = -31000, - y_max = mcl_vars.mg_nether_max, + y_max = mcl_vars.mg_nether_deco_max, decoration = "mcl_blackstone:basalt", flags = "all_floors", param2 = 0, @@ -1703,7 +1720,7 @@ local function register_dimension_biomes() clust_size = 20, biomes = { "BasaltDelta" }, y_min = mcl_vars.mg_nether_min, - y_max = mcl_vars.mg_nether_max + 80, + y_max = mcl_vars.mg_nether_deco_max, noise_params = { offset = 0, scale = 1, @@ -4903,7 +4920,7 @@ local function register_dimension_decorations() fill_ratio = 0.063, biomes = {"CrimsonForest"}, y_min = mcl_vars.mg_lava_nether_max + 1, - y_max = mcl_vars.mg_nether_max -5, + y_max = mcl_vars.mg_nether_deco_max, flags = "all_ceilings", height = 2, height_max = 8, diff --git a/mods/MAPGEN/mcl_mapgen_core/api.lua b/mods/MAPGEN/mcl_mapgen_core/api.lua index 7e05afe12..356950851 100644 --- a/mods/MAPGEN/mcl_mapgen_core/api.lua +++ b/mods/MAPGEN/mcl_mapgen_core/api.lua @@ -15,7 +15,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed) local t1 = os.clock() local p1, p2 = {x=minp.x, y=minp.y, z=minp.z}, {x=maxp.x, y=maxp.y, z=maxp.z} if lvm > 0 then - local lvm_used, shadow, deco_used = false, false, false + local lvm_used, shadow, deco_used, deco_table = false, false, false, false local lb2 = {} -- param2 local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") local e1, e2 = {x=emin.x, y=emin.y, z=emin.z}, {x=emax.x, y=emax.y, z=emax.z} @@ -35,7 +35,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed) if shadow0 then shadow = true end - if deco then + if deco and type(deco) == "table" then + deco_table = deco + elseif deco then deco_used = true end end @@ -47,7 +49,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed) if param2 > 0 then vm:set_param2_data(data2) end - if deco_used then + if deco_table then + minetest.generate_decorations(vm,vector.new(minp.x,deco_table.min,minp.z),vector.new(maxp.x,deco_table.max,maxp.z)) + elseif deco_used then minetest.generate_decorations(vm) end vm:calc_lighting(p1, p2, shadow) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 724c576a9..ba1f053c9 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -325,8 +325,11 @@ local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, bl lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, minp, maxp, lvm_used, pr) end end - - return lvm_used, lvm_used + local deco = false + if minp.y > mcl_vars.mg_nether_deco_max - 64 and maxp.y < mcl_vars.mg_nether_max + 128 then + deco = {min=mcl_vars.mg_nether_deco_max,max=mcl_vars.mg_nether_max} + end + return lvm_used, lvm_used, deco end local function block_fixes(vm, data, data2, emin, emax, area, minp, maxp, blockseed)