From c09ed0280102f11773448a007429930a658bf25f Mon Sep 17 00:00:00 2001 From: Michieal Date: Fri, 16 Dec 2022 05:24:54 +0000 Subject: [PATCH] A more elegant solution for slabs After a good bit of trial and error, and asking questions... I have rewritten the override code and it works. (tested, slabs can now be used to make composters and barrels with this method.) --- mods/ITEMS/mcl_bamboo/init.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_bamboo/init.lua b/mods/ITEMS/mcl_bamboo/init.lua index ce6ba02c1d..cf141272a9 100644 --- a/mods/ITEMS/mcl_bamboo/init.lua +++ b/mods/ITEMS/mcl_bamboo/init.lua @@ -344,8 +344,7 @@ local function create_nodes() -- let's add plank slabs to the wood_slab group. local bamboo_plank_slab = "mcl_stairs:slab_bamboo_plank" - local node_def_plank_slab_def = minetest.registered_nodes[bamboo_plank_slab] - node_def_plank_slab_def.groups = { + local node_groups = { wood_slab = 1, building_block = 1, slab = 1, @@ -354,13 +353,7 @@ local function create_nodes() stair = 1 } - if DEBUG then - minetest.log("Plank_Slab definition: \n" .. dump(node_def_plank_slab_def)) - end - - -- A necessary evil, to add a single group to an already registered node. (And yes, I did try override_item()) - minetest.unregister_item(node_def_plank_slab_def.name) - minetest.register_node(":"..node_def_plank_slab_def.name, node_def_plank_slab_def) + minetest.override_item(bamboo_plank_slab, {groups = node_groups}) end end end