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

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/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

View file

@ -724,7 +724,10 @@ local function set_trade(trader, player, inv, concrete_tradenum)
local trade = trades[concrete_tradenum] local trade = trades[concrete_tradenum]
inv:set_stack("wanted", 1, ItemStack(trade.wanted[1])) inv:set_stack("wanted", 1, ItemStack(trade.wanted[1]))
local offered = ItemStack(trade.offered) local offered = ItemStack(trade.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) mcl_enchanting.load_enchantments(offered)
end
inv:set_stack("offered", 1, offered) inv:set_stack("offered", 1, offered)
if trade.wanted[2] then if trade.wanted[2] then
local wanted2 = ItemStack(trade.wanted[2]) local wanted2 = ItemStack(trade.wanted[2])