Skip to content

feature: Keep the points of a curve at the centers of blocks - #129

Merged
kous500 merged 1 commit into
mainfrom
feature/pos-block-centers-20261115
Nov 15, 2026
Merged

kous500 merged 1 commit into
mainfrom
feature/pos-block-centers-20261115

Conversation

@kous500

@kous500 kous500 commented Nov 15, 2026

Copy link
Copy Markdown
Owner

What and why

The points of a curve were kept at the corners of blocks, while the curve, the previews and //bc worked half a block further, at the centers. With the coordinates of #128, a point can be at any position, so the points are now kept where the curve goes: a point set where the player stands is the center of their block, and the coordinates typed, the position in the messages and the curve are the same.

With the feet at (10.7, 64.2, -3.4) Before After
//bcpos set 1 (10, 64, -4) (10.5, 64.5, -3.5)
//bcpos set 1 ~ ~ ~ (10.2, 64.2, -3.9) (10.7, 64.7, -3.4)
//bcpos set 1 ~3 ~ ~ (13.2, 64.2, -3.9) (13.7, 64.7, -3.4)
//bcpos set 1 100.5 64.5 -19.5 (100.5, 64.5, -19.5) the same, now the center of block (100, 64, -20)
  • Points without coordinates: set, insert and PosManager.addPos put the point at Vector3.blockCenter(), the center of the block the player stands in.
  • ~ and ^: they count from half a block above the feet, so that from the middle of a block ~ ~ ~ is the center of the block the feet are in. The shift of feature: Set positions at coordinates with //bcpos set and insert #128 on x and z is removed. Numbers are still the position as typed.
  • //bc: the block is floor(curve + offset) instead of round(corner + offset), the same blocks for points set without coordinates.
  • Previews: on Bukkit and Fabric, the curve and the handle lines go through the points, and the outline, the fill and the cross of a point are the block around it. Points set without coordinates are drawn where they were.
  • Code: BezierSegment.blockCenter and blockCenters are replaced by points; the length is measured along the points. BlockVector3.round, which nothing uses now, is removed.

Not changed: shift, the handles that follow each other, the cross section of //bc and how the selection repeats. The points are kept in memory only, so there is nothing to convert. A Fabric client of an older version on a server with this change, or the other way around, draws the preview half a block off; the packet is the same.

How it was tested

  • ./gradlew build allTests checkCodeStyle --warning-mode all: the build and unit tests pass, with no Gradle, javac or Checkstyle warnings, and the game tests pass on every built version and on the oldest version of each range. After the last changes (a test of Vector3.blockCenter, and blockCenter written with floor()), the core unit tests and checkCodeStyle were run again.
  • CurveLayoutTest builds its straight segments between block centers and expects the same blocks as before, which checks that //bc places the same blocks. PosCoordinatesTest, BezierSegmentTest, ParticleLayoutTest and the game tests expect the positions at the centers.
  • In the game, by the maintainer: the previews and //bc.
  • Minecraft version: the versions of the game tests
  • Server software / loader: Fabric, Bukkit
  • WorldEdit / FastAsyncWorldEdit version: the versions in the build

Notes

The points were kept at the corners of blocks, and the curve, the
previews and //bc added half a block to them. They are now kept where
the curve goes: //bcpos without coordinates puts a point at the center
of the block the player stands in.

- //bc places the block at floor(curve + offset) instead of rounding,
  which gives the same blocks for points set without coordinates.
- The previews draw the curve and the handle lines through the points,
  and the block of a point around it.
- ~ and ^ count from half a block above the feet, so that from the
  middle of a block ~ ~ ~ is its center; numbers are still the position
  as typed.
- BezierSegment.blockCenter and blockCenters are replaced by points,
  and BlockVector3.round, which nothing uses now, is removed.
@kous500
kous500 merged commit 20fa3a9 into main Nov 15, 2026
28 checks passed
@kous500
kous500 deleted the feature/pos-block-centers-20261115 branch November 15, 2026 07:39
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