Items with Inventory/GUI

Started by The_Nexus300 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Items with Inventory/GUI
Fri, 03/27/2026 - 11:41 (edited)

Im relatively new to the making of GUIs.
My idea was to make a gun in the form of an item with an inventory and a GUI to insert ammo into. The problem is, the GUI and item use buttons are automatically both right click. I dont know if this is the main issue why my gun doesnt shoot yet but ideally id like to be able to open the GUI for the item with "R" and fire with right click.
 

The other issue im running into is with sliders, i dont know if they by design dont have continuity between GUI openings but mine always reset to the "initial value" regardless of what i set it to before. Ideally id like them to stay where i put them but i can live without.

Edited by The_Nexus300 on Fri, 03/27/2026 - 11:41
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Most likely the gui resets…
Fri, 03/27/2026 - 13:14

Most likely the gui resets on each opening and closing because it is linked to an item. If you want the slider to save a value then you can give the item an nbt or any data value saved to it. On closing the gui the data value is saved as the slider value, on opening of the gui the slider is set to the data value provided and so on.