From 6149f6f5e38da28e3d1589e21046ecc54d748305 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 24 Jul 2022 22:11:35 +0200 Subject: [PATCH] Fix regenerate chunk method --- patches/server/Implement-regenerateChunk.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patches/server/Implement-regenerateChunk.patch b/patches/server/Implement-regenerateChunk.patch index dafd833637..0e3c7e2c5f 100644 --- a/patches/server/Implement-regenerateChunk.patch +++ b/patches/server/Implement-regenerateChunk.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - PlayerChunk playerChunk = world.getPlayerChunkMap().getChunk(x, z); - if (playerChunk != null) { - playerChunk.chunk = chunk; -+ final com.mojang.datafixers.util.Either either = chunkStatus.generate( ++ final java.util.concurrent.CompletableFuture> future = chunkStatus.generate( + Runnable::run, + serverLevel, + serverChunkCache.getGenerator(), @@ -69,9 +69,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }, + list, + true -+ ).join(); ++ ); ++ serverChunkCache.mainThreadProcessor.managedBlock(future::isDone); + if (chunkStatus == ChunkStatus.NOISE) { -+ either.left().ifPresent(chunk -> net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, ChunkStatus.POST_FEATURES)); ++ future.join().left().ifPresent(chunk -> net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, ChunkStatus.POST_FEATURES)); + } }