Ensure chunks loaded on respawn for suffocation check

This commit is contained in:
Aikar 2020-05-09 21:13:30 -04:00
parent b1691e7b69
commit ad8e59dc79
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 15 additions and 3 deletions

View File

@ -57,6 +57,18 @@ index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..bdebbaf0b93ae7186b0afb3b2c04fdcf
if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) {
VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision);
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 909d86e14c7860cd6d8a6f38ef4aedb183acae3f..fddd92677db06aa9fc41437f34719d9ae6e44c93 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -677,6 +677,7 @@ public abstract class PlayerList {
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// CraftBukkit end
+ location.getChunk(); // Paper - force load chunk to be sure getCubes works
while (avoidSuffocation && !worldserver.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) {
entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ());
}
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
index 335142ec0dfad822cfe40877e99dec0f307e1a58..e641d4b8d8b4ac5d539e6d9c0eaf345601e0b499 100644
--- a/src/main/java/net/minecraft/server/VoxelShapes.java

View File

@ -550,7 +550,7 @@ index b3c9cb67664491c3a8c83a67ac0e79d48561f3fe..ce7462283873635ad0d3bce2395346ed
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 61c7f5f9528ceea34af8dbf4503b9c320b7f67a1..9786f110c5e0d02cc015dc5d9d2549734bda501d 100644
index 0ada5b4ac61a9b77e67da1695327d72c8212c5d6..bcf95c4bb09b881858e22926adef9efd4f525c90 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -151,7 +151,7 @@ public abstract class PlayerList {
@ -562,7 +562,7 @@ index 61c7f5f9528ceea34af8dbf4503b9c320b7f67a1..9786f110c5e0d02cc015dc5d9d254973
entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -772,7 +772,7 @@ public abstract class PlayerList {
@@ -773,7 +773,7 @@ public abstract class PlayerList {
WorldData worlddata = worldserver.getWorldData();
entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getType(), WorldData.c(worldserver.getWorldData().getSeed()), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
@ -571,7 +571,7 @@ index 61c7f5f9528ceea34af8dbf4503b9c320b7f67a1..9786f110c5e0d02cc015dc5d9d254973
entityplayer1.spawnIn(worldserver);
entityplayer1.dead = false;
entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch));
@@ -1256,7 +1256,7 @@ public abstract class PlayerList {
@@ -1257,7 +1257,7 @@ public abstract class PlayerList {
public void a(int i) {
this.viewDistance = i;