[PR #2765] [MERGED] The dragon follows the server that flies it #4589

Closed
opened 2026-11-03 04:18:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2765
Author: @levzzz5154
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/dragon-follows-the-server


📝 Commits (7)

  • 6a960cb The dragon follows the server that flies it
  • 7932a01 Merge remote-tracking branch 'upstream/main' into fix/dragon-follows-the-server
  • b10747f Merge remote-tracking branch 'upstream/main' into fix/dragon-follows-the-server
  • 7c52ed0 Keep the steering comment
  • 83191a4 Merge remote-tracking branch 'upstream/main' into fix/dragon-follows-the-server
  • bd8885e Merge main into dragon-follows-the-server
  • 1590d00 Ease the server's dragon through the lerp tick_remote_dragon reads

📊 Changes

1 file changed (+10 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+10 -1)

📄 Description

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

What and why

On a world a server flies (a LAN world or a dedicated server), the ender
dragon was never drawn where the server's dragon is.

The client draws the dragon from its own state (game/dragon.rs: the
model, the flight history, the parts, the hits), not from the generic mob
list. But only the server's health, phase and damage reached that
state: Game::move_entity updated the generic mob copy of the dragon (which
has no model, so it draws nothing) and the dragon's fireballs, but never the
dragon the client draws. That one kept the position it had when the server
added the entity, so the dragon was drawn as a frozen model where it had
spawned while the server's dragon flew around the island — which is what
"the boss bar is there and it throws dragon's breath, but there is no dragon"
looked like.

The client's own flight machine made it worse: tick_dragon ran the phase
machine and the steering for that dragon as well, so it flew away from the
server's moves on its own.

What changed:

  • The server's move packets move the dragon the client draws
    (Game::follows_the_server in game/dragon.rs, called from
    Game::move_entity), the way every other entity of a server's follows
    them: the position before the move stays the previous one, so the dragon
    is drawn between the two, and the rotation turns it.
  • A dragon a server flies is no longer flown by the client's phase machine:
    the server flies it and sends its moves, its health and its phase, and the
    client only flaps its wings, keeps its flight history and places its
    parts — which is what the code around it already said it did.

Fixes #2083

Vanilla reference

  • net.minecraft.client.multiplayer.ClientPacketListener /
    ClientboundMoveEntityPacket and ClientboundEntityPositionSyncPacket:
    every entity of a server's is placed by the server's move packets, and
    Entity.moveTo/setPos interpolate between the previous and the new
    position.
  • net.minecraft.world.entity.boss.enderdragon.EnderDragon: the server
    flies it (EnderDragon.aiStep runs the phases on the server), and the
    client only runs the client side of it — the wings, the flight history
    (DragonFlightHistory) and the parts.
  • net.minecraft.world.entity.boss.enderdragon.phases.*: the phase is the
    server's and reaches the client as the synced EnderDragon.DATA_PHASE_ID
    (EnderDragon.onSyncedDataUpdated).
  • net.minecraft.client.renderer.entity.EnderDragonRenderer: the renderer
    draws the dragon from the flight history (state.getHistoricalPos(7)) and
    the model's own poses, so the dragon the client draws is the server's.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at f00228e76, 4 min 14 s)

