Topic category: Help with MCreator software
I am making a mod that needs to know how many iron ingots the player has in their inventory at all times. The only way I have found of figuring this out is:
set (local: counter) to (0)
while (entity has (iron ingot) in inventory) {
remove (1) (iron ingot) from entity's inventory
set (local: counter) to ((get local: counter) + 1)
}
set (global: overlayText) to (get local: counter)
add (get local: counter) (iron ingot) to entity's inventory
The problem with this is its probably inefficient because it has to do this every player tick, but mainly because it plays the dropping and picking up minecraft inventory sound constantly super fast and it sounds like a machine gun. Also the little ingot icon gets streatched out because its being dropped and added.
Does anyone know how to get the number of iron ingots in a player's inventory?
Thanks
This is kinda the same, but it shouldn't cause the machine-gun noise, squish the ingots, and it might be faster:
https://drive.google.com/file/d/1vriOluPQHiK8cw8nYvcKEMicAZ_TaCIX/view?usp=sharing