Count number of items in 9 inventory slots

Started by snoweyrawr on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Count number of items in 9 inventory slots

Hello,

I'm programming an economy mod and building the shop up now and I've designed the GUI and setup item for sale and how much said item costs however I now need the shop inventory, 9 slots which cover the shops stock. I did try add each slot amount however this creates a problem of cheating. I need it to set the correct amount of blocks available each time its adjusted by the player. How would I go about this?

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you can make an text box in…
Thu, 03/13/2025 - 23:05

you can make an text box in the gui and in your on gui open trigger put a procedure to update the amount based on the number the player types in the box and use a varaible to store the values even if the gui is closed.

Follow up if you need further help.

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I forgot to answer the part…
Thu, 03/13/2025 - 23:06

I forgot to answer the part about the 9 slots so, use "get number of items from slot [number] of current open gui" and just cycle through it 9 times adjusting a var to count each time to check the slots content amount.