Skip to content

feature: Lay //bc around corners and up slopes without crossing itself - #136

Merged
kous500 merged 8 commits into
mainfrom
feature/bc-corners-20261117
Nov 21, 2026
Merged

kous500 merged 8 commits into
mainfrom
feature/bc-corners-20261117

Conversation

@kous500

@kous500 kous500 commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

What and why

Where a curve turned at a point without handles, the cross section of //bc left a gap outside the corner, and inside it the cross sections of the two segments overlapped. When the curve climbed or fell around the corner, the two overlapping cross sections were at different heights, so both stayed and crossed each other. On slopes, the bottom row also got an extra block wherever the curve climbed into the next block within one xz cell (the blocks at one x and z, at any height).

  • Outside a corner: the cross section turns around the point, from the way across the segment before to the way across the next one, so the outside is filled with a rounded corner. Only the columns on the outside of the turn are laid while it turns.
  • Inside a corner: where two segments meet turning by more than 1° on the xz plane, neither lays anything in an xz cell, at any height, where the other has laid first. Since the columns nearer the middle are laid first, the two cross sections meet along the line where they are equally far from the middle, instead of crossing each other.
  • Steep segments: a segment that climbs or falls more along its steps than it goes across the xz plane, such as one going straight up between two points, passes few xz cells, which the segment beside it would take. Steep segments do not split xz cells with the segments beside them, so the curve stays connected.
  • Order of laying: add only prepares the segments, and blocks lays them all together: row by row from the middle outwards (the lower first of two as far), and in each row column by column from the middle outwards, each column along every segment in order before the next. The first block laid on a block is kept. Where the curve climbs or falls within an xz cell, the blocks the rows share go to the rows nearest the middle, so with three rows or more the top and bottom rows keep one block each. Steep slopes stay connected, and the block the curve starts in is laid.
  • Refactoring: the steps and the segments to lay have their own records, the size of the cross section and of the repeat are fields, and the side of a column, the block of a position, the xz cells taken at corners and the block of the selection have their own methods. The blocks are kept in a HashMap and returned unsorted; the order does not change what WorldEdit places.
Curve Before After
A road 5 wide turning left without handles Outside: 4 blocks missing at the corner. Inside: the rows of the first segment run through the corner Outside: rounded. Inside: split along the bisector (0 1 2 / 1 1 2 / 2 2 2)
The same, going down one block for each along the second segment Inside: both segments at different heights One layer, of the segment nearer each block
Flat, straight up 6 blocks, flat again Laid whole Laid whole
3 rows up a slope of one block for every two The bottom row gets 2 blocks where the curve climbs Top and bottom rows 1 block in each xz cell

How it was tested

  • ./gradlew build checkCodeStyle :curvebuilding-fabric:26.3:runGameTest: the build, the unit tests and the game tests on 26.3 pass, with no Checkstyle warnings. IntelliJ's inspections report nothing in the changed files.
  • New unit tests in CurveLayoutTest: the inside and the outside of a turn, a turn that goes down, two segments going on the same way, a steep part between corners, a curve passing over itself, top and bottom rows up a slope, a steep slope staying connected from its start, and -a reading each block once.
  • In the game, by the maintainer: //bc with these changes.
  • Minecraft version: 26.3 (game tests)
  • Server software / loader: Fabric (game tests)
  • WorldEdit / FastAsyncWorldEdit version: the version in the build

Notes

  • Changes which blocks //bc places at corners without handles, on slopes and where the curve passes over itself. Straight curves and gentle curves with one or two rows are laid as before.
  • With one or two rows, the bottom row still gets an extra block where the curve climbs within an xz cell, as before.
  • A segment going straight up has no way across on the xz plane and uses +x, so where a flat segment turns straight up, the cross section turns around the point there.

…tself

Where the curve turns at a point, the cross section turns around the
point to fill the outside of the corner, with only the columns on the
outside. Where two segments meet turning by more than a degree on the
xz plane, neither places anything on a column of blocks, at any height,
where the other has laid first, so that inside the corner the two
cross sections meet along the line where they are equally far from the
middle, instead of crossing each other where the curve climbs or falls.

The segments are laid together once all are added: row by row from the
top, column by column from the middle, each column along every segment
before the next, keeping the first block laid.
Name the steps and the segments laid as such, keep the size of the
cross section and of the repeat in fields, and split out the side of a
column, the block of a position, the columns taken at corners, the
block of the selection and the loop that lays everything. No block
placed changes.
The blocks laid are kept in a HashMap and given back unsorted, as the
order they are placed in does not change what WorldEdit places. A curve
of about 120,000 blocks is laid in about 48 ms instead of 70 ms.
…z cell

The rows of the cross section are laid from the bottom up again. Where
the curve climbs or falls within a column of blocks, each row passes
two blocks there and the row below has laid on the lower one first, so
every row keeps one block. For the bottom row, a row below it is worked
out first, laying nothing, to keep the bottom row of the same segment
off those blocks.
The columns of blocks that segments take at corners are keyed by a
record of their x and z instead of a long packing both, and hold the
indexes of the segments that took them in a set instead of a BitSet.
No block placed changes.
…ells

The record, the field and the method for the blocks at one x and z, at
any height, are named XzCell, xzCellsTaken and takeXzCell, so that they
are not mistaken for the columns of the cross section. The comments and
the tests say xz cell for them too.
The rows of the cross section are laid from the middle outwards, the
lower first of two as far, like its columns. Where the curve climbs or
falls within an xz cell, the blocks that the rows share go to the rows
nearest the middle, so that with three rows or more the top and bottom
rows keep one block each. The row below the bottom row, which dropped
the lower block of the bottom row, is no longer worked out: steep
slopes stay connected and the block the curve starts in is laid.
A segment that climbs or falls more along its steps than it goes across
the xz plane, such as one going straight up between two points, passes
few xz cells, most of which the segment beside it took first at a
corner, so it lost nearly all its blocks and the curve broke off. Such
steep segments split no xz cells with the segments beside them.
@kous500
kous500 merged commit 200a8eb into main Nov 21, 2026
28 checks passed
@kous500
kous500 deleted the feature/bc-corners-20261117 branch November 21, 2026 08:22
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