Use destination world when preloading spawn chunk (#7441)

This commit is contained in:
PureGero 2022-02-04 18:30:13 +10:00 committed by GitHub
parent 46ed080d3b
commit 6df46412cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -13,16 +13,16 @@ Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 62f19eafbb650dfbfac31c320e4883149d327e43..a9705e54b88339e2746348aee9ab1acdae5182b2 100644
index 62f19eafbb650dfbfac31c320e4883149d327e43..ae0ae298ff7ae129959ff6e4024eb7060c0786e4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3026,6 +3026,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
BlockPos blockposition1;
@@ -3028,6 +3028,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
if (flag1) {
+ // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate
+ this.level.getChunkAt(((ServerLevel) this.level).getSharedSpawnPos());
+ // Paper end
blockposition1 = ServerLevel.END_SPAWN_POINT;
} else {
+ // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate
+ destination.getChunkAt(destination.getSharedSpawnPos());
+ // Paper end
blockposition1 = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, destination.getSharedSpawnPos());
}
// CraftBukkit start