Is there a way to update the player's inventory?

Started by ekiplier9906 on

Topic category: Help with modding (Java Edition)

Last seen on 10:25, 9. Aug 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there a way to update the player's inventory?

Hi! I've created a mod that runs a procedure that removes an item from the player's inventory and places it in the main hand. However, if this is executed in quick succession, there is a chance it will create a "ghost" item - basically, an item that is only removed on server side but is still loaded on client until the player updates their inventory. Is there a way to manually force update the inventory almost immediately after this procedure?

Last seen on 17:20, 17. Oct 2024
Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've had a very similiar…
Thu, 07/18/2024 - 11:44

I've had a very similiar problem, I think I solved It making the procedure wait 1 tick before removing the item and wait another tick before giving It back

Last seen on 15:50, 31. Aug 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hi, i tried waiting 1 tick…
Thu, 08/29/2024 - 09:19

hi, i tried waiting 1 tick between the actions but it still doesn't seem to work.

Do you know why?