Check an item from a mod in an inventory?

Given an item, you can test it’s name, i.e:

public boolean isModItem(ItemStack itemStack) {
    return isModItem(itemStack.getItem());
}

public boolean isModItem(ItemType item) {
    return !item.getName().startsWith("minecraft:");
}

Now you can iterate over the items in an inventory and test whether it’s got a modded item. See my solution on this thread:

1 Like