2022-03-02 10:21:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								From: Nassim Jahnke <nassim@njahnke.dev>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Date: Wed, 2 Mar 2022 09:45:56 +0100
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Subject: [PATCH] Force close world loading screen
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Dead players would be stuck in the world loading screen and other players may
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								miss messages and similar sent in the join event if chunk loading is slow.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Paper already circumvents falling through the world before chunks are loaded,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								so we do not need that. The client only needs the chunk it is currently in to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								be loaded to close the loading screen, so we just send an empty one.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								--- a/src/main/java/net/minecraft/server/players/PlayerList.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								@@ -0,0 +0,0 @@ public abstract class PlayerList {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-21 12:11:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         // Paper start - Fire PlayerJoinEvent when Player is actually ready; move vehicle into method so it can be called above - short circuit around that code
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 10:21:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								         onPlayerJoinFinish(player, worldserver1, s1);
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 19:50:57 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        if (player.isDeadOrDying()) {
 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-07 20:24:00 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+            net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> plains = worldserver1.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME)
 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 19:50:57 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+                .getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            player.connection.send(new net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket(
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+                new net.minecraft.world.level.chunk.EmptyLevelChunk(worldserver1, player.chunkPosition(), plains),
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-23 18:01:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+                worldserver1.getLightEngine(), (java.util.BitSet)null, (java.util.BitSet) null)
 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 19:50:57 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+            );
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        }
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-18 18:52:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        // Paper end - Send empty chunk
 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 10:21:30 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     private void mountSavedVehicle(ServerPlayer player, ServerLevel worldserver1, CompoundTag nbttagcompound) {
							 
						 
					
						
							
								
									
										
										
										
											2024-01-21 12:11:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         // Paper end - Fire PlayerJoinEvent when Player is actually ready