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.
This commit is contained in:
Nils Dagsson Moskopp 2021-06-28 18:59:39 +02:00
parent 926d5e2c37
commit f8c58262bc
No known key found for this signature in database
GPG Key ID: A3BC671C35191080
1 changed files with 16 additions and 0 deletions

View File

@ -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",