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);

View File

@ -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) {