Skip to content

Commit

Permalink
Fix copykey
Browse files Browse the repository at this point in the history
  • Loading branch information
dordsor21 committed Sep 14, 2024
1 parent 63606d7 commit bd3cc64
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,17 @@ public synchronized <T extends Future<T>> T call(IQueueExtent<? extends IChunk>
TextComponent.of("Could not get chunk at " + chunkX + "," + chunkZ + " whilst low memory: " + e.getMessage()));
}
}
final int finalCopyKey = copyKey;
// Run immediately if possible
if (chunk != null) {
return internalCall(set, finalizer, chunk, nmsWorld);
return internalCall(set, finalizer, finalCopyKey, chunk, nmsWorld);
}
// Submit via the STQE as that will help handle excessive queuing by waiting for the submission count to fall below the
// target size
nmsChunkFuture.thenApply(nmsChunk -> owner.submitTaskUnchecked(() -> (T) internalCall(
set,
finalizer,
finalCopyKey,
nmsChunk,
nmsWorld
)));
Expand All @@ -467,7 +469,13 @@ public synchronized <T extends Future<T>> T call(IQueueExtent<? extends IChunk>
return (T) (Future) CompletableFuture.completedFuture(null);
}

private <T extends Future<T>> T internalCall(IChunkSet set, Runnable finalizer, LevelChunk nmsChunk, ServerLevel nmsWorld) {
private <T extends Future<T>> T internalCall(
IChunkSet set,
Runnable finalizer,
int copyKey,
LevelChunk nmsChunk,
ServerLevel nmsWorld
) {
try {
PaperweightGetBlocks_Copy copy = createCopy ? new PaperweightGetBlocks_Copy(nmsChunk) : null;
if (createCopy) {
Expand Down

0 comments on commit bd3cc64

Please sign in to comment.