Fix curves in extended negative world heights - #3608
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes //curve failures in extended negative world heights by ensuring LocalBlockVectorSet.wrapped() correctly upgrades from LocalBlockVectorSet to BlockVectorSet when positions fall outside the local coordinate bounds, and adds regression tests around the reported coordinates.
Changes:
- Route
BlockVector3SetHolder#add(BlockVector3)through the upgrade-awareadd(int,int,int)overload. - Add
LocalBlockVectorSetTestcoverage for negative-Y coordinates and preservation of entries across an upgrade. - Add
sparsebitsetto theworldedit-coretest classpath to support running the new tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java | Fixes the vector-based add path in the upgrading wrapper so it can trigger upgrade logic. |
| worldedit-core/src/test/java/com/fastasyncworldedit/core/math/LocalBlockVectorSetTest.java | Adds regression tests for negative-Y additions and retention across upgrades. |
| worldedit-core/build.gradle.kts | Adds a test dependency required to run the new test against code using SparseBitSet. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @Test | ||
| void retainsExistingVectorsWhenUpgraded() { | ||
| BlockVector3Set set = LocalBlockVectorSet.wrapped(); | ||
| BlockVector3 originalPosition = BlockVector3.at(-38, 128, -20); | ||
| BlockVector3 positionOutsideLocalRange = BlockVector3.at(-38, -357, -20); | ||
|
|
||
| assertTrue(set.add(originalPosition)); | ||
| assertTrue(set.add(positionOutsideLocalRange)); | ||
| assertTrue(set.contains(originalPosition)); | ||
| assertTrue(set.contains(positionOutsideLocalRange)); | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
Addressed in ce9cfe9. The upgradesWhenBulkAddingVectorsOutsideLocalRange test exercises addAll with both an in-range vector and the reported extended-negative-Y vector, then verifies that both entries remain in the upgraded set.
| @Override | ||
| public boolean add(BlockVector3 blockVector3) { | ||
| return set.add(blockVector3); | ||
| return add(blockVector3.x(), blockVector3.y(), blockVector3.z()); | ||
| } |
There was a problem hiding this comment.
Addressed in ce9cfe9. BlockVector3SetHolder.addAll now iterates the collection and calls the holder add(BlockVector3) method, so out-of-range entries trigger the upgrade logic while preserving the Set.addAll return value.
|
Unsure why the build is failing, locally it works fine. |
Overview
Fixes #3606
Description
LocalBlockVectorSet.wrapped()is designed to upgrade toBlockVectorSetwhen a position falls outside its local coordinate range. However, itsadd(BlockVector3)overload delegated directly to the underlying set and bypassed the upgrade logic inadd(int, int, int).EditSession#drawSplineuses the vector overload, causing curves below the vanilla world height to throw anIndexOutOfBoundsException.This delegates vector additions through the upgrade-aware overload and adds regression coverage for the coordinates reported in the issue, including preservation of entries added before an upgrade.
Testing
./gradlew :worldedit-core:test --tests com.fastasyncworldedit.core.math.LocalBlockVectorSetTest --rerun-tasks --no-daemon --no-configure-on-demand./gradlew :worldedit-core:build --no-daemon --no-configure-on-demandSubmitter Checklist
@since TODO. No public API was added.