diff --git a/mod.conf b/mod.conf index 6f0ba15..4682cbd 100644 --- a/mod.conf +++ b/mod.conf @@ -2,5 +2,5 @@ name = xdecor title = X-Decor-libre description = A decoration mod meant to be simple and well-featured (libre version). depends = default, bucket, doors, farming, stairs, xpanes -optional_depends = playerphysics, player_api, fire, moreblocks, mesecons, unified_inventory, tt +optional_depends = playerphysics, player_api, fire, moreblocks, mesecons, unified_inventory, tt, toolranks min_minetest_version = 5.7.0 diff --git a/src/enchanting.lua b/src/enchanting.lua index 5a69643..ef357cf 100644 --- a/src/enchanting.lua +++ b/src/enchanting.lua @@ -309,7 +309,8 @@ function enchanting:register_tools(mod, def) local arg1 = def.material_desc[material] or cap(material) local arg2 = def.tools[tool].desc or cap(tool) local arg3 = self:get_tooltip(enchant, original_groupcaps[group], fleshy) - minetest.register_tool(":" .. mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant, { + local enchantedTool = mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant + minetest.register_tool(":" .. enchantedTool, { description = S("Enchanted @1 @2\n@3", arg1, arg2, arg3), short_description = S("Enchanted @1 @2", arg1, arg2), inventory_image = original_tool.inventory_image .. "^[colorize:violet:50", @@ -321,6 +322,9 @@ function enchanting:register_tools(mod, def) max_drop_level = max_drop_level } }) + if minetest.get_modpath("toolranks") then + toolranks.add_tool(enchantedTool) + end end end end