Skip to content

Commit 4ba9bed

Browse files
authored
Always load totalEntityAge (#13918)
1 parent 782a076 commit 4ba9bed

3 files changed

Lines changed: 15 additions & 19 deletions

File tree

paper-server/patches/features/0001-Moonrise-optimisation-patches.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23832,7 +23832,7 @@ index 9d9fa99ff7694a3356421df711c7b1443047b057..c79206e0eb455081f63cf4de2c974136
2383223832
}
2383323833

2383423834
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
23835-
index 23e51ce53e9b1b4f52d49749c13ccaae539c4f0e..afe68487585e5fc2766a10bf69e085f51d498990 100644
23835+
index 196f47bb89a49e4d053cabad62059836823e6c21..82eb863da02d58b7643cd1ebd6b2f642b3474c5d 100644
2383623836
--- a/net/minecraft/server/MinecraftServer.java
2383723837
+++ b/net/minecraft/server/MinecraftServer.java
2383823838
@@ -189,7 +189,7 @@ import net.minecraft.world.scores.ScoreboardSaveData;
@@ -26975,7 +26975,7 @@ index f11c5ea1ee9381e7bf65305b959bd7da67423ece..26822e1211194b411dd8ea75ce523133
2697526975
List<Entity> passengers = this.entity.getPassengers();
2697626976
if (!passengers.equals(this.lastPassengers)) {
2697726977
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
26978-
index ce5bd957dbfe52cd81e571359c6de1028dc11cde..5bb8ddc9490ce6c7bc4544ef0ea05484e67ddbe3 100644
26978+
index 473feb1aa6ccf0f03ce0bc895de367b3e554e1bc..e5328f08d6a323aa1307ed791a88916b4588939c 100644
2697926979
--- a/net/minecraft/server/level/ServerLevel.java
2698026980
+++ b/net/minecraft/server/level/ServerLevel.java
2698126981
@@ -182,7 +182,7 @@ import net.minecraft.world.waypoints.WaypointTransmitter;
@@ -28432,7 +28432,7 @@ index a46b89895a9ce86b6f5fabd373a4e91919d88033..22b10500ef74694243a4fec40822bb54
2843228432
// Paper start - PlayerChunkLoadEvent
2843328433
if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
2843428434
diff --git a/net/minecraft/server/network/config/PrepareSpawnTask.java b/net/minecraft/server/network/config/PrepareSpawnTask.java
28435-
index af2509ed6ca1b9ed68c67bd682de3823ccb09088..d91d7d438dd79c64827de7cdfbaeb8c8b0896a48 100644
28435+
index 3271c83bd103bea9b9ffcd6882b52896ea4da770..f6601bc30fa37a309923ea9883b04233f83b2c0b 100644
2843628436
--- a/net/minecraft/server/network/config/PrepareSpawnTask.java
2843728437
+++ b/net/minecraft/server/network/config/PrepareSpawnTask.java
2843828438
@@ -165,7 +165,7 @@ public class PrepareSpawnTask implements ConfigurationTask {
@@ -28864,7 +28864,7 @@ index 09b6da207530987b483444cebeadc2f1c9a15247..3666c3efd188508153b6482db425648e
2886428864
+ // Paper end - block counting
2886528865
}
2886628866
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
28867-
index d8e2adefabb1de2506faa0e6789801b3d1f0203a..0682b5a6d828141f50c62ff5ea56d5bbb25e1004 100644
28867+
index a9302dcc5614595bffd377eb4f77b7af3798e2ba..00d1ba3e42076f0de52455d66c4e056fdc48cd7a 100644
2886828868
--- a/net/minecraft/world/entity/Entity.java
2886928869
+++ b/net/minecraft/world/entity/Entity.java
2887028870
@@ -164,7 +164,7 @@ public abstract class Entity
@@ -29215,7 +29215,7 @@ index d8e2adefabb1de2506faa0e6789801b3d1f0203a..0682b5a6d828141f50c62ff5ea56d5bb
2921529215
}
2921629216

2921729217
private static float[] collectCandidateStepUpHeights(
29218-
@@ -2830,17 +2978,106 @@ public abstract class Entity
29218+
@@ -2826,17 +2974,106 @@ public abstract class Entity
2921929219
return false;
2922029220
}
2922129221

@@ -29332,7 +29332,7 @@ index d8e2adefabb1de2506faa0e6789801b3d1f0203a..0682b5a6d828141f50c62ff5ea56d5bb
2933229332
}
2933329333

2933429334
public InteractionResult interact(final Player player, final InteractionHand hand, final Vec3 location) {
29335-
@@ -4447,15 +4684,17 @@ public abstract class Entity
29335+
@@ -4443,15 +4680,17 @@ public abstract class Entity
2933629336
}
2933729337

2933829338
public Iterable<Entity> getIndirectPassengers() {
@@ -29358,7 +29358,7 @@ index d8e2adefabb1de2506faa0e6789801b3d1f0203a..0682b5a6d828141f50c62ff5ea56d5bb
2935829358
}
2935929359

