How to query an inventory with no specific amount required?

The way I have to check the players inventory for a specific item is by first getting the item, then queryiing it and asking for “ItemStack.of (ItemType, amount)”.

Now this works perfectly if there’s only one of that item in the ItemStack, anything more and it acts as if it doesn’t exist.

I did read on another thread how using -1 counts as essentially not requiring an amount, however this only results in errors in the console regarding the value having to be more than 0.


The JavaDocs are your friend.

Also, you’re exactly right.

Before this is pulled the ItemStack Variant is actually ignoring the quantity.

In the end I’ve had to essentially querty the type, then get the totalItems, as the other ways only return true if there’s at least one item stack with only one item in it.