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

Started by ekiplier9906 on

Topic category: Help with Minecraft modding (Java Edition)

Active 9 months ago
Joined Jan 2023
Points:
241

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 0
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?

Active 8 hours ago
Joined Apr 2024
Points:
357

User statistics:

  • Modifications: 7
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 443
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

Active 2 months ago
Joined Aug 2024
Points:
50

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
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?