1
0
Fork 0

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.
This commit is contained in:
MysticTempest 2022-05-30 15:11:22 -05:00
parent ad1b7510aa
commit 31106a2031
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] 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])