Check Result
Scope ✅ 2 files, +93 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 331 passed (17 s)
rustfmt ✅ (4 s)
clippy ✅ (1 min 9 s)
tests: horizon-client ✅ 1330 passed (2 min 5 s)
doc tests ✅ 0 passed (30 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 ➖ 34 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 22 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
  • cargo test -p horizon-client --bin horizon-client -- dragon::tests

    running 7 tests
    test game::dragon::tests::a_quarter_of_its_health_while_perched_makes_it_take_off ... ok
    test game::dragon::tests::a_perched_dragon_shrugs_arrows_off ... ok
    test game::dragon::tests::a_remote_dragon_follows_the_server ... ok
    test game::dragon::tests::the_cooldown_lets_only_the_excess_through ... ok
    test game::dragon::tests::parts_and_sources ... ok
    test game::dragon::tests::the_dragon_targets_any_player_it_can_attack ... ok
    test game::dragon::tests::explosions_hit_each_part_by_its_exposure ... ok
    
    test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 129 filtered out; finished in 0.00s
    

    The new test gives the dragon a server's id, sends it the server's move
    and the server's rotation, and checks that it goes there, that the
    position it came from stays the previous one (so it is drawn between the
    two), that a rotation alone leaves the position alone, and that another
    entity's move is not the dragon's.

  • cargo fmt -p horizon-client — the tree is rustfmt-clean, and
    cargo clippy -p horizon-client --all-targets reports nothing in the files
    this pull request touches.

Not in this pull request

The glowing effect of #2014 (the outline a glowing entity gets) is a
separate change: vanilla draws the entity a second time with the outline
colour (EntityRenderer.extractRenderState: state.outlineColor = appearsGlowing ? ARGB.opaque(entity.getTeamColor()) : 0, drawn by
RenderTypes' outline pass), which needs a second pass of every entity's
model, not a fix of the dragon. It is not in this pull request.

🤖 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/2765 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/dragon-follows-the-server` --- ### 📝 Commits (7) - [`6a960cb`](https://github.com/horizon-rust/horizon/commit/6a960cbadb0f7886290a818e228149e0af216331) The dragon follows the server that flies it - [`7932a01`](https://github.com/horizon-rust/horizon/commit/7932a01b3f9fb560a75676115a257ca94a51e0ee) Merge remote-tracking branch 'upstream/main' into fix/dragon-follows-the-server - [`b10747f`](https://github.com/horizon-rust/horizon/commit/b10747f9673c4028ee901fee038a52bcae5ba35c) Merge remote-tracking branch 'upstream/main' into fix/dragon-follows-the-server - [`7c52ed0`](https://github.com/horizon-rust/horizon/commit/7c52ed040026a9a3f1ef954148dedbd34d4f9e11) Keep the steering comment - [`83191a4`](https://github.com/horizon-rust/horizon/commit/83191a446846cce88b16028769c182bd58188441) Merge remote-tracking branch 'upstream/main' into fix/dragon-follows-the-server - [`bd8885e`](https://github.com/horizon-rust/horizon/commit/bd8885e4f212667031bebf95db568768a21d7ee8) Merge main into dragon-follows-the-server - [`1590d00`](https://github.com/horizon-rust/horizon/commit/1590d00572183fb3cda834c76ea6b76a520ad1ff) Ease the server's dragon through the lerp tick_remote_dragon reads ### 📊 Changes **1 file changed** (+10 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+10 -1) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why On a world a server flies (a LAN world or a dedicated server), the ender dragon was never drawn where the server's dragon is. The client draws the dragon from its own state (`game/dragon.rs`: the model, the flight history, the parts, the hits), not from the generic mob list. But only the server's *health*, *phase* and *damage* reached that state: `Game::move_entity` updated the generic mob copy of the dragon (which has no model, so it draws nothing) and the dragon's fireballs, but never the dragon the client draws. That one kept the position it had when the server added the entity, so the dragon was drawn as a frozen model where it had spawned while the server's dragon flew around the island — which is what "the boss bar is there and it throws dragon's breath, but there is no dragon" looked like. The client's own flight machine made it worse: `tick_dragon` ran the phase machine and the steering for that dragon as well, so it flew away from the server's moves on its own. What changed: - The server's move packets move the dragon the client draws (`Game::follows_the_server` in `game/dragon.rs`, called from `Game::move_entity`), the way every other entity of a server's follows them: the position before the move stays the previous one, so the dragon is drawn between the two, and the rotation turns it. - A dragon a server flies is no longer flown by the client's phase machine: the server flies it and sends its moves, its health and its phase, and the client only flaps its wings, keeps its flight history and places its parts — which is what the code around it already said it did. Fixes #2083 ## Vanilla reference - `net.minecraft.client.multiplayer.ClientPacketListener` / `ClientboundMoveEntityPacket` and `ClientboundEntityPositionSyncPacket`: every entity of a server's is placed by the server's move packets, and `Entity.moveTo`/`setPos` interpolate between the previous and the new position. - `net.minecraft.world.entity.boss.enderdragon.EnderDragon`: the server flies it (`EnderDragon.aiStep` runs the phases on the server), and the client only runs the client side of it — the wings, the flight history (`DragonFlightHistory`) and the parts. - `net.minecraft.world.entity.boss.enderdragon.phases.*`: the phase is the server's and reaches the client as the synced `EnderDragon.DATA_PHASE_ID` (`EnderDragon.onSyncedDataUpdated`). - `net.minecraft.client.renderer.entity.EnderDragonRenderer`: the renderer draws the dragon from the flight history (`state.getHistoricalPos(7)`) and the model's own poses, so the dragon the client draws is the server's. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at f00228e76, 4 min 14 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +93 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 331 passed (17 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (1 min 9 s) | | tests: horizon-client | ✅ 1330 passed (2 min 5 s) | | doc tests | ✅ 0 passed (30 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 | ➖ 34 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 22 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | * `cargo test -p horizon-client --bin horizon-client -- dragon::tests` ``` running 7 tests test game::dragon::tests::a_quarter_of_its_health_while_perched_makes_it_take_off ... ok test game::dragon::tests::a_perched_dragon_shrugs_arrows_off ... ok test game::dragon::tests::a_remote_dragon_follows_the_server ... ok test game::dragon::tests::the_cooldown_lets_only_the_excess_through ... ok test game::dragon::tests::parts_and_sources ... ok test game::dragon::tests::the_dragon_targets_any_player_it_can_attack ... ok test game::dragon::tests::explosions_hit_each_part_by_its_exposure ... ok test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 129 filtered out; finished in 0.00s ``` The new test gives the dragon a server's id, sends it the server's move and the server's rotation, and checks that it goes there, that the position it came from stays the previous one (so it is drawn between the two), that a rotation alone leaves the position alone, and that another entity's move is not the dragon's. * `cargo fmt -p horizon-client` — the tree is rustfmt-clean, and `cargo clippy -p horizon-client --all-targets` reports nothing in the files this pull request touches. ## Not in this pull request The **glowing effect** of #2014 (the outline a glowing entity gets) is a separate change: vanilla draws the entity a second time with the outline colour (`EntityRenderer.extractRenderState`: `state.outlineColor = appearsGlowing ? ARGB.opaque(entity.getTeamColor()) : 0`, drawn by `RenderTypes`' outline pass), which needs a second pass of every entity's model, not a fix of the dragon. It is not in this pull request. 🤖 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 04:18:17 +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#4589
No description provided.