Offhand use: one in-hand check for held and consumed items
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4233,11 +4233,13 @@ impl Game<'_> {
|
||||
return;
|
||||
};
|
||||
let stack = self.stack_in(slot).cloned();
|
||||
// Another hotbar slot picked: LivingEntity.updatingUsingItem sees a
|
||||
// different stack in the hand. The off hand keeps its item.
|
||||
let in_hand = slot == self.selected || slot == super::shield::OFFHAND_SLOT;
|
||||
// A drawn bow, a charging crossbow, a raised shield...: held until
|
||||
// the button lets go (or another slot is picked).
|
||||
// the button lets go.
|
||||
if stack.as_ref().is_some_and(|s| self.held_until_released(s)) {
|
||||
self.using = (slot == self.selected || slot == super::shield::OFFHAND_SLOT)
|
||||
.then_some((slot, ticks + 1));
|
||||
self.using = in_hand.then_some((slot, ticks + 1));
|
||||
return;
|
||||
}
|
||||
let consumable = stack
|
||||
@@ -4251,7 +4253,7 @@ impl Game<'_> {
|
||||
// Button release belongs to the next handleKeybinds phase, which
|
||||
// sends RELEASE_USE_ITEM. Do not silently clear a use begun by a
|
||||
// quick press/release between ticks.
|
||||
if slot != self.selected && slot != super::shield::OFFHAND_SLOT {
|
||||
if !in_hand {
|
||||
self.using = None;
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ address. The script then checks, from both sides, what a guest's game used to ge
|
||||
- push: a cow standing in the guest pushes it just clear of the cow (the guest's own client
|
||||
pushes it, as in vanilla), not ever faster across the ground.
|
||||
- eat: holding right click with bread, the guest's own screen plays the eating (the item in use
|
||||
counts up) and the server eats one loaf and feeds the guest.
|
||||
counts up) and the server eats one loaf and feeds the guest.
|
||||
- consume-release: the host and the guest each cancel eating a golden apple and drinking milk from
|
||||
either hand: use ends on client and server, the item and effects stay, and holding
|
||||
use to completion still consumes the item (#1293).
|
||||
|
||||
Reference in New Issue
Block a user