From 9d171a6b7ba7dff7f97b0f14d3c72ab38cd2648e Mon Sep 17 00:00:00 2001 From: kay27 Date: Wed, 12 Jan 2022 04:02:56 +0400 Subject: [PATCH] Fix Nether roof light --- mods/CORE/mcl_mapgen/API.md | 2 +- mods/MAPGEN/mcl_mapgen_core/init.lua | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_mapgen/API.md b/mods/CORE/mcl_mapgen/API.md index bcd6d2f8f..fed1fd1d8 100644 --- a/mods/CORE/mcl_mapgen/API.md +++ b/mods/CORE/mcl_mapgen/API.md @@ -25,7 +25,7 @@ See https://git.minetest.land/MineClone2/MineClone2/issues/1395 `vm_context.data2 = vm_context.data2 or vm_context.vm.get_param2_data(vm_context.lvm_param2_buffer)` `write_param2`: set it to true in your lvm callback function, if you used `data2` and want to write it; `light`: LVM buffer data array of light, !NO ANY DATA LOADS INTO IT BEFORE THE CALLBACKS! - you load it yourself: - `vm_context.light = vm_context.light or vm_context.vm.get_light2_data(vm_context.lvm_light_buffer)` + `vm_context.light = vm_context.light or vm_context.vm.get_light_data(vm_context.lvm_light_buffer)` `write_light`: set it to true in your lvm callback function, if you used `light` and want to write it; `lvm_param2_buffer`: static `param2` buffer pointer, used to load `data2` array; `shadow`: set it to false to disable shadow propagation; diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index e50a2d4d4..f36bf8b9a 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1832,3 +1832,15 @@ dofile(modpath .. "/clay.lua") if minetest.get_modpath("mcl_structures") then dofile(modpath .. "/structures.lua") end + +mcl_mapgen.register_mapgen_block_lvm(function(vm_context) + local minp = vm_context.minp + local miny = minp.y + if miny > mcl_mapgen.nether.max+127 then return end + local maxp = vm_context.maxp + local maxy = maxp.y + if maxy <= mcl_mapgen.nether.max then return end + 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) +end, 999999999)