From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ivan Pekov Date: Mon, 14 Sep 2020 09:48:35 +0300 Subject: [PATCH] Fix villager dupe diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java index da2bd7c597a3f691ec13ff37dd2ef87d44271a97..a78f48739850ca8f0a21d63bda81c60020179079 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -204,7 +204,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } else { this.mobTick(true); } - } + } else { checkWorkstationBreakOpenInventory(); } // Yatopia doReputationTick(); // Paper end @@ -284,6 +284,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) { this.eT(); } + checkWorkstationBreakOpenInventory(); // Yatopia if (inactive) return; // Paper super.mobTick(); @@ -1085,4 +1086,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation return optional.isPresent() ? i - (Long) optional.get() < 24000L : false; } + + // Yatopia start + private void checkWorkstationBreakOpenInventory() { + if ((!getBehaviorController().hasMemory(MemoryModuleType.JOB_SITE) || isSleeping()) && getTrader() != null) { getTrader().closeInventory(); setTradingPlayer(null); } + } + // Yatopia end }