From 50bdfc3e2c9f15f67fefff7f97cafe9355e7f876 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sun, 28 Jul 2024 15:49:38 -0700 Subject: [PATCH] Null check tracker in Entity#resendPossiblyDesyncedEntityData Accidentally dropped this check last commit. It is possible that this is called while the entity is not tracked. --- patches/server/1020-Properly-resend-entities.patch | 7 +++++-- ...035-Detail-more-information-in-watchdog-dumps.patch | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/patches/server/1020-Properly-resend-entities.patch b/patches/server/1020-Properly-resend-entities.patch index 471f9bb108..de1c348724 100644 --- a/patches/server/1020-Properly-resend-entities.patch +++ b/patches/server/1020-Properly-resend-entities.patch @@ -115,10 +115,10 @@ index e597a7ef6e702c7e3703e1ba29a7b919d1c20877..ca9b909a783733f2af1e36f4ac2fd463 this.sendLevelInfo(player, worldserver1); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6b4a7930efabd29f00690a79e8080faaa9767190..914335088ac997e3f81f1365df95d5cc2ec004b6 100644 +index 6b4a7930efabd29f00690a79e8080faaa9767190..935f88542a10360ec21dfced9272313fcf1354ab 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -684,13 +684,42 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -684,13 +684,45 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit start public void refreshEntityData(ServerPlayer to) { @@ -138,6 +138,9 @@ index 6b4a7930efabd29f00690a79e8080faaa9767190..914335088ac997e3f81f1365df95d5cc + if (player.getBukkitEntity().canSee(this.getBukkitEntity())) { + ServerLevel world = (net.minecraft.server.level.ServerLevel)this.level(); + net.minecraft.server.level.ChunkMap.TrackedEntity tracker = world == null ? null : world.getChunkSource().chunkMap.entityMap.get(this.getId()); ++ if (tracker == null) { ++ return; ++ } + final net.minecraft.server.level.ServerEntity serverEntity = tracker.serverEntity; + final List> list = new java.util.ArrayList<>(); + serverEntity.sendPairingData(player, list::add); diff --git a/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch b/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch index 1c1ba7b858..44068aa731 100644 --- a/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/1035-Detail-more-information-in-watchdog-dumps.patch @@ -122,10 +122,10 @@ index 86288143a54e1d786672a81c05698b37fa5d8de2..1d74a728c03e2c6ffe0e795a5f24eac4 private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 914335088ac997e3f81f1365df95d5cc2ec004b6..c0ae4b7bbeddc3e5870c73f518ef5477a3af0c35 100644 +index 935f88542a10360ec21dfced9272313fcf1354ab..490ee48346395fcbaf2eb0151e9248f18974fea6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1083,8 +1083,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1086,8 +1086,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.onGround; } @@ -169,7 +169,7 @@ index 914335088ac997e3f81f1365df95d5cc2ec004b6..c0ae4b7bbeddc3e5870c73f518ef5477 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -1254,6 +1289,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1257,6 +1292,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.level().getProfiler().pop(); } } @@ -183,7 +183,7 @@ index 914335088ac997e3f81f1365df95d5cc2ec004b6..c0ae4b7bbeddc3e5870c73f518ef5477 } private boolean isStateClimbable(BlockState state) { -@@ -4547,7 +4589,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4550,7 +4592,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void setDeltaMovement(Vec3 velocity) { @@ -193,7 +193,7 @@ index 914335088ac997e3f81f1365df95d5cc2ec004b6..c0ae4b7bbeddc3e5870c73f518ef5477 } public void addDeltaMovement(Vec3 velocity) { -@@ -4653,7 +4697,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4656,7 +4700,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper end - Fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) {