How to detect when player opens their inventory

Started by B0nesRC0ol on

Topic category: Help with modding (Java Edition)

Last seen on 04:38, 10. Feb 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to detect when player opens their inventory

I'm making a mod which as one of it's aspects replaces the vanilla minecraft inventory. To do this this I plan to detect when the player opens their inventory/has their inventory open, close the open GUI for the player, and open the custom inventory GUI... However I don't have any idea how I would detect when the player has their inventory open, If anyone has an idea as to how I might go about this, it would be much appreciated!

Last seen on 01:42, 25. May 2024
Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What you could do is make a…
Mon, 01/22/2024 - 16:44

What you could do is make a keybind for the E key, (which is the same for opening the inventory), and have a procedure that runs when you press the keybind.

 

For the procedure, make it so it closes the current gui, (being the inventory), and opens your custom gui 

Last seen on 16:13, 19. Feb 2024
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi B0nesRC0ol!I have the…
Mon, 02/12/2024 - 11:56

Hi B0nesRC0ol!
I have the same Problem. Maybe we could chat or talk on Discord?
My Discord is: james310708.
 

Last seen on 16:13, 19. Feb 2024
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
BTW, a solution could be, to…
Mon, 02/12/2024 - 12:11

BTW, a solution could be, to make a procedure, that triggers when i press E. The procedure closes all GUI's for me and opens my custom GUI.