Hello,
First I’m french, sorry for my bad english.
How can I check if the inventory of player contains an item from a mod?
And how can I remove it if it’s true?
Hello,
First I’m french, sorry for my bad english.
How can I check if the inventory of player contains an item from a mod?
And how can I remove it if it’s true?
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: