Commit 178d85a
fix: first /level after zero scan adopts live total as canonical baseline
Diagnostics from a series of /po create + /po reset + /level runs
surfaced three distinct sources of fresh-island drift that the per-chunk
self-heal couldn't close on its own:
1. Spawner entity and chest content values are added to results.rawBlockCount
in the post-scan handle* phase, not inside scanAsync's bracket, so they
never make it into scannedChunkValues. A scan with 14 spawners leaves
exactly 14 * 50 = 700 points of follow-up floating in totalPoints but
absent from the per-chunk map — which is the 700 the user saw appear
as level 7 in the first scan of one test.
2. Block-level evolution inside already-known chunks (lava+water forming
obsidian after the zero scan snapshot, fluid sim propagating, trial
spawner state) shows up as growing chunks (+821 in one diagnostic)
that frozen-once won't absorb.
3. When the regular scan races the zero scan on a shared awaitPendingZeros
counter and runs tidyUp first, persisted is still empty and the
reconcile credits everything as new — but only at block-only values,
leaving the entity/chest gap visible as level. (Seen as new=625 in
the first scan of scenario 3, before zero scan's reconcile had fired.)
Closing all three with one mechanism instead of trying to plug each:
the zero scan now flags handicapPending=true and the next regular scan
adopts its live totalPoints (which already includes spawners, chests,
furniture, evolution) as the persisted initialCount. Subsequent scans
see handicapPending=false and use the normal frozen-once self-heal, so
player builds count toward level as before. The same flag is also set
by the fresh-island reconcile branch (empty map + zero initialCount),
so a regular scan that wins the race against zero scan still produces
level=0 the first time. Legacy migration (empty map + positive
initialCount) explicitly does NOT set the flag, preserving established
player progress across the upgrade.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7715a12 commit 178d85a
4 files changed
Lines changed: 111 additions & 2 deletions
File tree
- src
- main/java/world/bentobox/level
- calculators
- objects
- test/java/world/bentobox/level
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
749 | 749 | | |
750 | 750 | | |
751 | 751 | | |
752 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
753 | 757 | | |
754 | 758 | | |
| 759 | + | |
755 | 760 | | |
756 | 761 | | |
757 | 762 | | |
| |||
762 | 767 | | |
763 | 768 | | |
764 | 769 | | |
765 | | - | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
766 | 773 | | |
767 | 774 | | |
768 | 775 | | |
769 | 776 | | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
770 | 786 | | |
771 | 787 | | |
772 | 788 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
928 | 950 | | |
929 | 951 | | |
930 | 952 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
122 | 138 | | |
123 | 139 | | |
124 | 140 | | |
| |||
393 | 409 | | |
394 | 410 | | |
395 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
396 | 428 | | |
397 | 429 | | |
398 | 430 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
531 | 570 | | |
532 | 571 | | |
533 | 572 | | |
| |||
0 commit comments