From 7f33287e18e22fb60914bd891446f3384f916ba7 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Tue, 1 Nov 2022 01:01:13 +0000 Subject: [PATCH] Reset trade counter when unlocking trades --- mods/ENTITIES/mobs_mc/villager.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index ac5d3a285..49ddbfac6 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -804,6 +804,7 @@ local function unlock_trades (self) if not trade_tier_too_high then if trade["locked"] == true then trade.locked = false + trade.trade_counter = 0 has_unlocked = true mcl_log("Villager has a locked trade. Unlocking") end @@ -1593,6 +1594,7 @@ local trade_inventory = { trader.health = math.min(trader.hp_max, trader.health + 4) end trade.trade_counter = trade.trade_counter + 1 + mcl_log("Trade counter is: ".. trade.trade_counter) -- Semi-randomly lock trade for repeated trade (not if there's only 1 trade) if trader._max_tradenum > 1 then if trade.trade_counter >= 12 then