Yatopia/patches/server/0036-EMC-Do-not-save-entities-with-player-passengers.patch
2020-03-21 17:29:35 +01:00

47 lines
1.8 KiB
Diff

From 979580a2ffb58f7903fbddf2ef26203797535c79 Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Wed, 22 Jan 2020 01:22:34 -0600
Subject: [PATCH] EMC Do not save entities with player passengers
---
.../net/minecraft/server/ChunkRegionLoader.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index d529b795..1b2b73b8 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -452,7 +452,7 @@ public class ChunkRegionLoader {
if (asyncsavedata == null) toUpdate.add(entity); // todo fix this broken code, entityJoinedWorld wont work in this case!
continue;
}
- if (asyncsavedata == null && entity.dead) { // todo
+ if (asyncsavedata == null && (entity.dead || hasPlayerPassenger(entity))) { // todo // Paper - Add hasPlayerPassenger continue
continue;
}
// Paper end
@@ -533,6 +533,20 @@ public class ChunkRegionLoader {
return nbttagcompound;
}
+ // Paper start
+ private static boolean hasPlayerPassenger(Entity entity) {
+ for (Entity passenger : entity.passengers) {
+ if (passenger instanceof EntityPlayer) {
+ return true;
+ }
+ if (hasPlayerPassenger(passenger)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ // Paper end
+
// Paper start
public static ChunkStatus getStatus(NBTTagCompound compound) {
if (compound == null) {
--
2.25.1.windows.1