Repository navigation
feature: Keep the points of a curve at the centers of blocks - #129
Merged
Merged
Conversation
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.
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.
What and why
The points of a curve were kept at the corners of blocks, while the curve, the previews and
//bcworked 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.//bcpos set 1//bcpos set 1 ~ ~ ~//bcpos set 1 ~3 ~ ~//bcpos set 1 100.5 64.5 -19.5set,insertandPosManager.addPosput the point atVector3.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 isfloor(curve + offset)instead ofround(corner + offset), the same blocks for points set without coordinates.BezierSegment.blockCenterandblockCentersare replaced bypoints; 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//bcand 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 ofVector3.blockCenter, andblockCenterwritten withfloor()), the core unit tests andcheckCodeStylewere run again.CurveLayoutTestbuilds its straight segments between block centers and expects the same blocks as before, which checks that//bcplaces the same blocks.PosCoordinatesTest,BezierSegmentTest,ParticleLayoutTestand the game tests expect the positions at the centers.//bc.Notes
//bcposare at the centers of blocks, such as (10.5, 64.5, -3.5).~and^of feature: Set positions at coordinates with //bcpos set and insert #128 count from a different base; feature: Set positions at coordinates with //bcpos set and insert #128 has not been released yet.