Repository navigation
Walk structure regions in one place: structure::scan - #22
Merged
Merged
Conversation
The map, the seed finder and the structures example each had their own copy of the region loop (candidate chunk per region, placement checks, locate position) and of the filters on top (bastions vs fortresses, end cities with a ship), with the one-chunk-region case handled differently in each. They now share mc_core::structure::scan: - candidates(set, seed, ChunkRect): the chunks where a set tries to place a structure (placement only, cheap); - StructureGenerator::hit(&SetFilter, candidate): whether it generates and passes the filter, with the end city ship; - StructureGenerator::hits(&SetFilter, rect): both, for an area. StructureFilter now holds a SetFilter instead of its own set, only and ship fields. A new test compares the scan with a check of every chunk on its own, for every random-spread set, on rectangles that straddle region edges, the origin and the world border. GLOSSARY.md names the terms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SenGxDDRwLejx8nir8GXKG
Owner
Author
|
CI did not run on this PR: all three jobs (Test, JDK parity, Game parity) stopped before their first step with "The job was not started because your account is locked due to a billing issue." None of the PR's code ran in CI. Locally, Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first step of the architecture review: the map, the seed finder and the
structuresexample each walked a set's regions on their own. Now there is one scan module, so they cannot disagree on which chunks they look at, and mineshafts (0.6) need changes in only one place.What changes
mc_core::structure::scan:candidates(set, seed, ChunkRect): the chunks where a set tries to place a structure. This only runs the placement checks, so it is cheap.StructureGenerator::hit(&SetFilter, candidate): whether the structure generates and passes the filter. ASetFiltercan keep only some structures of the set (for example bastions) or only end cities with a ship.StructureGenerator::hits(&SetFilter, rect): both steps for every candidate in an area.StructureFilternow holds aSetFilter(select) instead of separateset,onlyandshipfields.markers()is now a map overhits().GLOSSARY.mdnames the terms used here: candidate, attempt, hit, chunk rectangle, layer.No behaviour change, so this needs no release.
Tests
tests/structure_scan.rscompares the scan with a separate check of every chunk in the rectangle. It covers every random-spread set, 4 seeds, and rectangles that cross region edges, the origin and the world border. It also checks that hits are exactly the candidates that generate, including filtering by name prefix.docs/PARITY.md.Generated by Claude Code