ItemStack predicate arguments

Similar to the BlockPredicateArgument, the ItemStackPredicateArgument is a way of performing predicate checks on ItemStack objects. These can represent tags, such as the ones declared here on the MinecraftWiki, or individual items. The cast type for this argument is Predicate<ItemStack>.

Example - Removing items in inventories based on predicates

Say we wanted to remove items in your inventory (I know, the /clear command does this, but this is the only example I could come up with). To do this, we'll use the following command structure:

/rem <item>

We implement this with a simple for loop over the player's inventory and remove items that satisfy the predicate.

// Register our command
new CommandAPICommand("rem")
	.withArguments(new ItemStackPredicateArgument("items"))
	.executesPlayer((player, args) -> {
	    // Get our predicate
	    Predicate<ItemStack> predicate = (Predicate<ItemStack>) args[0];
	    for(ItemStack item : player.getInventory()) {
	        if(predicate.test(item)) {