Yatopia/patches/server/0049-Fix-villager-dupe.patch
Ivan Pekov 755f429c32
Patch port changes
Dropped some patches from purpur, added 2 patches from purpur.
Readded hopper optimizations from origami.
2020-10-04 18:43:50 +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 16e52c38788719b275c92390893a6e9c0e769eb7..7f66131a820ff3a22bf6b10d26cedf6189a8bc1d 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -203,7 +203,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
} else {
this.mobTick(true);
}
- }
+ } else { checkWorkstationBreakOpenInventory(); } // Yatopia
doReputationTick();
// Paper end
@@ -283,6 +283,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();
@@ -1084,4 +1085,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
}