[PR #784] [CLOSED] fix(game): allow hoes and shovels to transform blocks with offhand shield (#549) #2806

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/784
Author: @lazy-importer
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: fix/hoe-till-with-offhand-shield


📝 Commits (1)

  • 6aec8e4 fix(game): allow hoes and shovels to transform blocks with offhand shield (#549)

📊 Changes

1 file changed (+47 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+47 -3)

📄 Description

What and why

Fixes #549.

In vanilla Java Edition, playerHasBlockingItemUseIntent (which prioritizes raising an off-hand shield over right-clicking a block) is exclusive to AxeItem, where holding an axe in combat defaults to shield blocking unless sneaking.

Hoes and shovels, however, do not check for blocking intent: players can till dirt / grass into farmland with a hoe or create dirt paths with a shovel even when a shield is equipped in the off-hand.

In Horizon, use_block_transformer previously applied the off-hand shield check globally to all block transformations, preventing hoes from tilling farmland and shovels from flattening paths unless sneaking.

This change:

  • Restricts the off-hand shield check (playerHasBlockingItemUseIntent) in use_block_transformer to axes (_axe / minecraft:axe).
  • Allows hoes and shovels to transform blocks regardless of whether a shield is held in the off-hand.
  • Adds unit test offhand_shield_only_blocks_axes_when_not_sneaking.

Vanilla reference

Follows vanilla AxeItem.useOn, AxeItem.playerHasBlockingItemUseIntent, HoeItem.useOn, and ShovelItem.useOn.

Self-check

Check Result
Scope ✅ 1 file, minimal and targeted
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅
clippy ✅
tests: horizon-client ✅ passed

🔄 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/784 **Author:** [@lazy-importer](https://github.com/lazy-importer) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/hoe-till-with-offhand-shield` --- ### 📝 Commits (1) - [`6aec8e4`](https://github.com/horizon-rust/horizon/commit/6aec8e42177989c8f0ab9a679acfcc5762c9d06d) fix(game): allow hoes and shovels to transform blocks with offhand shield (#549) ### 📊 Changes **1 file changed** (+47 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+47 -3) </details> ### 📄 Description ## What and why Fixes #549. In vanilla Java Edition, `playerHasBlockingItemUseIntent` (which prioritizes raising an off-hand shield over right-clicking a block) is exclusive to `AxeItem`, where holding an axe in combat defaults to shield blocking unless sneaking. Hoes and shovels, however, do not check for blocking intent: players can till dirt / grass into farmland with a hoe or create dirt paths with a shovel even when a shield is equipped in the off-hand. In Horizon, `use_block_transformer` previously applied the off-hand shield check globally to all block transformations, preventing hoes from tilling farmland and shovels from flattening paths unless sneaking. This change: - Restricts the off-hand shield check (`playerHasBlockingItemUseIntent`) in `use_block_transformer` to axes (`_axe` / `minecraft:axe`). - Allows hoes and shovels to transform blocks regardless of whether a shield is held in the off-hand. - Adds unit test `offhand_shield_only_blocks_axes_when_not_sneaking`. ## Vanilla reference Follows vanilla `AxeItem.useOn`, `AxeItem.playerHasBlockingItemUseIntent`, `HoeItem.useOn`, and `ShovelItem.useOn`. ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 1 file, minimal and targeted | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ✅ passed | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:59:13 +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#2806
No description provided.