Skip to content

fix(place): pick the block under the player when looking down past an edge - #72

Merged
notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/vanilla-build-assist
Nov 6, 2026
Merged

notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/vanilla-build-assist

Conversation

@NaySurGithub

Copy link
Copy Markdown
Contributor

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 the HitResult that ClientInstance::_tickBuildAction (0x1465A2950) then uses:

  1. The normal pick hits no block (HitResult type 2 / 3), in the regular aiming mode (the pick context's byte 0).
  2. If the look direction's y < -0.7 (0x144E0A75C, about 44.4° below the horizon), it clips blocks only, no liquids, from the eye to eye + (0, -2, 0) (xmmword_14F0AE7C0, BlockSource vfunc +0x198).
  3. If that clip hits a block (type 0 / 1), it becomes the frame's hit:
    • it keeps its hit point mPos, on top of the block under the player;
    • the face is replaced by the look's dominant horizontal axis: (dir.z < 0) ^ 3 → 2 / 3, or (dir.x < 0) ^ 5 → 4 / 5 when |dir.x| > |dir.z|;
    • it sets the byte at +0x84.
  4. Held repeats (0x14376B8D0) only use a direct hit when type == 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) sends clickPos = mPos - BlockPos = (eye fraction x, 1, eye fraction z), with the horizontal face.

Change

  • Perlin::UpdateAim: when the normal raycast hits nothing and look.y < -0.7, raycast blocks only from the eye, straight down, 2 blocks. A block hit becomes aimHit, with the vanilla face rule and buildAssist = true. The hit point is kept, so the outline shows and clickOf gives the vanilla click.
  • AimHit::buildAssist / heldbuild::Hit::assist: HeldBuild::Next skips the direct-hit branch for these hits, like the !hit[0x84] check.

Nothing from the old FindTarget comes 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:

Placement Face clickPos Source
(1, 86, 16) looking north at 69.9° 2 (0.475, 1, 0.494) look-down pick
(1, 68, 1) looking west at 68.6° 4 (0.572, 1, 0.652) look-down pick
(1, 86, 15) 318 ms later, still held, moving north 2 (0.44, 1, 0.651) held repeat: last built block + movement face (0x14376B8D0)
(1, 86, 9) / (1, 86, 8) / (1, 86, 7) 2 (0, 0, 0) build line with no hit, 180 ms catch-up
  • Look-down picks show the outline and place the block in front.
  • No kick or disconnect during the session.
  • Not checked: the touch-input pick path, which vanilla handles separately. This PR applies the look-down pick in every input mode.

… 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.
@notchyves
notchyves merged commit 01d2b93 into theselauraproject:main Nov 6, 2026
5 of 10 checks passed
notchyves pushed a commit that referenced this pull request Nov 6, 2026
#74)

#72 inserted 'assist' right after 'block', so heldbuild_selftest's
Hit{true, {{0, 0, 0}, 5}, {1, 0.5f, 0.5f}} fed the target into the bool and
every CI build failed on that test. 'assist' now comes last.
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.

2 participants