From f8c58262bc024659eb3ba53dbc006a917054ba7f Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 28 Jun 2021 18:59:39 +0200 Subject: [PATCH] Fix Ender chests from MineClone2 Commit 819dbc6224c3b96ad4094cccf3d9150f3ef61d45 of MineClone2 introduced an LBM that removed Ender chest formspecs stored in the node meta. That change makes Ender chests that were loaded in MineClone2 versions past that commit not show the Ender chest inventory form on right-click. This patch makes those broken Ender chests work by introducing an LBM that writes the formspec to the node meta for Ender chest nodes once. Since the LBM name is suffixed with a hash of the Ender chest formspec, changes to the Ender chest formspec (even removing it entirely) should not require manual adjustment of the LBM code. --- mods/ITEMS/mcl_chests/init.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index 852a47fe..2aaab2ee 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -1401,6 +1401,22 @@ minetest.register_lbm({ end, }) +-- The following LBM allows the Ender chests from MineClone2 post-0.71 +-- (after commit 819dbc6224c3b96ad4094cccf3d9150f3ef61d45) to work in +-- Mineclonia. It also ensures that any Ender chest formspec changes +-- (even a removal of the formspec) get applied in future versions. +minetest.register_lbm({ + label = "Update ender chest formspecs (MineClone2 compatibility)", + name = "mcl_chests:update_ender_chest_formspecs_" .. + minetest.sha1(formspec_ender_chest), + nodenames = { "mcl_chests:ender_chest_small" }, + run_at_every_load = false, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", formspec_ender_chest) + end, +}) + minetest.register_lbm({ label = "Update shulker box formspecs (0.60.0)", name = "mcl_chests:update_shulker_box_formspecs_0_60_0",