From 2be75c962877d3ea82cad03d4672a23ef1abf936 Mon Sep 17 00:00:00 2001 From: MysticTempest Date: Sun, 6 Nov 2022 07:08:49 -0600 Subject: [PATCH 1/3] Better fix for creative digging drops, and fix the itemframes LBM. --- mods/HUD/mcl_inventory/init.lua | 3 +-- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mods/HUD/mcl_inventory/init.lua b/mods/HUD/mcl_inventory/init.lua index 2c7c64860..7ef791c7a 100644 --- a/mods/HUD/mcl_inventory/init.lua +++ b/mods/HUD/mcl_inventory/init.lua @@ -213,8 +213,7 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) if pointed_thing.type ~= "node" then return end local def = minetest.registered_nodes[node.name] if def then - if def.on_destruct then def.on_destruct(pos) end - minetest.dig_node(pos) + minetest.node_dig(pos,def,puncher) return true end end) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index bd78f33e1..75b2d53d8 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -535,12 +535,11 @@ end function mcl_itemframes.custom_register_lbm(name) - -- FIXME: Item entities can get destroyed by /clearobjects - -- glow frame + -- Item entities can get destroyed by /clearobjects; LBM regenerates them. minetest.register_lbm({ label = "Respawn item frame item entities", name = "mcl_itemframes:respawn_entities", - nodenames = { name }, + nodenames = {"mcl_itemframes:item_frame","mcl_itemframes:glow_item_frame"}, run_at_every_load = true, action = function(pos, node) mcl_itemframes.update_item_entity(pos, node) From c277229c1bfa0c7e8700516c4a28fe2e8c7620f0 Mon Sep 17 00:00:00 2001 From: Michieal Date: Sun, 6 Nov 2022 21:00:14 +0000 Subject: [PATCH 2/3] Changed the Item Frames' LBM method. Moved the custom lbm function call out of create_custom_frame() into init. Changed how the custom lbm handles frames lbm regeneration. --- mods/ITEMS/mcl_itemframes/init.lua | 32 +++---------------- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 22 ++++++++++--- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/mods/ITEMS/mcl_itemframes/init.lua b/mods/ITEMS/mcl_itemframes/init.lua index e0c41c1f4..553198c67 100644 --- a/mods/ITEMS/mcl_itemframes/init.lua +++ b/mods/ITEMS/mcl_itemframes/init.lua @@ -14,11 +14,11 @@ mcl_itemframes.backwards_compatibility() -- Define the standard frames. mcl_itemframes.create_custom_frame("false", "item_frame", false, - "mcl_itemframes_item_frame.png", mcl_colors.WHITE, "Item Frame", - "Can hold an item.","") + "mcl_itemframes_item_frame.png", mcl_colors.WHITE, "Can hold an item.", + "Item Frame", "") mcl_itemframes.create_custom_frame("false", "glow_item_frame", true, - "mcl_itemframes_glow_item_frame.png", mcl_colors.WHITE, "Glowing Item Frame", - "Can hold an item and glows.","") + "mcl_itemframes_glow_item_frame.png", mcl_colors.WHITE, "Can hold an item and glows.", + "Glowing Item Frame", "") -- Register the base frame's recipes. -- was going to make it a specialized function, but minetest refuses to play nice. @@ -37,26 +37,4 @@ minetest.register_craft({ recipe = { 'mcl_mobitems:glow_ink_sac', 'mcl_itemframes:item_frame' }, }) ---[[ green frames just for testing -mcl_itemframes.create_custom_frame("false", "my_regular_frame", false, - "mcl_itemframes_item_frame.png", mcl_colors.DARK_GREEN, "A Green frame", - "My Green Frame") -mcl_itemframes.create_custom_frame("false", "my_glowing_frame", true, - "mcl_itemframes_glow_item_frame.png", mcl_colors.DARK_GREEN, "A Green glowing frame", - "My Green glowing Frame") - -minetest.register_craft({ - output = "mcl_itemframes:my_regular_frame", - recipe = { - { "", "mcl_core:stick", "" }, - { "mcl_core:stick", "", "mcl_core:stick" }, - { "", "mcl_core:stick", "" }, - } -}) - -minetest.register_craft({ - type = "shapeless", - output = "mcl_itemframes:my_glowing_frame", - recipe = { "mcl_mobitems:glow_ink_sac", "mcl_itemframes:my_regular_frame" }, -}) ---]] +mcl_itemframes.custom_register_lbm() diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index 75b2d53d8..194f224ef 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -529,17 +529,30 @@ function mcl_itemframes.create_custom_frame(modname, name, has_glow, tiles, colo minetest.register_node(":" .. working_name, custom_itemframe_definition) mcl_itemframes.update_frame_registry(modname, working_name, has_glow) - mcl_itemframes.custom_register_lbm(working_name) + + -- register Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_itemframes:item_frame", "nodes", working_name) + end end -function mcl_itemframes.custom_register_lbm(name) +function mcl_itemframes.custom_register_lbm() + + local registered_frame_nodenames = {} + + for i = 0, #mcl_itemframes.frames_registered.glowing do + table.insert(registered_frame_nodenames, mcl_itemframes.frames_registered.glowing[i]) + end + + for i = 0, #mcl_itemframes.frames_registered.standard do + table.insert(registered_frame_nodenames, mcl_itemframes.frames_registered.standard[i]) + end - -- Item entities can get destroyed by /clearobjects; LBM regenerates them. minetest.register_lbm({ label = "Respawn item frame item entities", name = "mcl_itemframes:respawn_entities", - nodenames = {"mcl_itemframes:item_frame","mcl_itemframes:glow_item_frame"}, + nodenames = { registered_frame_nodenames }, run_at_every_load = true, action = function(pos, node) mcl_itemframes.update_item_entity(pos, node) @@ -561,6 +574,7 @@ function mcl_itemframes.create_base_definitions() mcl_itemframes.item_frame_base = { description = S("Item Frame"), + name = "mcl_itemframes:item_frame", _tt_help = S("Can hold an item"), _doc_items_longdesc = S("Item frames are decorative blocks in which items can be placed."), _doc_items_usagehelp = S("Just place any item on the item frame. Use the item frame again to retrieve the item."), From dd869afea044ddeb09224a5dd3fd0d4ec1ae1077 Mon Sep 17 00:00:00 2001 From: Michieal Date: Mon, 7 Nov 2022 01:20:03 +0000 Subject: [PATCH 3/3] fixed typo error had a list inside of an extra set of {}'s --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index 194f224ef..741e6ce71 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -552,7 +552,7 @@ function mcl_itemframes.custom_register_lbm() minetest.register_lbm({ label = "Respawn item frame item entities", name = "mcl_itemframes:respawn_entities", - nodenames = { registered_frame_nodenames }, + nodenames = registered_frame_nodenames, run_at_every_load = true, action = function(pos, node) mcl_itemframes.update_item_entity(pos, node)