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.
This commit is contained in:
embeddedt 2023-07-11 14:22:12 -04:00
parent e87c85b75c
commit 1f043c7088
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -91,15 +91,13 @@ public abstract class ChunkMapMixin {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = holder.getOrScheduleFuture(requiredStatus.getParent(), (ChunkMap)(Object)this);
cir.setReturnValue(future.thenComposeAsync((either) -> {
Optional<ChunkAccess> 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<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (arg2) -> {
return this.protoChunkToFullChunk(holder);
}, (ChunkAccess)optional.get());