[GH-ISSUE #3790] Ghast: its target position, move control timing, look angle and shot sounds drift from vanilla's #1088

Closed
opened 2026-11-02 15:44:10 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @xFedeT on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3790

🤖 Filed by Federico's AI agent (Claude), not by Federico himself.

What: a ghast diverges from vanilla's in four ways, found by a mob_ai scenario (a ghast and a player 7 blocks away):

  1. Ghast.RandomFloatAroundGoal.getSuitableFlyToPosition returns the first random position (distanceToBlocks 0); the mirror under the heightmap only applies after 64 rejected tries. Horizon mirrored whenever the ground was below the target, so a ghast over the ground flew away from the player's height half of the time.
  2. GhastMoveControl.tick tests floatDuration-- <= 0 before the decrement; Horizon tested after it, so its pushes came one tick early.
  3. GhastLookGoal sets the yaw with -(float)Mth.atan2(x, z) * (180.0F / (float)Math.PI); Horizon used f32::to_degrees on a different atan2, 2 ulp off.
  4. The warning cry (level event 1015) and the shot (1016) take their pitch from the client's random; Horizon drew it from the ghast's own random, which shifted every later draw.

How to reproduce: the scenario diverges at tick 1 (the target's height is mirrored), then at ticks 2, 5, 8 and 17 for the other three.

Where in Horizon: crates/horizon-client/src/mobs/nether.rs.

Originally created by @xFedeT on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3790 > 🤖 Filed by Federico's AI agent (Claude), not by Federico himself. **What:** a ghast diverges from vanilla's in four ways, found by a `mob_ai` scenario (a ghast and a player 7 blocks away): 1. `Ghast.RandomFloatAroundGoal.getSuitableFlyToPosition` returns the first random position (distanceToBlocks 0); the mirror under the heightmap only applies after 64 rejected tries. Horizon mirrored whenever the ground was below the target, so a ghast over the ground flew away from the player's height half of the time. 2. `GhastMoveControl.tick` tests `floatDuration-- <= 0` before the decrement; Horizon tested after it, so its pushes came one tick early. 3. `GhastLookGoal` sets the yaw with `-(float)Mth.atan2(x, z) * (180.0F / (float)Math.PI)`; Horizon used `f32::to_degrees` on a different atan2, 2 ulp off. 4. The warning cry (level event 1015) and the shot (1016) take their pitch from the client's random; Horizon drew it from the ghast's own random, which shifted every later draw. **How to reproduce:** the scenario diverges at tick 1 (the target's height is mirrored), then at ticks 2, 5, 8 and 17 for the other three. **Where in Horizon:** `crates/horizon-client/src/mobs/nether.rs`.
Author
Owner

@xFedeT commented on GitHub (Oct 29, 2026):

🤖 Agent: PR #3791 is open (Federico's agent) with the four fixes and a ghast_player scenario that matches 322/322 ticks.

<!-- gh-comment-id:6502070931 --> @xFedeT commented on GitHub (Oct 29, 2026): 🤖 Agent: PR #3791 is open (Federico's agent) with the four fixes and a `ghast_player` scenario that matches 322/322 ticks.
Author
Owner

@kira-horizon[bot] commented on GitHub (Oct 29, 2026):

Claimed by FedeT_ on Discord (GitHub: xFedeT), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #3790).

<!-- gh-comment-id:6506439382 --> @kira-horizon[bot] commented on GitHub (Oct 29, 2026): Claimed by `FedeT_` on Discord (GitHub: `xFedeT`), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #3790). <!-- kira:work -->
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#1088
No description provided.