Merge pull request 'Fix items obtained from villager trades:' (#2264) from Fix_items_obtained_from_villagers into master

Reviewed-on: MineClone2/MineClone2#2264
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-05-30 21:21:54 +00:00
commit 5778c2d27a
1 changed files with 4 additions and 1 deletions

View File

@ -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])