Skip to content

FIXED: Bug where max island progress would decrease when island level should be negative#434

Draft
msmith-codes wants to merge 1 commit into
BentoBoxWorld:developfrom
msmith-codes:develop
Draft

FIXED: Bug where max island progress would decrease when island level should be negative#434
msmith-codes wants to merge 1 commit into
BentoBoxWorld:developfrom
msmith-codes:develop

Conversation

@msmith-codes
Copy link
Copy Markdown
Contributor

This pull request improves the calculation of points accumulated within the current level in the tidyUp() method of IslandLevelCalculator.java. The main change is a more robust handling of level-0 islands to prevent negative progress and calculation errors, especially for new islands or when block counts drop below the starting count.

Calculation logic improvements:

  • For level-0 islands, the calculation now anchors progress to the initial block count (minBlocks), preventing negative or misleading progress values and avoiding unsafe searches that could result in NaN or incorrect values due to the behavior of calculateLevel with negative inputs.
  • For islands above level 0, the binary search for points from the current level remains, but the result is now consistently assigned to lowerBlocks for use in the points calculation. [1] [2]
  • The assignment to results.pointsFromCurrentLevel is updated to use blockAndDeathPoints - lowerBlocks, ensuring correct progress reporting for all cases.

@msmith-codes msmith-codes marked this pull request as draft May 14, 2026 16:20
@msmith-codes
Copy link
Copy Markdown
Contributor Author

I'm not getting this build failed error on my local build. I'll take a further look to see if there was any oversight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant