From 9b8d6c4cece92846805073790c65559817698198 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 6 Jan 2020 16:49:22 +0100 Subject: [PATCH] Destroy end portal when surrounding bedrock goes --- mods/ITEMS/mcl_portals/portal_end.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mods/ITEMS/mcl_portals/portal_end.lua b/mods/ITEMS/mcl_portals/portal_end.lua index 0b13a32107..6a0189c9d1 100644 --- a/mods/ITEMS/mcl_portals/portal_end.lua +++ b/mods/ITEMS/mcl_portals/portal_end.lua @@ -6,6 +6,21 @@ local SPAWN_MAX = mcl_vars.mg_end_min+98 local mg_name = minetest.get_mapgen_setting("mg_name") +local destroy_portal = function(pos) + local neighbors = { + { x=1, y=0, z=0 }, + { x=-1, y=0, z=0 }, + { x=0, y=0, z=1 }, + { x=0, y=0, z=-1 }, + } + for n=1, #neighbors do + local npos = vector.add(pos, neighbors[n]) + if minetest.get_node(npos).name == "mcl_portals:portal_end" then + minetest.remove_node(npos) + end + end +end + -- End portal minetest.register_node("mcl_portals:portal_end", { description = S("End Portal"), @@ -46,6 +61,7 @@ minetest.register_node("mcl_portals:portal_end", { light_source = 14, post_effect_color = {a = 192, r = 0, g = 0, b = 0}, alpha = 192, + after_destruct = destroy_portal, -- This prevents “falling through” collision_box = { type = "fixed", @@ -398,4 +414,7 @@ minetest.override_item("mcl_end:ender_eye", { return itemstack end, }) +minetest.override_item("mcl_core:bedrock", { + after_destruct = destroy_portal, +})