How to check the number of items in an inventory

Started by madcock83 on

Topic category: Help with Minecraft modding (Java Edition)

Active 3 years ago
Joined Aug 2014
Points:
797

User statistics:

  • Modifications: 0
  • Forum topics: 12
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 33
How to check the number of items in an inventory

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.

Active 2 years ago
Joined Mar 2020
Points:
901

User statistics:

  • Modifications: 3
  • Forum topics: 11
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 367
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

Active 2 years ago
Joined Mar 2020
Points:
901

User statistics:

  • Modifications: 3
  • Forum topics: 11
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 367
grammar fix: cound = count
Sat, 06/06/2020 - 05:29

grammar fix:

cound = count

Active 1 year ago
Joined Nov 2021
Points:
566

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 66
grammar fix: spelling* 
Thu, 01/20/2022 - 11:47

grammar fix:

spelling* 

Active 2 years ago
Joined Mar 2020
Points:
901

User statistics:

  • Modifications: 3
  • Forum topics: 11
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 367
@Lord Of The D 42 (I am now…
Sun, 01/23/2022 - 12:58

@Lord Of The D 42
(I am now a pro programmer)
There's no such thing as grammer or spelling, only SYNTAX

Active 10 months ago
Joined Dec 2020
Points:
1157

User statistics:

  • Modifications: 2
  • Forum topics: 28
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 819
There's literally procedure…
Sun, 01/23/2022 - 13:01

There's literally procedure template for that. Check for "check how many diamonds are in inventory" template, it can be used for any item.

Active 2 years ago
Joined Mar 2020
Points:
901

User statistics:

  • Modifications: 3
  • Forum topics: 11
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 367
@Toma400 this is an…
Sun, 01/23/2022 - 13:04

@Toma400 this is an extremely old post okay?

Active 1 year ago
Joined Mar 2024
Points:
201

User statistics:

  • Modifications: 0
  • Forum topics: 16
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 42
Toma400 its not showing for…
Sun, 03/10/2024 - 20:21

Toma400 its not showing for me