[GH-ISSUE #7147] Spawn eggs create duplicate mobs when used underwater #3152

Closed
opened 2026-11-03 04:06:16 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @byMehd on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7147

When the player is fully submerged underwater and uses a spawn egg while aiming at a solid block, two mobs appear instead of one.

One mob spawns on top of the player's head, while the other spawns on the targeted block.

In vanilla Minecraft Java Edition, only one mob should spawn.

Possibly related issue:
https://github.com/horizon-rust/horizon/issues/5967

This may have already been fixed by a related change, but it needs to be verified on a newer nightly build.

Tested on:

  • OS: Windows PC
  • Horizon version: Nightly c9d474d
Originally created by @byMehd on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7147 When the player is fully submerged underwater and uses a spawn egg while aiming at a solid block, two mobs appear instead of one. One mob spawns on top of the player's head, while the other spawns on the targeted block. In vanilla Minecraft Java Edition, only one mob should spawn. **Possibly related issue:** https://github.com/horizon-rust/horizon/issues/5967 This may have already been fixed by a related change, but it needs to be verified on a newer nightly build. Tested on: - OS: Windows PC - Horizon version: Nightly `c9d474d`
Author
Owner

@Joansitoh commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

Claimed by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally.

Cause: the client never ends the click after a spawn egg is used on a block. predict_item_on_block (crates/horizon-client/src/game/remote.rs, called from remote_use_item_on ~7205) has no spawn-egg branch, so it returns false and remote_use_hands then also sends UseItem (remote.rs ~7829/7889). On the server UseItemOn runs use_spawn_egg (game/creatures.rs ~6066, fluid=false) and spawns one mob on the clicked face; UseItem runs use_spawn_egg again through spawn_egg_fluid_hit/bucket_hit (ray from the eye, which is inside the water) and spawns a second mob at the head block. In air the fluid ray finds nothing, so only one mob appears. Vanilla SpawnEggItem.useOn returns FAIL when !type.canSpawn(level) and SUCCESS on a client level otherwise, so Minecraft.startUseItem ends the click and never sends UseItem after a block hit.

Plan (~15-30 lines, client only, also covers LAN guests and dedicated servers since they use the same client code): add the vanilla client-side spawn-egg result before/in predict_item_on_block (FAIL without swing when the egg cannot spawn, otherwise SUCCESS with swing, adventure can_place_on gating like the firework branch); extend tools/test_spawn_egg_fluid_parity.py with an underwater block-use case expecting one mob plus a unit test of the branch.

<!-- gh-comment-id:6576643652 --> @Joansitoh commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim Claimed by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. Cause: the client never ends the click after a spawn egg is used on a block. `predict_item_on_block` (`crates/horizon-client/src/game/remote.rs`, called from `remote_use_item_on` ~7205) has no spawn-egg branch, so it returns false and `remote_use_hands` then also sends `UseItem` (`remote.rs` ~7829/7889). On the server `UseItemOn` runs `use_spawn_egg` (`game/creatures.rs` ~6066, fluid=false) and spawns one mob on the clicked face; `UseItem` runs `use_spawn_egg` again through `spawn_egg_fluid_hit`/`bucket_hit` (ray from the eye, which is inside the water) and spawns a second mob at the head block. In air the fluid ray finds nothing, so only one mob appears. Vanilla `SpawnEggItem.useOn` returns FAIL when `!type.canSpawn(level)` and SUCCESS on a client level otherwise, so `Minecraft.startUseItem` ends the click and never sends `UseItem` after a block hit. Plan (~15-30 lines, client only, also covers LAN guests and dedicated servers since they use the same client code): add the vanilla client-side spawn-egg result before/in `predict_item_on_block` (FAIL without swing when the egg cannot spawn, otherwise SUCCESS with swing, adventure `can_place_on` gating like the firework branch); extend `tools/test_spawn_egg_fluid_parity.py` with an underwater block-use case expecting one mob plus a unit test of the branch.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, You hold 8 open issues: finish or /unclaim one first. (asked by @Joansitoh)

<!-- gh-comment-id:6576646763 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, You hold 8 open issues: finish or `/unclaim` one first. (asked by @Joansitoh)
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, This issue is closed. (asked by @Akirabane)

<!-- gh-comment-id:6577696196 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, This issue is closed. (asked by @Akirabane)
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#3152
No description provided.