[PR #268] [MERGED] Prevent block interactions through targeted entities #2453

Closed
opened 2026-11-02 15:56:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/268
Author: @Online5277
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: fix/entity-use-occlusion


📝 Commits (1)

  • 22e5484 Keep entity item use from falling through to blocks

📊 Changes

3 files changed (+47 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+39 -18)
📝 crates/horizon-client/src/game/creatures.rs (+3 -1)
📝 crates/horizon-client/src/game/end.rs (+5 -1)

📄 Description

Right-clicking a non-consuming entity currently falls through to a second block pick, so a cow in front of a chest can open that chest, and sneaking with a block can place it behind the cow. Keep the block hit only when the crosshair does not target an entity, and use that same decision for block interactions, placement, block tools, bone meal, TNT, spawn eggs and End portal eye insertion. A closer block keeps its existing path.

Generic item use remains available after a non-consuming entity interaction, including fishing rods, eating and existing offhand shielding. Animals that recognize food still consume the interaction when breeding is unavailable, without taking food, swinging or starting player eating.

The existing tool and Ender-eye helpers combine useOn with generic use, so their block actions are gated separately. The pinned 26.3 BucketItem, BoatItem, and EnderEyeItem classes clarify an exception to a blanket “skip every later ray” rule: generic bucket/boat use casts its own ray, while generic Ender-eye use passes when its own ray hits a portal frame. Those paths remain available, but an entity hit cannot insert an eye into the frame.

Closes #217.

Validation:

  • Existing game-binary tests and first-person library tests pass, compiling the affected runtime code.
  • Client all-target Clippy with warnings denied; formatting, diff and public-tree checks pass.
  • Independent review of all changed block-use guards and generic-use fall-through.

No game window was launched. These tests do not reproduce the full entity/chest interaction: the existing runtime initializer has no cheap direct unit-test seam. Manual checks should cover empty-hand chest occlusion, a fishing rod still casting, sneaking placement being blocked, a closer chest opening, and rejected animal feeding not starting player eating. Offhand support remains the existing shield path; this does not implement general offhand entity/item interactions.


🔄 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/268 **Author:** [@Online5277](https://github.com/Online5277) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/entity-use-occlusion` --- ### 📝 Commits (1) - [`22e5484`](https://github.com/horizon-rust/horizon/commit/22e548471c4093ad3ad626dcd636edb832042f6e) Keep entity item use from falling through to blocks ### 📊 Changes **3 files changed** (+47 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+39 -18) 📝 `crates/horizon-client/src/game/creatures.rs` (+3 -1) 📝 `crates/horizon-client/src/game/end.rs` (+5 -1) </details> ### 📄 Description Right-clicking a non-consuming entity currently falls through to a second block pick, so a cow in front of a chest can open that chest, and sneaking with a block can place it behind the cow. Keep the block hit only when the crosshair does not target an entity, and use that same decision for block interactions, placement, block tools, bone meal, TNT, spawn eggs and End portal eye insertion. A closer block keeps its existing path. Generic item use remains available after a non-consuming entity interaction, including fishing rods, eating and existing offhand shielding. Animals that recognize food still consume the interaction when breeding is unavailable, without taking food, swinging or starting player eating. The existing tool and Ender-eye helpers combine `useOn` with generic `use`, so their block actions are gated separately. The pinned 26.3 `BucketItem`, `BoatItem`, and `EnderEyeItem` classes clarify an exception to a blanket “skip every later ray” rule: generic bucket/boat use casts its own ray, while generic Ender-eye use passes when its own ray hits a portal frame. Those paths remain available, but an entity hit cannot insert an eye into the frame. Closes #217. Validation: - Existing game-binary tests and first-person library tests pass, compiling the affected runtime code. - Client all-target Clippy with warnings denied; formatting, diff and public-tree checks pass. - Independent review of all changed block-use guards and generic-use fall-through. No game window was launched. These tests do not reproduce the full entity/chest interaction: the existing runtime initializer has no cheap direct unit-test seam. Manual checks should cover empty-hand chest occlusion, a fishing rod still casting, sneaking placement being blocked, a closer chest opening, and rejected animal feeding not starting player eating. Offhand support remains the existing shield path; this does not implement general offhand entity/item interactions. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56: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#2453
No description provided.