Repository navigation
fix(place): pick the block under the player when looking down past an edge - #72
Merged
notchyves merged 1 commit intoNov 6, 2026
Conversation
… edge Bedrock bridging works by looking down past the edge of the block you stand on: the ray hits nothing, yet the game targets that block. theselauraproject#64 removed Perlin's invented reach-around (and its made-up click), which left no way to place there at all. The game's pick (0x144E090C0) does it when nothing is in reach and the look direction's y is below -0.7: it clips blocks from the eye 2 blocks straight down, keeps that hit point, and sets the face from the look's dominant horizontal axis; the hit carries a flag (+0x84) that held repeats check before reusing it (0x14376B8D0). Perlin now does the same, so the outline shows and the click is mPos - BlockPos (top of the block) like the game's.
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.
Problem
Since #64, standing at the edge of a bridge or on top of a pillar and looking down past the edge ("traditional" Bedrock bridging) places nothing and shows no outline. The look ray hits no block within reach, so Perlin had nothing to target.
#64 removed Perlin's reach-around (
Bridging::FindTarget) because it sent an invented click (pinned to the side-face edge,y = 0.999, up to 17° off the look ray), which got the account banned. The vanilla client does have its own reach-around, though, and that is what this PR ports.What the vanilla client does
The behaviour below comes from IDA on the Windows client 1.26.60.5. The frame pick (
0x144E090C0) builds theHitResultthatClientInstance::_tickBuildAction(0x1465A2950) then uses:HitResulttype 2 / 3), in the regular aiming mode (the pick context's byte 0).y < -0.7(0x144E0A75C, about 44.4° below the horizon), it clips blocks only, no liquids, from the eye toeye + (0, -2, 0)(xmmword_14F0AE7C0,BlockSourcevfunc+0x198).mPos, on top of the block under the player;(dir.z < 0) ^ 3→ 2 / 3, or(dir.x < 0) ^ 5→ 4 / 5 when|dir.x| > |dir.z|;+0x84.0x14376B8D0) only use a direct hit whentype == 0 && !hit[0x84]. A look-down hit therefore only serves the first press; an existing build line keeps going as before.Because it is the frame's hit, the outline shows on that block. The build lambda (
0x143771570) sendsclickPos = mPos - BlockPos=(eye fraction x, 1, eye fraction z), with the horizontal face.Change
Perlin::UpdateAim: when the normal raycast hits nothing andlook.y < -0.7, raycast blocks only from the eye, straight down, 2 blocks. A block hit becomesaimHit, with the vanilla face rule andbuildAssist = true. The hit point is kept, so the outline shows andclickOfgives the vanilla click.AimHit::buildAssist/heldbuild::Hit::assist:HeldBuild::Nextskips the direct-hit branch for these hits, like the!hit[0x84]check.Nothing from the old
FindTargetcomes back: no body-footprint search, no 1.5-block support search, no invented edge click, and nothing happens above the -0.7 threshold.Testing
macOS arm64 Release build, packet capture while bridging on a server:
clickPos(1, 86, 16)looking north at 69.9°(0.475, 1, 0.494)(1, 68, 1)looking west at 68.6°(0.572, 1, 0.652)(1, 86, 15)318 ms later, still held, moving north(0.44, 1, 0.651)0x14376B8D0)(1, 86, 9)/(1, 86, 8)/(1, 86, 7)(0, 0, 0)