From 31106a203154866ab8de5654505ac2c9fa5fe828 Mon Sep 17 00:00:00 2001 From: MysticTempest Date: Mon, 30 May 2022 15:11:22 -0500 Subject: [PATCH] Fix items obtained from villager trades: This PR stops the load_enchantments function from being called for all items in the villager trades. Fixing non-enchanted items from villagers being unable to stack with their regular counterparts. As they now, no longer have any description metadata. While also ensuring that enchanted items still have their tooltips, and work. --- mods/ENTITIES/mobs_mc/villager.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index f04602ebfb..79744714e5 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -724,7 +724,10 @@ local function set_trade(trader, player, inv, concrete_tradenum) local trade = trades[concrete_tradenum] inv:set_stack("wanted", 1, ItemStack(trade.wanted[1])) local offered = ItemStack(trade.offered) - mcl_enchanting.load_enchantments(offered) + -- Only load enchantments for enchanted items; fixes unnecessary metadata being applied to regular items from villagers. + if mcl_enchanting.is_enchanted(offered:get_name()) then + mcl_enchanting.load_enchantments(offered) + end inv:set_stack("offered", 1, offered) if trade.wanted[2] then local wanted2 = ItemStack(trade.wanted[2])