Improve async login (#3189)

Add helper functions to ChunkProviderServer to make this easier
for other uses

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Spottedleaf
2020-04-19 10:58:02 -07:00
parent 909a2454fc
commit d77bc736a0
17 changed files with 258 additions and 149 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Load Chunks for Login Asynchronously
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index e737381b3..83ceb3f99 100644
index c2850d50d..d145c4bf1 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
@@ -25,7 +25,7 @@ index e737381b3..83ceb3f99 100644
+ // Paper start - async load spawn in chunk
+ WorldServer finalWorldserver = worldserver;
+ worldserver.getChunkProvider().getChunkAtAsynchronously(loc.getBlockX() >> 4, loc.getBlockZ() >> 4, true, (chunk -> {
+ worldserver.getChunkProvider().getTickingChunkAsync(loc.getBlockX() >> 4, loc.getBlockZ() >> 4, (chunk -> { // use ticking - as it has at least 1 neighbours loaded
+ if (networkmanager.isConnected()) {
+ postChunkLoadJoin(entityplayer, finalWorldserver, nbttagcompound, networkmanager, lastKnownName, networkmanager.getSocketAddress().toString());
+ }