From 5fe3065699c20c94c73295ab3633756ca731639d Mon Sep 17 00:00:00 2001 From: Samsuik Date: Sat, 24 Feb 2024 18:11:59 +0000 Subject: [PATCH] Fix chunk loading entities unloading outside the world --- patches/server/0010-Load-Chunks-on-Movement.patch | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/patches/server/0010-Load-Chunks-on-Movement.patch b/patches/server/0010-Load-Chunks-on-Movement.patch index 37e6c8b..a7ed23f 100644 --- a/patches/server/0010-Load-Chunks-on-Movement.patch +++ b/patches/server/0010-Load-Chunks-on-Movement.patch @@ -51,7 +51,7 @@ index 658e63ebde81dc14c8ab5850fb246dc0aab25dea..f1ff1a67fee37ee7b241ceaa164fa4ee public static TicketType create(String name, Comparator argumentComparator) { return new TicketType<>(name, argumentComparator, 0L); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d92e4db0051f128fac5653c7920c2466bff80143..38d416b4d9acf811f862cd2fbf88de8dfcef077c 100644 +index d92e4db0051f128fac5653c7920c2466bff80143..3cd640d628835c3a94888ca09889a52d3329f7e3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -570,6 +570,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -83,7 +83,13 @@ index d92e4db0051f128fac5653c7920c2466bff80143..38d416b4d9acf811f862cd2fbf88de8d null, null ); -@@ -4878,7 +4891,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4873,12 +4886,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S + + @Override + public boolean shouldBeSaved() { +- return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Paper - rewrite chunk system - it should check if the entity has ANY player passengers ++ return !this.loadChunks && this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Sakura - used to determine whether a chunk should unload // Paper - rewrite chunk system - it should check if the entity has ANY player passengers + } @Override public boolean isAlwaysTicking() {