Yatopia/patches/server/0050-Fix-villager-dupe.patch
Ivan Pekov b512028dea
Updated Upstream and Sidestream(s) (Tuinity/Purpur)
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
c9cfdba Updated Upstream (Paper)

Purpur Changes:
d4301d4 Updated Upstream (Paper)
0e1cb93 wandering trader spawn rate config
67a42f6 Despawn rate config options per projectile type
7a1012e Drop "Use-arrow-despawn-rate-for-all-projectiles.patch"
8767574 Fix #56 Fix #50 - Ridable baby and tameable settings
8ec6f6f Fix #46 - Essentials EC overriding Purpur
a919aa3 Updated Upstream (Paper & Tuinity)
2020-09-15 08:23:39 +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 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
}