From 2c7838bdf602852c68ada333f0610c0c8a9caa50 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 11 Sep 2022 02:51:47 +0200 Subject: [PATCH] make the end island slightly larger also uses the mcl_mapgen_core api now --- mods/CORE/mcl_init/init.lua | 2 +- mods/MAPGEN/mcl_end_island/init.lua | 29 +++++++++++------------- mods/MAPGEN/mcl_structures/end_spawn.lua | 7 ++---- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/mods/CORE/mcl_init/init.lua b/mods/CORE/mcl_init/init.lua index b4003e178..bb4a84921 100644 --- a/mods/CORE/mcl_init/init.lua +++ b/mods/CORE/mcl_init/init.lua @@ -163,7 +163,7 @@ mcl_vars.mg_end_min = -27073 -- Carefully chosen to be at a mapchunk border mcl_vars.mg_end_max_official = mcl_vars.mg_end_min + minecraft_height_limit mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000 mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 74, z = 0 } -mcl_vars.mg_end_exit_portal_pos = vector.new(0, mcl_vars.mg_end_min + 72, 0) +mcl_vars.mg_end_exit_portal_pos = vector.new(0, mcl_vars.mg_end_min + 71, 0) -- Realm barrier used to safely separate the End from the void below the Overworld mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max diff --git a/mods/MAPGEN/mcl_end_island/init.lua b/mods/MAPGEN/mcl_end_island/init.lua index 730176257..7637a53f4 100644 --- a/mods/MAPGEN/mcl_end_island/init.lua +++ b/mods/MAPGEN/mcl_end_island/init.lua @@ -1,34 +1,31 @@ +local width = 115 + local noisemap = PerlinNoiseMap({ offset = 0.5, scale = 0.5, - spread = {x = 84, y = 84, z = 84}, + spread = {x = width + 10, y = width + 10, z = width + 10}, seed = minetest.get_mapgen_setting("seed") + 99999, octaves = 4, persist = 0.85, -}, {x = 151, y = 30, z = 151}):get_3d_map({x = 0, y = 0, z = 0}) +}, {x = (width*2)+1, y = 30, z = (width * 2) + 1}):get_3d_map({x = 0, y = 0, z = 0}) local c_end_stone = minetest.get_content_id("mcl_end:end_stone") local y_offset = -2 -minetest.register_on_generated(function(minp, maxp) - if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < -75 or minp.x > 75 or maxp.z < -75 or minp.z > 75 then +mcl_mapgen_core.register_generator("end_island", function(vm, data, data2, emin, emax, area, minp, maxp, blockseed) + if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < -width or minp.x > width or maxp.z < -width or minp.z > width then return end - local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") - local data = vm:get_data() - local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax}) - - for idx in area:iter(math.max(minp.x, -75), math.max(minp.y, -27025 + y_offset + 4), math.max(minp.z, -75), math.min(maxp.x, 75), math.min(maxp.y, -27000 + y_offset), math.min(maxp.z, 75)) do + for idx in area:iter(math.max(minp.x, -width), math.max(minp.y, -27025 + y_offset + 4), math.max(minp.z, -width), math.min(maxp.x, width), math.min(maxp.y, -27000 + y_offset), math.min(maxp.z, width)) do local pos = area:position(idx) local y = 27025 + pos.y - y_offset - if noisemap[pos.x + 75 + 1][y + 1][pos.z + 75 + 1] > (math.abs(1 - y / 25) ^ 2 + math.abs(pos.x / 75) ^ 2 + math.abs(pos.z / 75) ^ 2) then + if noisemap[pos.x + width + 1][y + 1][pos.z + width + 1] > (math.abs(1 - y / 25) ^ 2 + math.abs(pos.x / width) ^ 2 + math.abs(pos.z / width) ^ 2) then data[idx] = c_end_stone end end - - vm:set_data(data) - vm:calc_lighting() - vm:update_liquids() - vm:write_to_map() -end) + --vm:calc_lighting() + --vm:update_liquids() + --vm:write_to_map() + return true,true +end, nil, 15, true) diff --git a/mods/MAPGEN/mcl_structures/end_spawn.lua b/mods/MAPGEN/mcl_structures/end_spawn.lua index f4cc3f90e..3d9f0f961 100644 --- a/mods/MAPGEN/mcl_structures/end_spawn.lua +++ b/mods/MAPGEN/mcl_structures/end_spawn.lua @@ -20,11 +20,7 @@ mcl_structures.register_structure("end_exit_portal",{ after_place = function(pos,def,pr) local p1 = vector.offset(pos,-5,-5,-5) local p2 = vector.offset(pos,5,5,5) - minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param) - if calls_remaining ~= 0 then return end - local nn = minetest.find_nodes_in_area(p1,p2,{"mcl_portals:portal_end"}) - minetest.bulk_set_node(nn,{name="air"}) - end) + minetest.bulk_set_node(minetest.find_nodes_in_area(p1,p2,{"mcl_portals:portal_end"}),{name="air"}) end }) mcl_structures.register_structure("end_exit_portal_open",{ @@ -74,5 +70,6 @@ mcl_structures.register_structure("end_spike",{ minetest.set_node(vector.offset(s,0,1,0),{name="mcl_core:bedrock"}) minetest.add_entity(vector.offset(s,0,2,0),"mcl_end:crystal") end) + return true end, })