From 78703d2baa6e80e48c9c6e55479a1ac8b1a495e5 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 13 Sep 2022 02:37:48 +0200 Subject: [PATCH] Fix lighting issues in the end --- mods/MAPGEN/mcl_biomes/init.lua | 4 ++-- mods/MAPGEN/mcl_end_island/init.lua | 15 +++++++++------ mods/MAPGEN/mcl_end_island/mod.conf | 2 +- mods/MAPGEN/mcl_mapgen_core/init.lua | 2 +- mods/MAPGEN/mcl_structures/api.lua | 2 +- mods/MAPGEN/mcl_structures/end_city.lua | 14 +++++++------- mods/MAPGEN/mcl_structures/end_spawn.lua | 10 ++++++++-- 7 files changed, 29 insertions(+), 20 deletions(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 78b81690a..4aa843053 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -5038,7 +5038,7 @@ local function register_dimension_decorations() decoration = "mcl_end:chorus_plant", height = 1, height_max = 8, - biomes = { "End", "EndIsland", "EndMidlands", "EndHighlands", "EndBarrens", "EndSmallIslands" }, + biomes = { "End", "EndMidlands", "EndHighlands", "EndBarrens", "EndSmallIslands" }, }) minetest.register_decoration({ name = "mcl_biomes:chorus_plant", @@ -5059,7 +5059,7 @@ local function register_dimension_decorations() y_max = mcl_vars.mg_end_max, decoration = "mcl_end:chorus_flower", height = 1, - biomes = { "End", "EndIsland", "EndMidlands", "EndHighlands", "EndBarrens", "EndSmallIslands" }, + biomes = { "End", "EndMidlands", "EndHighlands", "EndBarrens", "EndSmallIslands" }, }) deco_id_chorus_plant = minetest.get_decoration_id("mcl_biomes:chorus_plant") diff --git a/mods/MAPGEN/mcl_end_island/init.lua b/mods/MAPGEN/mcl_end_island/init.lua index ac76b1197..499afe369 100644 --- a/mods/MAPGEN/mcl_end_island/init.lua +++ b/mods/MAPGEN/mcl_end_island/init.lua @@ -24,14 +24,17 @@ mcl_mapgen_core.register_generator("end_island", function(vm, data, data2, emin, data[idx] = c_end_stone end end - return true,false,true + return true,false,false end, function(minp,maxp,blockseed) - local nn = minetest.find_nodes_in_area(minp,maxp,{"mcl_end:chorus_flower"}) + 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 nn = minetest.find_nodes_in_area_under_air(minp,maxp,{"mcl_end:end_stone"}) local pr = PseudoRandom(blockseed) - for _,pos in pairs(nn) do - local x, y, z = pos.x, pos.y, pos.z - if x < -10 or x > 10 or z < -10 or z > 10 then - mcl_end.grow_chorus_plant(pos,{name="mcl_end:chorus_flower"},pr) + table.shuffle(nn) + if nn and #nn > 0 then + for i=1,pr:next(1,math.min(5,#nn)) do + minetest.add_entity(vector.offset(nn[i],0,1,0),"mobs_mc:enderman") end end end, 15, true) diff --git a/mods/MAPGEN/mcl_end_island/mod.conf b/mods/MAPGEN/mcl_end_island/mod.conf index 90432792c..1d39622d6 100644 --- a/mods/MAPGEN/mcl_end_island/mod.conf +++ b/mods/MAPGEN/mcl_end_island/mod.conf @@ -1,4 +1,4 @@ name = mcl_end_island author = Fleckenstein -depends = mcl_mapgen_core, mcl_end +depends = mcl_mapgen_core, mcl_end, mcl_mobs description = Generate the end main island for MCL2 diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 2b2e988a5..5a3e2d5fb 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -343,7 +343,6 @@ local function end_basic(vm, data, data2, emin, emax, area, minp, maxp, blocksee end end end - vm:set_lighting({day=15, night=15}) return true, false end @@ -373,6 +372,7 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do local realpos = vector.offset(pos,0,1,0) minetest.remove_node(realpos) + minetest.fix_light(vector.offset(pos,-1,-1,-1),vector.offset(pos,1,3,1)) if struct.chunk_probability == nil or (not has and pr:next(1,struct.chunk_probability) == 1 ) then mcl_structures.place_structure(realpos,struct,pr,blockseed) has=true diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 840d8a20e..53acbb08f 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -230,7 +230,7 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) - minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) + minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups,sunlight_propagates = true,}) def.structblock = structblock def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) minetest.set_gen_notify({decoration=true}, { def.deco_id }) diff --git a/mods/MAPGEN/mcl_structures/end_city.lua b/mods/MAPGEN/mcl_structures/end_city.lua index bf937c7f7..942d81366 100644 --- a/mods/MAPGEN/mcl_structures/end_city.lua +++ b/mods/MAPGEN/mcl_structures/end_city.lua @@ -18,12 +18,12 @@ end mcl_structures.register_structure("end_shipwreck",{ place_on = {"mcl_end:end_stone"}, - fill_ratio = 0.01, + fill_ratio = 0.001, flags = "place_center_x, place_center_z, all_floors", y_offset = function(pr) return pr:next(-50,-20) end, - chunk_probability = 1900, - y_max = mcl_vars.mg_end_max, - y_min = mcl_vars.mg_end_min -100, + chunk_probability = 800, + --y_max = mcl_vars.mg_end_max, + --y_min = mcl_vars.mg_end_min -100, biomes = { "End", "EndHighlands", "EndMidlands", "EndBarrens", "EndSmallIslands" }, sidelen = 32, filenames = { @@ -91,9 +91,9 @@ mcl_structures.register_structure("end_boat",{ fill_ratio = 0.01, flags = "place_center_x, place_center_z, all_floors", y_offset = function(pr) return pr:next(15,30) end, - chunk_probability = 1200, - y_max = mcl_vars.mg_end_max, - y_min = mcl_vars.mg_end_min -100, + chunk_probability = 900, + --y_max = mcl_vars.mg_end_max, + --y_min = mcl_vars.mg_end_min -100, biomes = { "End", "EndHighlands", "EndMidlands", "EndBarrens", "EndSmallIslands" }, sidelen = 20, filenames = { diff --git a/mods/MAPGEN/mcl_structures/end_spawn.lua b/mods/MAPGEN/mcl_structures/end_spawn.lua index 9f7237e72..e3048804c 100644 --- a/mods/MAPGEN/mcl_structures/end_spawn.lua +++ b/mods/MAPGEN/mcl_structures/end_spawn.lua @@ -18,8 +18,8 @@ mcl_structures.register_structure("end_exit_portal",{ modpath.."/schematics/mcl_structures_end_exit_portal.mts" }, after_place = function(pos,def,pr,blockseed) - local p1 = vector.offset(pos,-5,-5,-5) - local p2 = vector.offset(pos,5,5,5) + local p1 = vector.offset(pos,-16,-16,-16) + local p2 = vector.offset(pos,16,16,16) minetest.bulk_set_node(minetest.find_nodes_in_area(p1,p2,{"mcl_portals:portal_end"}),{name="air"}) local obj = minetest.add_entity(vector.offset(pos,3, 11, 3), "mobs_mc:enderdragon") if obj then @@ -31,12 +31,18 @@ mcl_structures.register_structure("end_exit_portal",{ else minetest.log("error", "[mcl_mapgen_core] ERROR! Ender dragon doesn't want to spawn") end + minetest.fix_light(p1,p2) end }) mcl_structures.register_structure("end_exit_portal_open",{ filenames = { modpath.."/schematics/mcl_structures_end_exit_portal.mts" }, + after_place = function(pos,def,pr) + local p1 = vector.offset(pos,-16,-16,-16) + local p2 = vector.offset(pos,16,16,16) + minetest.fix_light(p1,p2) + end }) mcl_structures.register_structure("end_gateway_portal",{ filenames = {