Yatopia/patches/removed/server/no longer needed/under question/0048-Fix-villager-dupe.patch

39 lines
1.6 KiB
Diff
Raw Normal View History

2020-09-14 11:57:41 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
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 939ef3bd6439a68dba4224661d050c6af0164178..4c7e1f5c2a332f5b5ed15b0528ed717f5f84f63f 100644
2020-09-14 11:57:41 +02:00
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -207,7 +207,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
2020-09-14 11:57:41 +02:00
} else {
this.mobTick(true);
}
- }
+ } else { checkWorkstationBreakOpenInventory(); } // Yatopia
doReputationTick();
// Paper end
@@ -287,6 +287,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
2020-09-14 11:57:41 +02:00
if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) {
this.eT();
}
+ checkWorkstationBreakOpenInventory(); // Yatopia
if (inactive) return; // Paper
super.mobTick();
@@ -1071,4 +1072,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
2020-09-14 11:57:41 +02:00
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
}