diff options
author | Jason Penilla <[email protected]> | 2024-04-24 22:16:04 -0700 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2024-04-24 22:16:04 -0700 |
commit | 690b1cd3215b1867591130f9dd8208fc48194576 (patch) | |
tree | 2d73aef02a41d4bde628ee62c1a9da80ae4e4cb0 /patches/server/0009-MC-Utils.patch | |
parent | 25f7c68e6b59f1fc5da21d524debe044d1482de8 (diff) | |
download | Paper-690b1cd3215b1867591130f9dd8208fc48194576.tar.gz Paper-690b1cd3215b1867591130f9dd8208fc48194576.zip |
compile fixes
Diffstat (limited to 'patches/server/0009-MC-Utils.patch')
-rw-r--r-- | patches/server/0009-MC-Utils.patch | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 8fc599c111..461c2f81d6 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -6125,7 +6125,7 @@ index a3d44867e6243f30640df91a0285ed735a9f1f34..be9fde876cb22296afd01fb5d55be1f1 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world"); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 2119fc6f72461199ae8969ab0d9b8fab26d775a8..7653d56ceb687a2784a4030412c1034fb02e0f8c 100644 +index 2119fc6f72461199ae8969ab0d9b8fab26d775a8..b12921579cb9ab3cbf5607841cc84f2f843624ea 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -48,9 +48,9 @@ public class ChunkHolder { @@ -6171,12 +6171,12 @@ index 2119fc6f72461199ae8969ab0d9b8fab26d775a8..7653d56ceb687a2784a4030412c1034f + public @Nullable ChunkAccess getAvailableChunkNow() { + // TODO can we just getStatusFuture(EMPTY)? + for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) { -+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.getFutureIfPresentUnchecked(curr); -+ Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either = future.getNow(null); -+ if (either == null || either.left().isEmpty()) { ++ CompletableFuture<ChunkResult<ChunkAccess>> future = this.getFutureIfPresentUnchecked(curr); ++ ChunkResult<ChunkAccess> either = future.getNow(null); ++ if (either == null || either.isSuccess()) { + continue; + } -+ return either.left().get(); ++ return either.orElseThrow(IllegalStateException::new); + } + return null; + } @@ -6214,11 +6214,11 @@ index 2119fc6f72461199ae8969ab0d9b8fab26d775a8..7653d56ceb687a2784a4030412c1034f } + // Paper start -+ public ChunkStatus getChunkHolderStatus() { ++ public @Nullable ChunkStatus getChunkHolderStatus() { + for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) { -+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.getFutureIfPresentUnchecked(curr); -+ Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either = future.getNow(null); -+ if (either == null || !either.left().isPresent()) { ++ CompletableFuture<ChunkResult<ChunkAccess>> future = this.getFutureIfPresentUnchecked(curr); ++ ChunkResult<ChunkAccess> either = future.getNow(null); ++ if (either == null || !either.isSuccess()) { + continue; + } + return curr; @@ -6291,8 +6291,8 @@ index 2119fc6f72461199ae8969ab0d9b8fab26d775a8..7653d56ceb687a2784a4030412c1034f this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this); this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, FullChunkStatus.BLOCK_TICKING); + // Paper start - cache ticking ready status -+ this.tickingChunkFuture.thenAccept(either -> { -+ either.ifLeft(chunk -> { ++ this.tickingChunkFuture.thenAccept(chunkResult -> { ++ chunkResult.ifSuccess(chunk -> { + // note: Here is a very good place to add callbacks to logic waiting on this. + ChunkHolder.this.isTickingReady = true; + io.papermc.paper.chunk.system.ChunkSystem.onChunkTicking(chunk, this); @@ -6306,7 +6306,7 @@ index 2119fc6f72461199ae8969ab0d9b8fab26d775a8..7653d56ceb687a2784a4030412c1034f - this.tickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK); + // Paper start + if (this.isTickingReady) { -+ io.papermc.paper.chunk.system.ChunkSystem.onChunkNotTicking(this.tickingChunkFuture.join().left().get(), this); // Paper ++ io.papermc.paper.chunk.system.ChunkSystem.onChunkNotTicking(this.tickingChunkFuture.join().orElseThrow(IllegalStateException::new), this); // Paper + } + // Paper end + this.tickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK); this.isTickingReady = false; // Paper - cache chunk ticking stage |