From 5f5796330f89e42eea07fbb79ec69c4017478160 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 12 Feb 2022 15:39:36 +0100 Subject: [PATCH] Add LBM to fix MineClone2 <0.71 Nether roof void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Older versions of the MineClone2 map generator generated void nodes on the Nether roof. These nodes prevented building there and allow players to “chunktrail”, i.e. finding explored areas by going along old chunks. This patch adds an LBM and a setting to activate it (default is false). The LBM replaces void nodes on the Nether roof with air. This can cause lag while the affected areas are being fixed. For this reason the LBM is disabled by default. Note that the LBM is only useful if a world had the Nether roof generated in MineClone2 <0.71; new worlds have no roof void. There are probably better ways to fix the Nether roof, but this does work and is a full solution to the problem, as the lag is temporary. --- mods/MAPGEN/mcl_mapgen_core/init.lua | 28 +++++++++++++++++++++++++++- settingtypes.txt | 5 +++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 05c88cf5..965a46f5 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1,4 +1,9 @@ -mcl_mapgen_core = {} +mcl_mapgen_core = { + replace_nether_roof_void_with_air = minetest.settings:get_bool( + "mcl_mapgen_core_replace_nether_roof_void_with_air", + false + ) +} mcl_mapgen_core.registered_generators = {} local lvm, nodes, param2 = 0, 0, 0 @@ -2296,3 +2301,24 @@ function mcl_mapgen_core.get_node(p, force, us_timeout) return node -- it still can return "ignore", LOL, even if force = true, but only after time out end + + +if mcl_mapgen_core.replace_nether_roof_void_with_air then + minetest.register_lbm({ + label = "Replace Nether roof void from MineClone2 <0.71 with air", + name = "mcl_mapgen_core:replace_nether_roof_void_with_air", + nodenames = { "mcl_core:void" }, + run_at_every_load = false, + action = function(pos, node) + if ( + pos.y >= mcl_vars.mg_bedrock_nether_top_max and + pos.y <= mcl_vars.mg_nether_max + ) then + minetest.swap_node( + pos, + { name="air" } + ) + end + end, + }) +end diff --git a/settingtypes.txt b/settingtypes.txt index cd8201ac..0fa21993 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -152,3 +152,8 @@ basic_pseudobiome_villages (Enables very basic, and experimental "pseudobiome-ba # If enabled, will run an LBM to fix the top 1/2 of double plants in mcimported worlds; defaults to true. fix_doubleplants (Mcimport double plant fixes) bool true + +# If enabled, will run an LBM to replace void nodes on the Nether roof generated by MineClone2 <0.71 with air. +# Activate this setting if you generated some Nether in MineClone2 <0.71 and want to build on the Nether roof. +# WARNING: This setting has quite poor performance and may lag Minetest while affected areas are being fixed. +mcl_mapgen_core_replace_nether_roof_void_with_air (Replace Nether roof void from MineClone2 <0.71 with air) bool false