62 lines
3.3 KiB
Diff
62 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cryptite <cryptite@gmail.com>
|
|
Date: Sat, 21 Oct 2023 11:27:52 -0500
|
|
Subject: [PATCH] Non-saveable 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..303e5ed4d5cf2a64b998656bfd189f19f8c8fcde 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.saveable) { // Slice
|
|
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 12fa631aa176e67dcda522dca6376a69ca5b34d8..f62b6e4777486721a1f9d3b5a80591c26b50bd66 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -424,6 +424,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
private UUID originWorld;
|
|
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
|
public boolean fixedPose = false; // Paper - Expand Pose API
|
|
+ public boolean saveable = true; // Slice
|
|
|
|
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
|
this.origin = location.toVector();
|
|
@@ -4825,7 +4826,7 @@ 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.saveable && 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 saveable check
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
index f16ac1d640fc97f348c244d4ea86e3278b30ae19..3e1c22cd06ecaa26b0c36563a4d0c44ee7e91b1d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -1227,4 +1227,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|
return this.getHandle().getScoreboardName();
|
|
}
|
|
// Paper end - entity scoreboard name
|
|
+
|
|
+ // Slice start
|
|
+ @Override
|
|
+ public boolean isSaveable() {
|
|
+ return this.entity.saveable;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setSaveable(boolean saveable) {
|
|
+ this.entity.saveable = saveable;
|
|
+ }
|
|
+ // Slice end
|
|
}
|