feat: add pose system, slime block bounce, and crawling to physics engine

Implement the three Phase 0 prerequisites for the pathfinding rewrite:

- Pose system (vanilla Player.updatePlayerPose): dynamic AABB height based
  on current pose -- Standing (1.8), Sneaking (1.5), Swimming/Crawling (0.6).
  Automatically downgrades pose when headroom is insufficient (Standing ->
  Sneaking -> Swimming), matching vanilla 1.14+ forced-crawl behavior.

- Slime block bounce (vanilla SlimeBlock.bounceUp / stepOn): reverses
  downward velocity on landing, with sneaking suppression via
  isSuppressingBounce(). Also applies the horizontal slowdown effect
  from SlimeBlock.stepOn when walking on slime with low vertical velocity.

- Per-pose dimension constants in PhysicsConsts with eye heights for each
  pose, sourced from vanilla Avatar.POSES (26.1 decompiled).

- Debug logging for pose transitions, slime bounces, and periodic physics
  state dumps routed through McClient's ILogger.

Tested on a real 1.21.11 server: crawling triggers correctly under 1-block
ceilings, sneaking under 1.5-block ceilings, slime bounce produces correct
decaying oscillation, and pose recovery works when obstacles are removed.

Made-with: Cursor
This commit is contained in:
BruceChen 2026-04-11 01:35:58 +08:00
parent 4013d39068
commit 3efe63c54d
3 changed files with 186 additions and 17 deletions

View file

@ -685,6 +685,7 @@ namespace MinecraftClient
playerPhysics.SetPosition(location.X, location.Y, location.Z);
playerPhysics.Yaw = playerYaw;
playerPhysics.Pitch = playerPitch;
playerPhysics.DebugLog = msg => Log.Debug(msg);
physicsInitialized = true;
}