From 2a26adac0f39bacf7630ac8520eca1a2c6ce4b08 Mon Sep 17 00:00:00 2001 From: kay27 Date: Wed, 19 Jan 2022 04:53:55 +0400 Subject: [PATCH] Fix End --- mods/CORE/mcl_mapgen/init.lua | 6 +++- mods/MAPGEN/mcl_mapgen_core/init.lua | 29 ++++++++++--------- .../MAPGEN/mcl_structures/end_exit_portal.lua | 28 +++++++++++++----- mods/MAPGEN/mcl_structures/init.lua | 2 +- mods/MAPGEN/mcl_structures/structures.lua | 2 +- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/mods/CORE/mcl_mapgen/init.lua b/mods/CORE/mcl_mapgen/init.lua index e20583312..aa2630411 100644 --- a/mods/CORE/mcl_mapgen/init.lua +++ b/mods/CORE/mcl_mapgen/init.lua @@ -276,9 +276,11 @@ minetest.register_on_generated(function(minp, maxp, chunkseed) vm:set_light_data(light) end if vm_context.write or vm_context.write_param2 or vm_context.write_light then - vm:calc_lighting(minp, maxp, vm_context.shadow or true) -- TODO: check boundaries + vm:calc_lighting(minp, maxp, (vm_context.shadow ~= nil) or true) -- TODO: check boundaries vm:write_to_map() vm:update_liquids() + elseif vm_context.calc_lighting then + vm:calc_lighting(minp, maxp, (vm_context.shadow ~= nil) or true) end end @@ -323,6 +325,8 @@ minetest.register_on_generated(function(minp, maxp, chunkseed) -- vm:calc_lighting(minp, maxp, vm_context.shadow or true) vm:write_to_map() vm:update_liquids() + elseif vm_context.calc_lighting then + vm:calc_lighting(minp, maxp, (vm_context.shadow ~= nil) or true) end current_chunks[i] = nil end diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 3cedac4c0..b259f59f9 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1574,17 +1574,6 @@ local function basic_safe(vm_context) end end - -- Final hackery: Set sun light level in the End. - -- -26912 is at a mapchunk border. - local shadow = true - if minp.y >= -26912 and maxp.y <= mcl_mapgen.end_.max then - vm:set_lighting({day=15, night=15}) - lvm_used = true - end - if minp.y >= mcl_mapgen.end_.min and maxp.y <= -26911 then - shadow = false - lvm_used = true - end if not singlenode then -- Generate special decorations @@ -1593,8 +1582,6 @@ local function basic_safe(vm_context) end vm_context.write = vm_context.write or lvm_used - - return vm_context --, lvm_used, shadow end mcl_mapgen.register_mapgen_block_lvm(basic_safe, 1) @@ -1603,6 +1590,7 @@ local modpath = minetest.get_modpath(minetest.get_current_modname()) dofile(modpath .. "/clay.lua") dofile(modpath .. "/tree_decoration.lua") +-- Nether Roof Light: mcl_mapgen.register_mapgen_block_lvm(function(vm_context) local minp = vm_context.minp local miny = minp.y @@ -1613,4 +1601,19 @@ mcl_mapgen.register_mapgen_block_lvm(function(vm_context) local p1 = {x = minp.x, y = math.max(miny, mcl_mapgen.nether.max + 1), z = minp.z} local p2 = {x = maxp.x, y = math.min(maxy, mcl_mapgen.nether.max + 127), z = maxp.z} vm_context.vm:set_lighting({day=15, night=15}, p1, p2) + vm_context.write = true end, 999999999) + +-- End Light: +mcl_mapgen.register_mapgen_block_lvm(function(vm_context) + local minp = vm_context.minp + local miny = minp.y + if miny > mcl_mapgen.end_.max then return end + local maxp = vm_context.maxp + local maxy = maxp.y + if maxy <= mcl_mapgen.end_.min then return end + local p1 = {x = minp.x, y = math.max(miny, mcl_mapgen.end_.min), z = maxp.z} + local p2 = {x = maxp.x, y = math.min(maxy, mcl_mapgen.end_.max), z = maxp.z} + vm_context.vm:set_lighting({day=15, night=15}, p1, p2) + vm_context.write = true +end, 9999999999) diff --git a/mods/MAPGEN/mcl_structures/end_exit_portal.lua b/mods/MAPGEN/mcl_structures/end_exit_portal.lua index e5d8dc380..4deea1bc1 100644 --- a/mods/MAPGEN/mcl_structures/end_exit_portal.lua +++ b/mods/MAPGEN/mcl_structures/end_exit_portal.lua @@ -4,7 +4,7 @@ local modpath = minetest.get_modpath(modname) local END_EXIT_PORTAL_POS_X = -3 local END_EXIT_PORTAL_POS_Y = -27003 local END_EXIT_PORTAL_POS_Z = -3 -local p = { +local p0 = { x = END_EXIT_PORTAL_POS_X, y = END_EXIT_PORTAL_POS_Y, z = END_EXIT_PORTAL_POS_Z, @@ -19,15 +19,17 @@ end mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context) local minp = minp local y1 = minp.y - if y1 < END_EXIT_PORTAL_POS_Y then return end + if y1 > END_EXIT_PORTAL_POS_Y then return end local maxp = maxp local y2 = maxp.y - if y2 > END_EXIT_PORTAL_POS_Y then return end - if minp.x < END_EXIT_PORTAL_POS_X then return end - if maxp.x > END_EXIT_PORTAL_POS_X then return end - if minp.z < END_EXIT_PORTAL_POS_Z then return end - if maxp.z > END_EXIT_PORTAL_POS_Z then return end - + if y2 < END_EXIT_PORTAL_POS_Y then return end + if minp.x > END_EXIT_PORTAL_POS_X then return end + if maxp.x < END_EXIT_PORTAL_POS_X then return end + if minp.z > END_EXIT_PORTAL_POS_Z then return end + if maxp.z < END_EXIT_PORTAL_POS_Z then return end + + local p = table.copy(p0) + for y = y2, y1, -1 do p.y = y if minetest.get_node(p).name == "mcl_end:end_stone" then @@ -35,6 +37,16 @@ mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context) return end end + + for y = y2, y1, -1 do + p.y = y + if minetest.get_node(p).name ~= "air" then + place(p, "0", PseudoRandom(vm_content.chunkseed)) + return + end + end + + place(p0, "0", PseudoRandom(vm_content.chunkseed)) end) mcl_structures.register_structure({name = "end_exit_portal", place_function = place}) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index c43640fd1..64f6db937 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -159,7 +159,7 @@ function mcl_structures.register_structure(def) local decoration_id if decoration then minetest.register_node(':' .. name, { - -- drawtype = "airlike", + drawtype = "airlike", sunlight_propagates = true, pointable = false, walkable = false, diff --git a/mods/MAPGEN/mcl_structures/structures.lua b/mods/MAPGEN/mcl_structures/structures.lua index b18904d9a..fd6b21b26 100644 --- a/mods/MAPGEN/mcl_structures/structures.lua +++ b/mods/MAPGEN/mcl_structures/structures.lua @@ -11,7 +11,7 @@ if not mcl_mapgen.singlenode then dofile(modpath .. "/ice_spike_large.lua") dofile(modpath .. "/jungle_temple.lua") dofile(modpath .. "/nice_jungle_temple.lua") - dofile(modpath .. "/noise_indicator.lua") + -- dofile(modpath .. "/noise_indicator.lua") dofile(modpath .. "/stronghold.lua") dofile(modpath .. "/witch_hut.lua") end