1.20.2
This commit is contained in:
32
patches/server/0039-Do-not-save-Persistent-Entities.patch
Normal file
32
patches/server/0039-Do-not-save-Persistent-Entities.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 6 Nov 2023 08:17:46 -0600
|
||||
Subject: [PATCH] Do not save Persistent Entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index 7e8dc9e8f381abfdcce2746edc93122d623622d1..985fb335be637190c56d6aed2047ef20fc635b58 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -118,7 +118,7 @@ public final class ChunkEntitySlices {
|
||||
// removed by us below
|
||||
continue;
|
||||
}
|
||||
- if (entity.shouldBeSaved()) {
|
||||
+ if (entity.shouldBeSaved() || !entity.persist) { // Slice - Ensure non-persisting entities are still removed
|
||||
entity.setRemoved(Entity.RemovalReason.UNLOADED_TO_CHUNK);
|
||||
if (entity.isVehicle()) {
|
||||
// we cannot assume that these entities are contained within this chunk, because entities can
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6f60cadb034de8bbe52351a100916879ca98d977..05a883a556d35423b22087f88ca12d252e5081bf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4756,7 +4756,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
@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.persist && 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 // Slice - add persists check
|
||||
}
|
||||
|
||||
@Override
|
||||
Reference in New Issue
Block a user