Improve bamboo collision - #6560
Open
ThioJoe wants to merge 1 commit into
Open
Conversation
On Java, bamboo's collision box is offset by a pseudorandom amount
derived from the block's X/Z coordinates (Mth#getSeed, clamped to
+/-0.125). Bedrock derives its offset differently, so bamboo stalks sit
on different corners of the block on each edition and the Bedrock
client will happily stand in spots that intersect the collision box the
Java server actually uses. The server then rejects such movement
("moved wrongly!") and teleports the player back, rubber-banding them
on every movement packet near bamboo.
Previously bamboo was simply skipped during position correction
(collisionIgnoredBlocks), and the collision box in the mappings was
baked at the offset of position 0,0 without the 0.125 clamp - wrong for
both editions at nearly every position.
This adds a BambooCollision translator that computes the Java
collision box for each block position, replicating vanilla's offset
algorithm including its int overflow and float division semantics, and
silently nudges the Java-bound player position out of that box so the
server always accepts the movement. Intersection and collision offset
computation (pistons, client vehicles) use the correct per-position box
as well.
The Bedrock-side model/collision offset itself is apparently a client limitation and cannot be changed without custom blocks, so the visual placement
difference remains.
Contributor
|
Would be curious to know if this has been tested with the bamboo saplings (which have no collision) and the thicker version of bamboo? I suspect this will break in both cases. |
Author
|
I only tested with fully grown bamboo |
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.
Improvement / fix for #6341 at least for bamboo
I had Fable 5 do this so I didn't make it myself, but I tested it and it is definitely an improvement.
Apparently some of the collision stuff is unavoidable because the rendered placement of bamboo is done by the bedrock client and is different than on the java server. This reduces teleporting especially when trying to walk between them, but since it's possible the player might legitimately be walking into the bamboo even if it looks like they're not, it's not completely unavoidable. But this tries to limit it.