Started by
IndigoTail
on
Topic category: Help with Minecraft modding (Java Edition)
I have made a firearm magazine system in my mod, but I want the system to, for example, automatically reset ammo count to 30 (for rifle mags) if the ammo item exceeds 30.
Is there a way to detect the amount of a certain item in a player's inventory?
No, but you could make an if statement to test if the player has the item, remove one, test again, and remove another, and repeat this as many times as is necessary. If it is false at any point in it, you just need an else giving the player the appropriate amount of the item. Hopefully this will be added as an actual feature in the future.
Thanks, I'll definitely try that out
Screw me sideways I have an ammo type called "LMG Box ammo" which has over 50 rounds
Still need some brainstorming to make it work, but it sounds viable