Fix upgrading of enchanted items

This commit is contained in:
Lizzy Fleckenstein 2021-05-10 10:00:13 +02:00
parent 24dfda8d7e
commit f79ace6306
1 changed files with 7 additions and 5 deletions

View File

@ -17,16 +17,18 @@ function mcl_smithing_table.upgrade_item(itemstack)
local itemname = itemstack:get_name()
local upgrade_item = def._mcl_upgrade_item or itemname:gsub("diamond", "netherite")
local upgrade_item = def._mcl_upgrade_item
if upgrade_item and mcl_enchanting.is_enchanted(itemname) then
upgrade_item = upgrade_item .. "_enchanted"
end
upgrade_item = upgrade_item or itemname:gsub("diamond", "netherite")
if upgrade_item == itemname then
return
end
if mcl_enchanting.is_enchanted(itemname) then
upgrade_item = upgrade_item .. "_enchanted"
end
itemstack:set_name(upgrade_item)
-- Reload the ToolTips of the tool