From 66eb5c35da5126fea9ff5b8876855a8a442a04a2 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Fri, 18 Dec 2020 15:57:52 +0100 Subject: [PATCH] Fix enchanted book --- mods/ITEMS/mcl_enchanting/engine.lua | 7 ++++--- mods/ITEMS/mcl_enchanting/init.lua | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index c5e93c4428..0746d211a7 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -2,7 +2,7 @@ local S = minetest.get_translator("mcl_enchanting") local F = minetest.formspec_escape function mcl_enchanting.is_book(itemname) - return itemname == "mcl_books:book" or itemname == "mcl_enchanting:book_enchanted" + return itemname == "mcl_books:book" or itemname == "mcl_enchanting:book_enchanted" or itemname == "mcl_books:book_enchanted" end function mcl_enchanting.get_enchantments(itemstack) @@ -147,7 +147,8 @@ function mcl_enchanting.combine(itemstack, combine_with) local itemname = itemstack:get_name() local combine_name = combine_with:get_name() local enchanted_itemname = mcl_enchanting.get_enchanted_itemstring(itemname) - if enchanted_itemname ~= mcl_enchanting.get_enchanted_itemstring(combine_name) and not mcl_enchanting.is_book(itemname) then + if enchanted_itemname ~= mcl_enchanting.get_enchanted_itemstring(combine_name) and not mcl_enchanting.is_book(combine_name) then + print(combine_name, mcl_enchanting.is_book(combine_name)) return false end local enchantments = mcl_enchanting.get_enchantments(itemstack) @@ -211,7 +212,7 @@ function mcl_enchanting.initialize() local register_tool_list = {} local register_item_list = {} for itemname, itemdef in pairs(minetest.registered_items) do - if mcl_enchanting.can_enchant_freshly(itemname) then + if mcl_enchanting.can_enchant_freshly(itemname) and not mcl_enchanting.is_book(itemname) then local new_name = itemname .. "_enchanted" minetest.override_item(itemname, {_mcl_enchanting_enchanted_tool = new_name}) local new_def = table.copy(itemdef) diff --git a/mods/ITEMS/mcl_enchanting/init.lua b/mods/ITEMS/mcl_enchanting/init.lua index 8e72cf7824..f5b5b86449 100644 --- a/mods/ITEMS/mcl_enchanting/init.lua +++ b/mods/ITEMS/mcl_enchanting/init.lua @@ -143,6 +143,8 @@ minetest.register_craftitem("mcl_enchanting:book_enchanted", { stack_max = 1, }) +minetest.register_alias("mcl_books:book_enchanted", "mcl_enchanting:book_enchanted") + local spawn_book_entity = function(pos, respawn) if respawn then -- Check if we already have a book