Repository navigation
use items from the offhand and swing the arm that used them - #763
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
type of change
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.useand its overrides,LivingEntity.swing,LocalPlayer(swing,startUsingItem,getUsedItemHand),ItemInHandRenderer(submitHandsWithItems)testing
just client-pre-pr. newtests/ingame/player/offhand_use.tomlholds 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/containersandplayer/handstill pass.