How to check the number of items in an inventory

Started by madcock83 on Wed, 05/27/2020 - 16:34

Topic category: Help with modding (Java Edition)

Last seen on 02:52, 30. Jun 2020
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to check the number of items in an inventory
Wed, 05/27/2020 - 16:34

Looking to check how many of a certain item are in the players inventory then do something. I posted this question a while back. Someone answered it with a link to an old forum post. Before I saw it the post was removed. Any help would be awesome.

Last seen on 13:44, 18. Jul 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
while player has it: remove…
Sat, 06/06/2020 - 05:29

while player has it:

remove 1 of it in inventory

add cound by 1

end while

add (count) item "it" to inventory

Last seen on 13:44, 18. Jul 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
grammar fix: cound = count
Sat, 06/06/2020 - 05:29

grammar fix:

cound = count