Multiple Item Detecting

Started by SackboyGamerYT on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Multiple Item Detecting

Hi Everyone! How are you lot today? :)

I have been making a Mod, and i need to make a Event that detects more than 1 of the same item.

but there is no option for that in Conditions.

does someone know a substitute to it?

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I recommend you make a for
Mon, 11/14/2016 - 21:41

I recommend you make a for loop , that will iterate through players inventory and if it the item in the slot is equal to yours , use stackSize variable and check for the ItemStack size.

Something like:

for (ItemStack s : entity.inventory.mainInventory) {
        if (s != null && s.getItem() == YOUR_ITEM) {
           if(s.stackSize > 16){
            

         }
        }
    }

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:I recommend you make a for
Fri, 11/25/2016 - 14:52

@#1

where do you put that?

Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Propably in custom code.
Wed, 04/08/2020 - 13:43

Propably in custom code.