From 1f043c70881600a74e0087ccc9ca7f1444789d8c Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:22:12 -0400 Subject: [PATCH] Attempt fix for occasional world holes when paper_chunk_patches is enabled 1.18 seems to never return an unloaded Either here, instead always calling scheduleChunkGeneration, so we do the same. This hasn't regressed memory usage from some testing on 1.20. --- .../mixin/bugfix/paper_chunk_patches/ChunkMapMixin.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/paper_chunk_patches/ChunkMapMixin.java b/common/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/paper_chunk_patches/ChunkMapMixin.java index 391d2e13..96c474ff 100644 --- a/common/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/paper_chunk_patches/ChunkMapMixin.java +++ b/common/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/paper_chunk_patches/ChunkMapMixin.java @@ -91,15 +91,13 @@ public abstract class ChunkMapMixin { CompletableFuture> future = holder.getOrScheduleFuture(requiredStatus.getParent(), (ChunkMap)(Object)this); cir.setReturnValue(future.thenComposeAsync((either) -> { Optional optional = either.left(); - if(!optional.isPresent()) - return CompletableFuture.completedFuture(either); if (requiredStatus == ChunkStatus.LIGHT) { this.distanceManager.addTicket(TicketType.LIGHT, chunkpos, 33 + ChunkStatus.getDistance(ChunkStatus.LIGHT), chunkpos); } // from original method - if (optional.get().getStatus().isOrAfter(requiredStatus)) { + if (optional.isPresent() && optional.get().getStatus().isOrAfter(requiredStatus)) { CompletableFuture> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (arg2) -> { return this.protoChunkToFullChunk(holder); }, (ChunkAccess)optional.get());