2936029360
public int countPlayerPassengers() {
29361-
@@ -4766,6 +5005,15 @@ public abstract class Entity
29361+
@@ -4762,6 +5001,15 @@ public abstract class Entity
2936229362
}
2936329363

2936429364
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
@@ -29374,7 +29374,7 @@ index d8e2adefabb1de2506faa0e6789801b3d1f0203a..0682b5a6d828141f50c62ff5ea56d5bb
2937429374
if (!checkPosition(this, x, y, z)) {
2937529375
return;
2937629376
}
29377-
@@ -4915,6 +5163,12 @@ public abstract class Entity
29377+
@@ -4911,6 +5159,12 @@ public abstract class Entity
2937829378

2937929379
@Override
2938029380
public final void setRemoved(final Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.@Nullable Cause cause) { // CraftBukkit - add Bukkit remove cause
@@ -29387,7 +29387,7 @@ index d8e2adefabb1de2506faa0e6789801b3d1f0203a..0682b5a6d828141f50c62ff5ea56d5bb
2938729387
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit
2938829388
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
2938929389
if (this.removalReason == null) {
29390-
@@ -4925,7 +5179,7 @@ public abstract class Entity
29390+
@@ -4921,7 +5175,7 @@ public abstract class Entity
2939129391
this.stopRiding();
2939229392
}
2939329393

@@ -29396,7 +29396,7 @@ index d8e2adefabb1de2506faa0e6789801b3d1f0203a..0682b5a6d828141f50c62ff5ea56d5bb
2939629396
this.levelCallback.onRemove(reason);
2939729397
this.onRemoval(reason);
2939829398
// Paper start - Folia schedulers
29399-
@@ -4959,7 +5213,7 @@ public abstract class Entity
29399+
@@ -4955,7 +5209,7 @@ public abstract class Entity
2940029400
public boolean shouldBeSaved() {
2940129401
return (this.removalReason == null || this.removalReason.shouldSave())
2940229402
&& !this.isPassenger()

paper-server/patches/features/0017-Optimise-EntityScheduler-ticking.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ index 2bc436cdf5180a7943c45fabb9fbbedae6f7db56..f312a7f5b1b2a777ab36b94ce7cbf387
2020

2121
@Override
2222
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
23-
index b1f5741d5d714f57795c53605db87d86ebb07051..b71f2e181334ad8646afb48c704c30b6f4a33ffd 100644
23+
index 0ea7ca24a557ed1fe8d5b043430d7a89ef80bfa2..3f7ea010df940daba07e4739f3498b379a0a6116 100644
2424
--- a/net/minecraft/server/MinecraftServer.java
2525
+++ b/net/minecraft/server/MinecraftServer.java
2626
@@ -1760,32 +1760,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -66,10 +66,10 @@ index b1f5741d5d714f57795c53605db87d86ebb07051..b71f2e181334ad8646afb48c704c30b6
6666
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.ADVENTURE_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
6767
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
6868
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
69-
index abd46a9bdfa6d387e866e192230aa1f07e5c8936..0fa6006a7c344f9f12972008e586b4c1f03c470e 100644
69+
index 700b5740229b5a97b8755c7d4205e8a99f229f9e..56dc9019708d74f92d43d8a9ed37fba7d82b1877 100644
7070
--- a/net/minecraft/world/entity/Entity.java
7171
+++ b/net/minecraft/world/entity/Entity.java
72-
@@ -5230,6 +5230,11 @@ public abstract class Entity
72+
@@ -5226,6 +5226,11 @@ public abstract class Entity
7373
this.getBukkitEntity().taskScheduler.retire();
7474
}
7575
// Paper end - Folia schedulers

paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -853,16 +853,12 @@
853853
this.customData = input.read("data", CustomData.CODEC).orElse(CustomData.EMPTY);
854854
this.tags.clear();
855855
input.read("Tags", TAG_LIST_CODEC).ifPresent(this.tags::addAll);
856-
@@ -2194,6 +_,58 @@
856+
@@ -2194,6 +_,54 @@
857857
} else {
858858
throw new IllegalStateException("Entity has invalid rotation");
859859
}
860860
+ // CraftBukkit start
861-
+ // Spigot start
862-
+ if (this instanceof net.minecraft.world.entity.LivingEntity) {
863-
+ this.totalEntityAge = input.getIntOr("Spigot.ticksLived", 0); // Paper
864-
+ }
865-
+ // Spigot end
861+
+ this.totalEntityAge = input.getIntOr("Spigot.ticksLived", 0); // Paper
866862
+ this.persist = input.getBooleanOr("Bukkit.persist", true);
867863
+ this.visibleByDefault = input.getBooleanOr("Bukkit.visibleByDefault", true);
868864
+ // SPIGOT-6907: re-implement LivingEntity#setMaximumAir()

0 commit comments

Comments
 (0)