Skip to content

Commit

Permalink
Merge pull request #339 from BentoBoxWorld/zero_fix
Browse files Browse the repository at this point in the history
Fixed island level zeroing for non-void worlds
  • Loading branch information
tastybento authored Jan 20, 2025
2 parents 3a96bb5 + ecc049c commit 22ea268
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.17.0</build.version>
<build.version>2.17.1</build.version>
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ private void loadChunks(CompletableFuture<List<Chunk>> r2, World world, Queue<Pa
return;
}
Pair<Integer, Integer> p = pairList.poll();
Util.getChunkAtAsync(world, p.x, p.z, world.getEnvironment().equals(Environment.NETHER)).thenAccept(chunk -> {
// We need to generate now all the time because some game modes are not voids
Util.getChunkAtAsync(world, p.x, p.z, true).thenAccept(chunk -> {
if (chunk != null) {
chunkList.add(chunk);
roseStackerCheck(chunk);
Expand Down Expand Up @@ -613,6 +614,7 @@ public void scanIsland(Pipeliner pipeliner) {
} else {
// Done
pipeliner.getInProcessQueue().remove(this);
BentoBox.getInstance().log("Completed Level scan.");
// Chunk finished
// This was the last chunk. Handle stacked blocks, then chests and exit
handleStackedBlocks().thenCompose(v -> handleChests()).thenRun(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ public Pipeliner(Level addon) {
if (!inProcessQueue.isEmpty() || toProcessQueue.isEmpty()) return;
for (int j = 0; j < addon.getSettings().getConcurrentIslandCalcs() && !toProcessQueue.isEmpty(); j++) {
IslandLevelCalculator iD = toProcessQueue.poll();
// Ignore deleted or unonwed islands
// Ignore deleted or unowned islands
if (!iD.getIsland().isDeleted() && !iD.getIsland().isUnowned()) {
inProcessQueue.put(iD, System.currentTimeMillis());
BentoBox.getInstance().log("Starting to scan island level at " + iD.getIsland().getCenter());
// Start the scanning of a island with the first chunk
scanIsland(iD);
}
Expand Down Expand Up @@ -95,6 +96,7 @@ public CompletableFuture<Results> addIsland(Island island) {
.map(IslandLevelCalculator::getIsland).anyMatch(island::equals)) {
return CompletableFuture.completedFuture(new Results(Result.IN_PROGRESS));
}
BentoBox.getInstance().log("Added island to Level queue: " + island.getCenter());
return addToQueue(island, false);
}

Expand All @@ -104,6 +106,7 @@ public CompletableFuture<Results> addIsland(Island island) {
* @return CompletableFuture of the results
*/
public CompletableFuture<Results> zeroIsland(Island island) {
BentoBox.getInstance().log("Zeroing island level for island at " + island.getCenter());
return addToQueue(island, true);
}

Expand Down

0 comments on commit 22ea268

Please sign in to comment.