Skip to content

Commit

Permalink
Remove isChunkGenerated call
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 committed Jun 19, 2024
1 parent d64c0d0 commit 42a2632
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions common/src/main/java/org/popcraft/chunky/GenerationTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.popcraft.chunky.util.TranslationKey;

import java.util.Deque;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicLong;
Expand Down Expand Up @@ -143,20 +142,10 @@ public void run() {
stop(cancelled);
break;
}
final CompletableFuture<Boolean> isChunkGenerated = forceLoadExistingChunks ?
CompletableFuture.completedFuture(false) :
selection.world().isChunkGenerated(chunk.x(), chunk.z());
isChunkGenerated
.thenCompose(generated -> {
if (Boolean.TRUE.equals(generated)) {
return CompletableFuture.completedFuture(null);
} else {
return selection.world().getChunkAtAsync(chunk.x(), chunk.z());
}
}).whenComplete((ignored, throwable) -> {
working.release();
update(chunk.x(), chunk.z(), true);
});
selection.world().getChunkAtAsync(chunk.x(), chunk.z()).whenComplete((ignored, throwable) -> {
working.release();
update(chunk.x(), chunk.z(), true);
});
}
if (stopped) {
chunky.getServer().getConsole().sendMessagePrefixed(TranslationKey.TASK_STOPPED, selection.world().getName());
Expand Down

0 comments on commit 42a2632

Please sign in to comment.