Yatopia/patches/removed/server/no longer needed/under question/0048-Fix-villager-dupe.patch
Ivan Pekov ab975588e5
Some patch organisation
Also dropped a patch that I think was kinda unnecessary.
2020-10-22 14:37:58 +03:00

39 lines
1.6 KiB
Diff

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
--- 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
} else {
this.mobTick(true);
}
- }
+ } else { checkWorkstationBreakOpenInventory(); } // Yatopia
doReputationTick();
// Paper end
@@ -287,6 +287,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();
@@ -1071,4 +1072,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
}