Started by
LiteralGamingDev
on
Topic category: Help with Minecraft modding (Java Edition)
Hello, I am new to modding on MCreator, and modding in general.
I need help counting an amount of a specific item in the inventory and setting it as a variable. For example Gems. Lets say I'm making Gems and adding a tracker on the screen, I know how to add it to the screen, but not how to get the tracker working and properly displaying how many you have within your inventory.
Also maybe how to delete them from your inventory after you pick them up while still tracking how much, but if not that's completely fine. Or maybe a work around all of this if possible.
Thank you.
Edited by LiteralGamingDev on Tue, 11/23/2021 - 00:21
You can iterate through an inventory,
first set the variable to 0
and when the item iteration is equal to that item increase the variable by the amount of that item.
I recommend using player variables and iterate through each player using the world tick, however if you are just trying to learn something, i recommend using the player tick update.
Okay thank you very much!