[PR #4675] [MERGED] Anticheat: the ground check (no-fall, walking on water) #5773

Closed
opened 2026-11-03 05:14:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4675
Author: @ludovic111
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @ludovic111

Base: main ← Head: feat/anticheat-ground


📝 Commits (2)

  • 8975278 Anticheat: the ground check (no-fall, walking on water)
  • 6034bab Anticheat ground: a happy ghast's rider, and a grace for vanished ground

📊 Changes

8 files changed (+248 additions, -8 deletions)

View changed files

📝 crates/horizon-anticheat/src/lib.rs (+8 -0)
📝 crates/horizon-bots/src/main.rs (+14 -2)
📝 crates/horizon-client/src/lan/anticheat.rs (+148 -1)
📝 crates/horizon-client/src/lan/chunks.rs (+7 -0)
📝 crates/horizon-client/src/lan/hub.rs (+14 -0)
📝 docs/anticheat.md (+2 -0)
📝 tools/anticheat_e2e.py (+48 -4)
📝 tools/server_bench.py (+7 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What and why

The first movement check of the dedicated server's anticheat (#4607). Off unless [anticheat] is in server.toml; nothing changes for a server without it (one Option test per move that claims the ground).

ground catches no-fall (the client says it's on the ground while falling, so the fall never hurts) and walking on water (it says it stands on the surface). Vanilla trusts the client's on-ground flag (ServerGamePacketListenerImpl.handlePlayerPositionChange → setOnGroundWithMovement, then doCheckFallDamage). The server already has the blocks to check the claim against.

A move that claims the ground is judged only when nothing there could hold anyone:

  • every block around the feet (from 0.6 below them, the body's box 1/16 wider) is air or a fluid. Anything else (powder snow, scaffolding, a fence, a slab, a light block...) means it isn't judged;
  • nothing collides when the box moves a tenth of a block down (a waterlogged slab holds the player);
  • no boat, raft, minecart, shulker or happy ghast under the player (4 blocks sideways, from a block above to 4.5 below: a happy ghast's rider stands 4.0 above it);
  • not at the height where the ground last held the player within the last 10 ticks (a block broken or pushed away server-side before the client heard);
  • the move itself didn't land on something (verticalCollisionBelow), and the player isn't in creative, spectating or gliding (no fall damage to skip).

A false claim is dropped, so vanilla's fall damage follows when the player really lands. The check's level then acts as configured: from 5 the player is sent back, from 15 alerted, from 60 kicked, with a decay of 2 a second. A ghost block left by a refused placement lasts one round trip, a few flags, so it stays under 5.

[anticheat.ground]   # every key optional
setback = 5
alert = 15
kick = 60
decay = 2

Cost (measured)

60 bots walking on the ground in survival, so every move claims the ground and goes through the check: tools/server_bench.py --servers horizon --bots 60 --behaviour walk --ground (new --ground: a flat survival world, bots with --height 0 --ground), Mac mini, 120 s measured after 30 s of warm-up, MSPT from /tick query. Runs interleaved, main / off / on, twice:

server MSPT avg (run 1 / run 2) P95 P99 flags
main (073afd484) 4.37 / 4.39 4.91 / 4.90 5.31 / 5.34 –
this branch, anticheat off 4.23 / 4.37 4.76 / 4.86 5.12 / 5.27 0 / 0
this branch, anticheat on 4.49 / 4.24 5.14 / 4.71 6.34 / 5.22 0 / 0

All three are within run-to-run noise: on was the slowest in round 1 and the fastest in round 2. For a player on the ground the scan stops at the first block it reads, the one under the feet. None of the 60 legit bots was flagged.

Originality

Written from vanilla 26.3 (handlePlayerPositionChange, Entity.move's verticalCollisionBelow, noBlocksAround, LivingEntity.checkFallDamage) and the public description of what no-fall and jesus cheats do. No other anticheat's code or docs were read.

Tests

  • tools/anticheat_e2e.py --check ground (new), a real survival dedicated server (allow-flight on, so vanilla's floating kick stays out of it):
    • a bot hovering 24 blocks up that claims the ground in every move is flagged "in the air", sent back, alerted and kicked;
    • a bot teleported away, under which the console pours water (fill ... minecraft:water), is flagged "on a fluid" only once the water is there, then kicked;
    • 3 bots walking on the ground and 2 standing still are never flagged.
  • --check off and --check timer pass again on this build.
  • horizon-bots: --height H (how high the bots fly; default 24) and --ground (claim the ground in every move).

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 073afd484, 9 min 18 s)

Check Result
Scope ✅ 8 files, +248 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (1 min 41 s)
rustfmt ✅ (5 s)
clippy ✅ (46 s)
tests: horizon-anticheat, horizon-bots, horizon-client ✅ 1113 passed (6 min 3 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 33 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 21 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Harnesses (tools/parity.py --changed origin/main, Mac mini): 34 of 35 pass (cursor_death on its retry with fresh oracle results). lunge_motion fails, and fails the same way on main (3a5ac7ffe, checked for #4645): its vanilla transcript's vertical motion differs at a different step from run to run. It's an integrated-server probe, where the anticheat never runs.
tools/anticheat_e2e.py: off, timer and ground pass.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4675 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/anticheat-ground` --- ### 📝 Commits (2) - [`8975278`](https://github.com/horizon-rust/horizon/commit/8975278e5e5a84fe516102f6f6cd511ed0498ae9) Anticheat: the ground check (no-fall, walking on water) - [`6034bab`](https://github.com/horizon-rust/horizon/commit/6034bab012b29d5e0274dfca74e41ac1a28b18e5) Anticheat ground: a happy ghast's rider, and a grace for vanished ground ### 📊 Changes **8 files changed** (+248 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-anticheat/src/lib.rs` (+8 -0) 📝 `crates/horizon-bots/src/main.rs` (+14 -2) 📝 `crates/horizon-client/src/lan/anticheat.rs` (+148 -1) 📝 `crates/horizon-client/src/lan/chunks.rs` (+7 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+14 -0) 📝 `docs/anticheat.md` (+2 -0) 📝 `tools/anticheat_e2e.py` (+48 -4) 📝 `tools/server_bench.py` (+7 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What and why The first movement check of the dedicated server's anticheat (#4607). **Off unless `[anticheat]` is in `server.toml`**; nothing changes for a server without it (one `Option` test per move that claims the ground). **`ground`** catches **no-fall** (the client says it's on the ground while falling, so the fall never hurts) and **walking on water** (it says it stands on the surface). Vanilla trusts the client's on-ground flag (`ServerGamePacketListenerImpl.handlePlayerPositionChange` → `setOnGroundWithMovement`, then `doCheckFallDamage`). The server already has the blocks to check the claim against. A move that claims the ground is judged only when nothing there could hold anyone: - every block around the feet (from 0.6 below them, the body's box 1/16 wider) is air or a fluid. Anything else (powder snow, scaffolding, a fence, a slab, a light block...) means it isn't judged; - nothing collides when the box moves a tenth of a block down (a waterlogged slab holds the player); - no boat, raft, minecart, shulker or happy ghast under the player (4 blocks sideways, from a block above to 4.5 below: a happy ghast's rider stands 4.0 above it); - not at the height where the ground last held the player within the last 10 ticks (a block broken or pushed away server-side before the client heard); - the move itself didn't land on something (`verticalCollisionBelow`), and the player isn't in creative, spectating or gliding (no fall damage to skip). A false claim is **dropped**, so vanilla's fall damage follows when the player really lands. The check's level then acts as configured: from 5 the player is sent back, from 15 alerted, from 60 kicked, with a decay of 2 a second. A ghost block left by a refused placement lasts one round trip, a few flags, so it stays under 5. ```toml [anticheat.ground] # every key optional setback = 5 alert = 15 kick = 60 decay = 2 ``` ## Cost (measured) 60 bots walking on the ground in **survival**, so every move claims the ground and goes through the check: `tools/server_bench.py --servers horizon --bots 60 --behaviour walk --ground` (new `--ground`: a flat survival world, bots with `--height 0 --ground`), Mac mini, 120 s measured after 30 s of warm-up, MSPT from `/tick query`. Runs interleaved, main / off / on, twice: | server | MSPT avg (run 1 / run 2) | P95 | P99 | flags | |---|---|---|---|---| | main (073afd484) | 4.37 / 4.39 | 4.91 / 4.90 | 5.31 / 5.34 | – | | this branch, anticheat off | 4.23 / 4.37 | 4.76 / 4.86 | 5.12 / 5.27 | 0 / 0 | | this branch, anticheat on | 4.49 / 4.24 | 5.14 / 4.71 | 6.34 / 5.22 | 0 / 0 | All three are within run-to-run noise: on was the slowest in round 1 and the fastest in round 2. For a player on the ground the scan stops at the first block it reads, the one under the feet. None of the 60 legit bots was flagged. ## Originality Written from vanilla 26.3 (`handlePlayerPositionChange`, `Entity.move`'s `verticalCollisionBelow`, `noBlocksAround`, `LivingEntity.checkFallDamage`) and the public description of what no-fall and jesus cheats do. No other anticheat's code or docs were read. ## Tests - `tools/anticheat_e2e.py --check ground` (new), a real survival dedicated server (allow-flight on, so vanilla's floating kick stays out of it): - a bot hovering 24 blocks up that claims the ground in every move is flagged "in the air", sent back, alerted and kicked; - a bot teleported away, under which the console pours water (`fill ... minecraft:water`), is flagged "on a fluid" only once the water is there, then kicked; - 3 bots walking on the ground and 2 standing still are never flagged. - `--check off` and `--check timer` pass again on this build. - horizon-bots: `--height H` (how high the bots fly; default 24) and `--ground` (claim the ground in every move). **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 073afd484, 9 min 18 s) | Check | Result | | --- | --- | | Scope | ✅ 8 files, +248 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (1 min 41 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (46 s) | | tests: horizon-anticheat, horizon-bots, horizon-client | ✅ 1113 passed (6 min 3 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 33 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 21 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | **Harnesses** (`tools/parity.py --changed origin/main`, Mac mini): 34 of 35 pass (`cursor_death` on its retry with fresh oracle results). `lunge_motion` fails, and fails the same way on main (3a5ac7ffe, checked for #4645): its vanilla transcript's vertical motion differs at a different step from run to run. It's an integrated-server probe, where the anticheat never runs. `tools/anticheat_e2e.py`: off, timer and ground pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:53 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5773
No description provided.