Replaced mainhand when mainhand is dropped using repeating command blocks or functions
What I expected to happen was...:
item is dropped and main hand is replaced
What actually happened was...:
on client, item is dropped but main hand is empty
on server, item is dropped and main hand is replaced
Steps to Reproduce:
1. set up command block chain
2. command1: execute if entity @e[type=item,nbt={Item:{id:"minecraft:wooden_pickaxe"}}] run item entity @p weapon.mainhand replace minecraft:wooden_pickaxe
3. command2: kill @e[type=item,nbt={Item:{id:"minecraft:wooden_pickaxe"}}]
4. get a wood pickaxe, drop and observe
ย
command2 simply exists to ensure item replace only occurs once. this can also be done through other means.
Linked issues
duplicates 1
Attachments
Comments 2

Thank you for your report!
We're tracking this issue in MC-219018, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as Fixed. Please check the Fix Version/s field in that ticket to see in which version this behavior was or will be fixed.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
๐ Bug Tracker Guidelines โ ๐ฌ Community Support โ ๐ง Mojang Support
๐ Project Summary โ โ๏ธ Feedback and Suggestions โ ๐ Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Duplicate ofย MC-219018, which was has been fixed in 1.17.1 Pre-release 1.