From 1571f2e0d9287a67cbbaaa886a81927ec9fdebc2 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 9 Feb 2021 19:44:54 +0100 Subject: [PATCH 1/5] Change the development target to Minecraft Java 1.12 + Optifine features supported by Minetest --- CONTRIBUTING.md | 2 +- README.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88370f62..f26ccafe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Wow, thank you! :-) But first, some things to note: MineClone 2's development target is to make a free software clone of Minecraft, -***version 1.11***, ***PC edition***. +***version 1.12***, ***PC edition***, *** + Optifine features supported by the Minetest Engine ***. MineClone 2 is maintained by two persons. Namely, kay27 and EliasFleckenstein. You can find us in the Minetest forums (forums.minetest.net), in IRC in the #minetest diff --git a/README.md b/README.md index 12f5658e..c94081bf 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ Minetest to learn more. ## Project description The main goal of **MineClone 2** is to be a clone of Minecraft and to be released as free software. -* **Target of development: Minecraft, PC Edition, version 1.11** (later known as “Java Edition”) +* **Target of development: Minecraft, PC Edition, version 1.12** (later known as “Java Edition”) +* MineClone2 also includes Optifine features supported by the Minetest * Features of later Minecraft versions might sneak in, but they have a low priority * In general, Minecraft is aimed to be cloned as good as Minetest currently permits (no hacks) * Cloning the gameplay has highest priority From 3b196da12f91c5ec095c889beb0008f3ba920a1b Mon Sep 17 00:00:00 2001 From: kay27 Date: Wed, 10 Feb 2021 13:04:49 +0000 Subject: [PATCH 2/5] Speedup placing villages 1/2 (update mcl_tools through Gitea, as direct push doesn't work) --- mods/CORE/mcl_util/init.lua | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 6c63c21a..aedff5ef 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -405,3 +405,53 @@ function mcl_util.get_object_center(obj) pos.y = pos.y + (ymax - ymin) / 2.0 return pos end + +local get_node_emerge_queue = {} +local function ecb_get_far_node(blockpos, action, calls_remaining, param) + if calls_remaining <= 0 and param then + minetest.log("verbose","[mcl_util] ecb done for param = "..param.." node.name="..minetest.get_node(minetest.string_to_pos(param)).name) + get_node_emerge_queue[param] = nil + end +end + +function mcl_util.get_far_node(pos, force) + local node = minetest.get_node(pos) + if node.name ~= "ignore" then + return node + end + + minetest.get_voxel_manip():read_from_map(pos, pos) + node = minetest.get_node(pos) + if node.name ~= "ignore" or not force then + return node + end + + local blockpos = vector.multiply(vector.floor(vector.divide(pos, mcl_vars.MAP_BLOCKSIZE)), mcl_vars.MAP_BLOCKSIZE) + local key = minetest.pos_to_string(blockpos) + + for i=1,2 do -- give engine 2 chances to emerge the data + if not get_node_emerge_queue[key] then + get_node_emerge_queue[key] = 1 + minetest.log("verbose","[mcl_util] emerge during get_far_node("..minetest.pos_to_string(pos).."), key="..key..", blockpos="..minetest.pos_to_string(blockpos)) + minetest.emerge_area(blockpos, vector.add(blockpos, mcl_vars.MAP_BLOCKSIZE-1), ecb_get_far_node, key) + end + + while not get_node_emerge_queue[key] do end + minetest.log("verbose","[mcl_util] emerge finished for node "..minetest.pos_to_string(pos)..", key="..key..", blockpos="..minetest.pos_to_string(blockpos)..", node.name="..mcl_util.get_far_node(pos).name) + + node = minetest.get_node(pos) + if node.name ~= "ignore" then + return node + end + + minetest.get_voxel_manip():read_from_map(pos, pos) + node = minetest.get_node(pos) + if node.name ~= "ignore" or not force then + return node + end + end + + node.name = "air" -- engine continuously returns "ignore" - probably it is a bug + minetest.swap_node(pos, node) -- engine continuously returns "ignore" - probably it is a bug + return node -- engine continuously returns "ignore" - probably it is a bug +end From 1d792a650f9523eb4eec315846c9494068f32565 Mon Sep 17 00:00:00 2001 From: kay27 Date: Wed, 10 Feb 2021 13:07:32 +0000 Subject: [PATCH 3/5] Speedup placing villages 2/2 (update mcl_villages through Gitea, as direct push doesn't work) --- mods/MAPGEN/mcl_villages/buildings.lua | 2 +- mods/MAPGEN/mcl_villages/depends.txt | 1 + mods/MAPGEN/mcl_villages/foundation.lua | 3 +-- mods/MAPGEN/mcl_villages/init.lua | 8 +++---- mods/MAPGEN/mcl_villages/utils.lua | 29 ++++++------------------- 5 files changed, 13 insertions(+), 30 deletions(-) diff --git a/mods/MAPGEN/mcl_villages/buildings.lua b/mods/MAPGEN/mcl_villages/buildings.lua index 6dfa807b..0d58739e 100644 --- a/mods/MAPGEN/mcl_villages/buildings.lua +++ b/mods/MAPGEN/mcl_villages/buildings.lua @@ -4,7 +4,7 @@ ------------------------------------------------------------------------------- function settlements.build_schematic(vm, data, va, pos, building, replace_wall, name) -- get building node material for better integration to surrounding - local platform_material = minetest.get_node_or_nil(pos) + local platform_material = mcl_util.get_far_node(pos, true) if not platform_material then return end diff --git a/mods/MAPGEN/mcl_villages/depends.txt b/mods/MAPGEN/mcl_villages/depends.txt index 9ba29f3e..e9d14ad9 100644 --- a/mods/MAPGEN/mcl_villages/depends.txt +++ b/mods/MAPGEN/mcl_villages/depends.txt @@ -1,3 +1,4 @@ +mcl_util mcl_core mcl_loot mcl_farming? diff --git a/mods/MAPGEN/mcl_villages/foundation.lua b/mods/MAPGEN/mcl_villages/foundation.lua index 15936ef4..98726966 100644 --- a/mods/MAPGEN/mcl_villages/foundation.lua +++ b/mods/MAPGEN/mcl_villages/foundation.lua @@ -52,8 +52,7 @@ function settlements.terraform(settlement_info, pr) else -- write ground local p = {x=pos.x+xi, y=pos.y+yi, z=pos.z+zi} - minetest.forceload_block(p) - local node = minetest.get_node_or_nil(p) + local node = mcl_util.get_far_node(p, true) if node and node.name ~= "air" then minetest.swap_node(p,{name="air"}) end diff --git a/mods/MAPGEN/mcl_villages/init.lua b/mods/MAPGEN/mcl_villages/init.lua index 6413174d..33a21778 100644 --- a/mods/MAPGEN/mcl_villages/init.lua +++ b/mods/MAPGEN/mcl_villages/init.lua @@ -82,6 +82,7 @@ end local mg_name = minetest.get_mapgen_setting("mg_name") if mg_name ~= "singlenode" then minetest.register_on_generated(function(minp, maxp, blockseed) + minetest.log("warning","[mcl_villages] on_generated("..minetest.pos_to_string(minp)..", "..minetest.pos_to_string(maxp)..", "..tostring(blockseed)..")") -- needed for manual and automated settlement building local heightmap = minetest.get_mapgen_object("heightmap") @@ -94,11 +95,8 @@ if mg_name ~= "singlenode" then -- don't build settlements on (too) uneven terrain local height_difference = settlements.evaluate_heightmap(minp, maxp) if height_difference > max_height_difference then return end - - -- new way - slow :((((( - minetest.emerge_area(vector.subtract(minp,24), vector.add(maxp,24), ecb_build_a_settlement, {minp = vector.new(minp), maxp=vector.new(maxp), blockseed=blockseed}) - -- old way - wait 3 seconds: - -- minetest.after(3, ecb_build_a_settlement, nil, 1, 0, {minp = vector.new(minp), maxp=vector.new(maxp), blockseed=blockseed}) + -- we need 'minetest.after' here to exit from emerging thread we probably currently in: + minetest.after(0.1, build_a_settlement_no_delay, vector.new(minp), vector.new(maxp), blockseed) end) end -- manually place villages diff --git a/mods/MAPGEN/mcl_villages/utils.lua b/mods/MAPGEN/mcl_villages/utils.lua index 96d540b5..b02d50c6 100644 --- a/mods/MAPGEN/mcl_villages/utils.lua +++ b/mods/MAPGEN/mcl_villages/utils.lua @@ -51,7 +51,7 @@ function settlements.find_surface(pos) local itter -- count up or down local cnt_max = 200 -- check, in which direction to look for surface - local surface_node = minetest.get_node_or_nil(p6) + local surface_node = mcl_util.get_far_node(p6, true) if surface_node and string.find(surface_node.name,"air") then itter = -1 else @@ -61,31 +61,16 @@ function settlements.find_surface(pos) while cnt < cnt_max do cnt = cnt+1 minetest.forceload_block(p6) - surface_node = minetest.get_node_or_nil(p6) - - if not surface_node then - -- Load the map at pos and try again - minetest.get_voxel_manip():read_from_map(p6, p6) - surface_node = minetest.get_node(p6) - if surface_node.name == "ignore" then - settlements.debug("find_surface1: nil or ignore") - return nil - end + surface_node = mcl_util.get_far_node(p6, true) + if surface_node.name == "ignore" then + settlements.debug("find_surface1: nil or ignore") + return nil end - -- if surface_node == nil or surface_node.name == "ignore" then - -- --return nil - -- local fl = minetest.forceload_block(p6) - -- if not fl then - -- - -- return nil - -- end - -- end - -- -- Check Surface_node and Node above -- if settlements.surface_mat[surface_node.name] then - local surface_node_plus_1 = minetest.get_node_or_nil({ x=p6.x, y=p6.y+1, z=p6.z}) + local surface_node_plus_1 = mcl_util.get_far_node({ x=p6.x, y=p6.y+1, z=p6.z}, true) if surface_node_plus_1 and surface_node and (string.find(surface_node_plus_1.name,"air") or string.find(surface_node_plus_1.name,"snow") or @@ -257,7 +242,7 @@ function settlements.initialize_nodes(settlement_info, pr) for xi = 0,width do for zi = 0,depth do local ptemp = {x=p.x+xi, y=p.y+yi, z=p.z+zi} - local node = minetest.get_node(ptemp) + local node = mcl_util.get_far_node(ptemp, true) if node.name == "mcl_furnaces:furnace" or node.name == "mcl_chests:chest" or node.name == "mcl_anvils:anvil" then From a73f5dabbd68dfbde2ae111aef3bf4bea80e2015 Mon Sep 17 00:00:00 2001 From: kay27 Date: Wed, 10 Feb 2021 15:36:32 +0000 Subject: [PATCH 4/5] Cleanup --- mods/MAPGEN/mcl_villages/init.lua | 1 - mods/MAPGEN/mcl_villages/utils.lua | 1 - 2 files changed, 2 deletions(-) diff --git a/mods/MAPGEN/mcl_villages/init.lua b/mods/MAPGEN/mcl_villages/init.lua index 33a21778..287b4c9b 100644 --- a/mods/MAPGEN/mcl_villages/init.lua +++ b/mods/MAPGEN/mcl_villages/init.lua @@ -82,7 +82,6 @@ end local mg_name = minetest.get_mapgen_setting("mg_name") if mg_name ~= "singlenode" then minetest.register_on_generated(function(minp, maxp, blockseed) - minetest.log("warning","[mcl_villages] on_generated("..minetest.pos_to_string(minp)..", "..minetest.pos_to_string(maxp)..", "..tostring(blockseed)..")") -- needed for manual and automated settlement building local heightmap = minetest.get_mapgen_object("heightmap") diff --git a/mods/MAPGEN/mcl_villages/utils.lua b/mods/MAPGEN/mcl_villages/utils.lua index b02d50c6..c539e7dc 100644 --- a/mods/MAPGEN/mcl_villages/utils.lua +++ b/mods/MAPGEN/mcl_villages/utils.lua @@ -60,7 +60,6 @@ function settlements.find_surface(pos) -- go through nodes an find surface while cnt < cnt_max do cnt = cnt+1 - minetest.forceload_block(p6) surface_node = mcl_util.get_far_node(p6, true) if surface_node.name == "ignore" then settlements.debug("find_surface1: nil or ignore") From 7932f4e47003293d0fb3032e599217c6d6a164d6 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 10 Feb 2021 18:30:58 +0100 Subject: [PATCH 5/5] Disable 3D player preview by default --- mods/HUD/mcl_inventory/creative.lua | 2 +- mods/HUD/mcl_inventory/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 1cebed0c..1ab6eda0 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -331,7 +331,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz -- Show armor and player image local player_preview - if minetest.settings:get_bool("3d_player_preview", true) then + if minetest.settings:get_bool("3d_player_preview") then player_preview = mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "") else local img, img_player diff --git a/mods/HUD/mcl_inventory/init.lua b/mods/HUD/mcl_inventory/init.lua index 05442405..60ed8ba5 100644 --- a/mods/HUD/mcl_inventory/init.lua +++ b/mods/HUD/mcl_inventory/init.lua @@ -65,7 +65,7 @@ local function set_inventory(player, armor_change_only) -- Show armor and player image local player_preview - if minetest.settings:get_bool("3d_player_preview", true) then + if minetest.settings:get_bool("3d_player_preview") then player_preview = mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "") else local img, img_player