[PR #4152] [MERGED] Run a same-click attack before the use in single player #5444

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4152
Author: @DUzzL
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/issue-4147-same-click-block-replace


📝 Commits (1)

  • e8c32f6 Run single-player use clicks after attack clicks within a tick

📊 Changes

2 files changed (+29 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+6 -3)
📝 crates/horizon-client/src/game/hand.rs (+23 -0)

📄 Description

🤖 Opened by DUzzL's AI agent, not by DUzzL personally.

Fixes #4147

Cause: in single player the right click ran use_with_hand immediately in the mouse handler, while the left click was queued for the next tick. A same-click place and break therefore ran use first, then attack, so the place hit the block behind the broken one. Vanilla's handleKeybinds runs attack first, then use.

Change: right clicks are queued as use_clicks in game.rs. tick_local_hand in game/hand.rs drains them after the attack clicks, and caches the hit (tick_hit) when both are pending. A right click alone still runs in the same tick, and stop_mining resets the queue. The multiplayer path (remote.rs) is unchanged.

Tested: cargo fmt --check and cargo clippy -p horizon-client --all-targets -- -D warnings pass. cargo test -p horizon-client --bins hand passes (5 of 5; --lib first_person was not rerun). No new test covers the ordering.

Not tested: no in-game run, so a same-click place onto the just-broken block is not confirmed. A lone right click now acts on the next tick (up to 50 ms later), as in vanilla. No vanilla parity run (no .local vanilla data here). tools/pr_ready.py not run.


🔄 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/4152 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/issue-4147-same-click-block-replace` --- ### 📝 Commits (1) - [`e8c32f6`](https://github.com/horizon-rust/horizon/commit/e8c32f6610d46d11f0a2c33e7330538a308b63af) Run single-player use clicks after attack clicks within a tick ### 📊 Changes **2 files changed** (+29 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -3) 📝 `crates/horizon-client/src/game/hand.rs` (+23 -0) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent, not by DUzzL personally. Fixes #4147 **Cause:** in single player the right click ran `use_with_hand` immediately in the mouse handler, while the left click was queued for the next tick. A same-click place and break therefore ran use first, then attack, so the place hit the block behind the broken one. Vanilla's `handleKeybinds` runs attack first, then use. **Change:** right clicks are queued as `use_clicks` in `game.rs`. `tick_local_hand` in `game/hand.rs` drains them after the attack clicks, and caches the hit (`tick_hit`) when both are pending. A right click alone still runs in the same tick, and `stop_mining` resets the queue. The multiplayer path (`remote.rs`) is unchanged. **Tested:** `cargo fmt --check` and `cargo clippy -p horizon-client --all-targets -- -D warnings` pass. `cargo test -p horizon-client --bins hand` passes (5 of 5; `--lib first_person` was not rerun). No new test covers the ordering. **Not tested:** no in-game run, so a same-click place onto the just-broken block is not confirmed. A lone right click now acts on the next tick (up to 50 ms later), as in vanilla. No vanilla parity run (no `.local` vanilla data here). `tools/pr_ready.py` not run. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:12:38 +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#5444
No description provided.