Skip to content

use items from the offhand and swing the arm that used them - #763

Merged
Purdze merged 8 commits into
masterfrom
offhand-use
Oct 25, 2026
Merged

Purdze merged 8 commits into
masterfrom
offhand-use

Conversation

@Purdze

@Purdze Purdze commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / code cleanup
  • Performance improvement
  • Chore / tooling
  • Documentation

summary

right click now tries the main hand and then the offhand, so you can place, eat or raise a shield from the offhand. each hand tries the entity or block and then its own item; a failed block use stops both hands, and a pass moves on to the next. menus only open from the main hand, and sneaking with either hand full skips the block's own use. the client predicts each item's use result (consumables, bundles, swappable armour, shields, spears, and items like throwables and bows that always succeed) so the offhand only gets a go when the main hand item does nothing. the interact, use item, use item on and swing packets carry the hand, and each first person hand gets its own swing and use animation.

opening a chest, throwing something, starting a bundle and swapping armour now swing the arm and send the swing packet, as the game does. eating while full now moves on to the offhand instead of counting as a use. item cooldowns, the conditional item uses (buckets, boats, spawn eggs, ...) and tool uses on blocks are left as todos.

third of three offhand prs, stacked on #761.

reference

net/minecraft/client/Minecraft.java (startUseItem), MultiPlayerGameMode (useItemOn, performUseItemOn, useItem, interact), Item.use and its overrides, LivingEntity.swing, LocalPlayer (swing, startUsingItem, getUsedItemHand), ItemInHandRenderer (submitHandsWithItems)

testing

just client-pre-pr. new tests/ingame/player/offhand_use.toml holds a stick in the main hand and dirt in the offhand, right clicks the ground and expects the dirt placed from the offhand, with a screenshot of the left arm mid swing. player/offhand_hand, ui/offhand_hud, player/containers and player/hand still pass.

@github-actions github-actions Bot added the enhancement New feature or request label Oct 24, 2026
@Purdze
Purdze added this pull request to stack #762 October 24, 2026 11:14
@github-actions github-actions Bot added the merge conflict Conflicts with the base branch and needs a merge label Oct 25, 2026
Base automatically changed from offhand-first-person to master October 25, 2026 10:52
@github-actions github-actions Bot removed the merge conflict Conflicts with the base branch and needs a merge label Oct 25, 2026
@Purdze
Purdze merged commit f7fc455 into master Oct 25, 2026
17 checks passed
@Purdze
Purdze deleted the offhand-use branch October 25, 2026 14:37
@Purdze Purdze mentioned this pull request Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant