[PR #3579] [MERGED] Let the off hand go when a bucket, bottle or boat has no target #5069

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3579
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix-3147


📝 Commits (1)

  • 53beacf Let the off hand go when a bucket, bottle or boat has no target

📊 Changes

2 files changed (+85 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/game/boats.rs (+23 -16)
📝 crates/horizon-client/src/game/remote.rs (+62 -0)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

Fixes #3147

With a bucket (empty or full), a glass bottle or a boat in the main hand, a Riptide trident in the off hand would not charge. This happened in single player and on servers. On a server client (single player runs on the server thread), remote_use_item predicts the result of the main hand's Item.use with item_has_use. That function says "used" for every bucket, bottle and boat, so startUseItem ends before the off hand gets its turn.

These items only succeed when they have a target. Vanilla's BucketItem, BottleItem and BoatItem.use PASS when the ray hits nothing, and PASS or FAIL when there is nothing to fill, empty or place. Minecraft.startUseItem stops the hand loop only on a SUCCESS from useItem, so otherwise the off hand goes next. The client now asks the same questions before it predicts success (use_finds_no_target):

  • empty bucket: a fluid source or powder snow along the SOURCE_ONLY ray (pick_fluid, the ray the in-frame bucket already uses), or a waterlogged block in front of it, and mayUseItemAt (may_build). A waterlogged block counts because its water is a source that the SOURCE_ONLY clip stops at, and SimpleWaterloggedBlock is a BucketPickup. pick_fluid steps through waterlogged blocks, so the check also looks at the crosshair block;
  • full bucket (water, lava, mob buckets): a block aimed at, and may_build;
  • powder snow bucket: always PASS. SolidBucketItem only overrides useOn, so its use is Item.use, which PASSes for it;
  • glass bottle: a water source (or a waterlogged block) along the ray;
  • boat: the boat that BoatItem.use would place. place_boat is split so that boat_to_place holds the ray and the collision checks with no side effects, and both callers use it.

The main hand's UseItem packet still goes to the server as before (vanilla sends it whatever the result), so the server's own handling does not change. Spawn eggs, armor stands and minecarts already passed, as the report says.

Vanilla reference

  • Minecraft.startUseItem (26.3, javap): after MultiPlayerGameMode.useItem, it returns only on instanceof InteractionResult$Success. Any other result goes on to the next hand.
  • BucketItem.use: getPlayerPOVHitResult(getFluidContext()) (SOURCE_ONLY for the empty bucket, NONE otherwise). MISS gives PASS. A failed mayInteract/mayUseItemAt gives FAIL. Next it tries emptyContents, and then, for the empty bucket, BucketPickup.pickupBlock. If neither works, the result is FAIL.
  • MobBucketItem (sulfur cube bucket: Fluids.EMPTY, getFluidContext NONE, emptyContents succeeds on any block). This is covered by the "full bucket" rule above.
  • SolidBucketItem: overrides useOn and emptyContents only. BlockItem has no use, and Item.use PASSes without a consumable, equippable, blocks-attacks or kinetic-weapon component.
  • BottleItem.use: first a dragon's breath cloud. Otherwise getPlayerPOVHitResult(SOURCE_ONLY): MISS gives PASS, and a fluid that is not FluidTags.WATER gives PASS.
  • BoatItem.use: getPlayerPOVHitResult(ANY). MISS gives PASS, an entity in the way gives PASS, and no room gives FAIL.

Not covered: the client does not predict the dragon's breath cloud case of BottleItem.use. If the bottle has no water target there, the off hand now also gets its turn.

Test

There is no unit-test fixture for Game, so I drove the game through horizon-ctl. In creative, the player stands in a one-block water hole on a stone platform. Two scripts ran:

  1. A Riptide trident is in the off hand. For each main-hand item, the script holds right click for 10 ticks while looking at the sky (or at a waterlogged slab ahead) and reads state.using.
  2. 16 snowballs are in the off hand. The script makes one click (held 2 ticks) per case and counts the new snowball projectiles. A thrown snowball means the off hand got its turn.

Script 1, before (parent commit build):

sky: main hand minecraft:bucket -> offhand trident NOT-charging (using=null)
sky: main hand minecraft:water_bucket -> offhand trident NOT-charging (using=null)
sky: main hand minecraft:glass_bottle -> offhand trident NOT-charging (using=null)
sky: main hand minecraft:oak_boat -> offhand trident NOT-charging (using=null)
sky: main hand minecraft:stick -> offhand trident charging (using={"slot": 40, "ticks": 26})
sky: main hand minecraft:powder_snow_bucket -> offhand trident NOT-charging (using=null)
waterlogged-slab: main hand minecraft:bucket -> offhand trident NOT-charging (using=null)
waterlogged-slab: main hand minecraft:glass_bottle -> offhand trident NOT-charging (using=null)

Script 1, after:

sky: main hand minecraft:bucket -> offhand trident charging (using={"slot": 40, "ticks": 18})
sky: main hand minecraft:water_bucket -> offhand trident charging (using={"slot": 40, "ticks": 14})
sky: main hand minecraft:glass_bottle -> offhand trident charging (using={"slot": 40, "ticks": 39})
sky: main hand minecraft:oak_boat -> offhand trident charging (using={"slot": 40, "ticks": 23})
sky: main hand minecraft:stick -> offhand trident charging (using={"slot": 40, "ticks": 55})
sky: main hand minecraft:powder_snow_bucket -> offhand trident charging (using={"slot": 40, "ticks": 33})
waterlogged-slab: main hand minecraft:bucket -> offhand trident NOT-charging (using=null)
waterlogged-slab: main hand minecraft:glass_bottle -> offhand trident NOT-charging (using=null)

Before the waterlogged check was added, an earlier version of this change charged the trident in both waterlogged-slab rows, which was wrong. That is why the check is there.

Script 2, after. When an item has a target, the main hand still ends the click and the off hand does nothing:

empty bucket at the sky: off-hand snowballs thrown: 2
water bucket at the sky: off-hand snowballs thrown: 2
glass bottle at the sky: off-hand snowballs thrown: 2
oak boat at the sky: off-hand snowballs thrown: 2
powder snow bucket at the sky: off-hand snowballs thrown: 2
stick at the sky (control): off-hand snowballs thrown: 2
empty bucket at the water source 213 100 538: off-hand snowballs thrown: 0   (the source became air)
glass bottle at the water source 213 100 538: off-hand snowballs thrown: 0   (a water bottle was added)
water bucket at the stone floor: off-hand snowballs thrown: 0                (water placed on the floor)
oak boat at the stone floor: off-hand snowballs thrown: 0                    (boat placed at 213.5 101 537.35)
empty bucket at a waterlogged slab: off-hand snowballs thrown: 0
glass bottle at a waterlogged slab: off-hand snowballs thrown: 0

Each throw counts as 2 because the stick control also shows 2: one entry is the client's own projectile and one is the server's.

Holding the bucket at a source makes the trident charge on the repeat, about 4 ticks after the pickup. This is vanilla's rightClickDelay repeat: by then the source is gone, so the bucket PASSes.

tools/lan_e2e.py would be the natural home for this check (host and guest), but it needs vscreen and symlinks and does not run on Windows, so it is not part of this PR.

Self-check

I did not run tools/pr_ready.py (Windows). I ran these commands instead:

  • cargo fmt --all -- --check: clean
  • cargo clippy -p horizon-client --features mods --all-targets -- -D warnings: clean
  • cargo test -p horizon-client --bin horizon-client -- boat remote::: 5 passed

Screenshots

There is no visual change beyond the off-hand trident: holding right click with an empty bucket while standing in water and looking at the sky now raises and charges the off-hand trident. Before this change, it stayed down.

🤖 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/3579 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix-3147` --- ### 📝 Commits (1) - [`53beacf`](https://github.com/horizon-rust/horizon/commit/53beacfd133272c122cf2111fe1a7f925c4f19ec) Let the off hand go when a bucket, bottle or boat has no target ### 📊 Changes **2 files changed** (+85 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/boats.rs` (+23 -16) 📝 `crates/horizon-client/src/game/remote.rs` (+62 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3147 With a bucket (empty or full), a glass bottle or a boat in the main hand, a Riptide trident in the off hand would not charge. This happened in single player and on servers. On a server client (single player runs on the server thread), `remote_use_item` predicts the result of the main hand's `Item.use` with `item_has_use`. That function says "used" for every bucket, bottle and boat, so `startUseItem` ends before the off hand gets its turn. These items only succeed when they have a target. Vanilla's `BucketItem`, `BottleItem` and `BoatItem.use` PASS when the ray hits nothing, and PASS or FAIL when there is nothing to fill, empty or place. `Minecraft.startUseItem` stops the hand loop only on a SUCCESS from `useItem`, so otherwise the off hand goes next. The client now asks the same questions before it predicts success (`use_finds_no_target`): - empty bucket: a fluid source or powder snow along the `SOURCE_ONLY` ray (`pick_fluid`, the ray the in-frame bucket already uses), or a waterlogged block in front of it, and `mayUseItemAt` (`may_build`). A waterlogged block counts because its water is a source that the `SOURCE_ONLY` clip stops at, and `SimpleWaterloggedBlock` is a `BucketPickup`. `pick_fluid` steps through waterlogged blocks, so the check also looks at the crosshair block; - full bucket (water, lava, mob buckets): a block aimed at, and `may_build`; - powder snow bucket: always PASS. `SolidBucketItem` only overrides `useOn`, so its `use` is `Item.use`, which PASSes for it; - glass bottle: a water source (or a waterlogged block) along the ray; - boat: the boat that `BoatItem.use` would place. `place_boat` is split so that `boat_to_place` holds the ray and the collision checks with no side effects, and both callers use it. The main hand's `UseItem` packet still goes to the server as before (vanilla sends it whatever the result), so the server's own handling does not change. Spawn eggs, armor stands and minecarts already passed, as the report says. ## Vanilla reference - `Minecraft.startUseItem` (26.3, javap): after `MultiPlayerGameMode.useItem`, it returns only on `instanceof InteractionResult$Success`. Any other result goes on to the next hand. - `BucketItem.use`: `getPlayerPOVHitResult(getFluidContext())` (`SOURCE_ONLY` for the empty bucket, `NONE` otherwise). MISS gives PASS. A failed `mayInteract`/`mayUseItemAt` gives FAIL. Next it tries `emptyContents`, and then, for the empty bucket, `BucketPickup.pickupBlock`. If neither works, the result is FAIL. - `MobBucketItem` (sulfur cube bucket: `Fluids.EMPTY`, `getFluidContext` NONE, `emptyContents` succeeds on any block). This is covered by the "full bucket" rule above. - `SolidBucketItem`: overrides `useOn` and `emptyContents` only. `BlockItem` has no `use`, and `Item.use` PASSes without a consumable, equippable, blocks-attacks or kinetic-weapon component. - `BottleItem.use`: first a dragon's breath cloud. Otherwise `getPlayerPOVHitResult(SOURCE_ONLY)`: MISS gives PASS, and a fluid that is not `FluidTags.WATER` gives PASS. - `BoatItem.use`: `getPlayerPOVHitResult(ANY)`. MISS gives PASS, an entity in the way gives PASS, and no room gives FAIL. Not covered: the client does not predict the dragon's breath cloud case of `BottleItem.use`. If the bottle has no water target there, the off hand now also gets its turn. ## Test There is no unit-test fixture for `Game`, so I drove the game through `horizon-ctl`. In creative, the player stands in a one-block water hole on a stone platform. Two scripts ran: 1. A Riptide trident is in the off hand. For each main-hand item, the script holds right click for 10 ticks while looking at the sky (or at a waterlogged slab ahead) and reads `state.using`. 2. 16 snowballs are in the off hand. The script makes one click (held 2 ticks) per case and counts the new snowball projectiles. A thrown snowball means the off hand got its turn. Script 1, before (parent commit build): ``` sky: main hand minecraft:bucket -> offhand trident NOT-charging (using=null) sky: main hand minecraft:water_bucket -> offhand trident NOT-charging (using=null) sky: main hand minecraft:glass_bottle -> offhand trident NOT-charging (using=null) sky: main hand minecraft:oak_boat -> offhand trident NOT-charging (using=null) sky: main hand minecraft:stick -> offhand trident charging (using={"slot": 40, "ticks": 26}) sky: main hand minecraft:powder_snow_bucket -> offhand trident NOT-charging (using=null) waterlogged-slab: main hand minecraft:bucket -> offhand trident NOT-charging (using=null) waterlogged-slab: main hand minecraft:glass_bottle -> offhand trident NOT-charging (using=null) ``` Script 1, after: ``` sky: main hand minecraft:bucket -> offhand trident charging (using={"slot": 40, "ticks": 18}) sky: main hand minecraft:water_bucket -> offhand trident charging (using={"slot": 40, "ticks": 14}) sky: main hand minecraft:glass_bottle -> offhand trident charging (using={"slot": 40, "ticks": 39}) sky: main hand minecraft:oak_boat -> offhand trident charging (using={"slot": 40, "ticks": 23}) sky: main hand minecraft:stick -> offhand trident charging (using={"slot": 40, "ticks": 55}) sky: main hand minecraft:powder_snow_bucket -> offhand trident charging (using={"slot": 40, "ticks": 33}) waterlogged-slab: main hand minecraft:bucket -> offhand trident NOT-charging (using=null) waterlogged-slab: main hand minecraft:glass_bottle -> offhand trident NOT-charging (using=null) ``` Before the waterlogged check was added, an earlier version of this change charged the trident in both waterlogged-slab rows, which was wrong. That is why the check is there. Script 2, after. When an item has a target, the main hand still ends the click and the off hand does nothing: ``` empty bucket at the sky: off-hand snowballs thrown: 2 water bucket at the sky: off-hand snowballs thrown: 2 glass bottle at the sky: off-hand snowballs thrown: 2 oak boat at the sky: off-hand snowballs thrown: 2 powder snow bucket at the sky: off-hand snowballs thrown: 2 stick at the sky (control): off-hand snowballs thrown: 2 empty bucket at the water source 213 100 538: off-hand snowballs thrown: 0 (the source became air) glass bottle at the water source 213 100 538: off-hand snowballs thrown: 0 (a water bottle was added) water bucket at the stone floor: off-hand snowballs thrown: 0 (water placed on the floor) oak boat at the stone floor: off-hand snowballs thrown: 0 (boat placed at 213.5 101 537.35) empty bucket at a waterlogged slab: off-hand snowballs thrown: 0 glass bottle at a waterlogged slab: off-hand snowballs thrown: 0 ``` Each throw counts as 2 because the stick control also shows 2: one entry is the client's own projectile and one is the server's. Holding the bucket at a source makes the trident charge on the repeat, about 4 ticks after the pickup. This is vanilla's `rightClickDelay` repeat: by then the source is gone, so the bucket PASSes. `tools/lan_e2e.py` would be the natural home for this check (host and guest), but it needs `vscreen` and symlinks and does not run on Windows, so it is not part of this PR. ## Self-check I did not run `tools/pr_ready.py` (Windows). I ran these commands instead: - `cargo fmt --all -- --check`: clean - `cargo clippy -p horizon-client --features mods --all-targets -- -D warnings`: clean - `cargo test -p horizon-client --bin horizon-client -- boat remote::`: 5 passed ## Screenshots There is no visual change beyond the off-hand trident: holding right click with an empty bucket while standing in water and looking at the sky now raises and charges the off-hand trident. Before this change, it stayed down. 🤖 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 05:10:00 +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#5069
No description provided.