Fix respawn error due to null location

Closes #11017
This commit is contained in:
Nassim Jahnke 2024-07-04 16:20:03 +02:00
parent b89e6a0195
commit be8ac7acc3
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -14,14 +14,14 @@ movement will load only the chunk the player enters anyways and avoids loading
massive amounts of surrounding chunks due to large AABB lookups. massive amounts of surrounding chunks due to large AABB lookups.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0d0b07c9199be9ca0d5ac3feb1d44f149ba69283..14fb62dedabf2d858bea1877c2e28d1a7b6f5be4 100644 index 0d0b07c9199be9ca0d5ac3feb1d44f149ba69283..1aa8b914e79c0d48094cc22df60ee9750ec3ccd6 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -865,6 +865,7 @@ public abstract class PlayerList { @@ -865,6 +865,7 @@ public abstract class PlayerList {
Vec3 vec3d = dimensiontransition.pos(); Vec3 vec3d = dimensiontransition.pos();
entityplayer1.forceSetPositionRotation(vec3d.x, vec3d.y, vec3d.z, dimensiontransition.yRot(), dimensiontransition.xRot()); entityplayer1.forceSetPositionRotation(vec3d.x, vec3d.y, vec3d.z, dimensiontransition.yRot(), dimensiontransition.xRot());
+ worldserver.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper + worldserver.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(net.minecraft.util.Mth.floor(vec3d.x()) >> 4, net.minecraft.util.Mth.floor(vec3d.z()) >> 4), 1, entityplayer.getId()); // Paper
// CraftBukkit end // CraftBukkit end
if (dimensiontransition.missingRespawnBlock()) { if (dimensiontransition.missingRespawnBlock()) {
entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));