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.
This commit is contained in:
Spottedleaf 2024-07-28 15:49:38 -07:00
parent f774787a39
commit 50bdfc3e2c
2 changed files with 10 additions and 7 deletions

View file

@ -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<net.minecraft.network.protocol.Packet<? super net.minecraft.network.protocol.game.ClientGamePacketListener>> list = new java.util.ArrayList<>();
+ serverEntity.sendPairingData(player, list::add);