use of net.silentchaos512.gear.item.ModKitItem in project Silent-Gear by SilentChaos512.
the class ModKitRemovePartRecipe method matches.
@Override
public boolean matches(CraftingContainer inv, Level worldIn) {
ItemStack gear = ItemStack.EMPTY;
boolean foundModKit = false;
PartType type = PartType.NONE;
for (int i = 0; i < inv.getContainerSize(); ++i) {
ItemStack stack = inv.getItem(i);
if (!stack.isEmpty()) {
// noinspection ChainOfInstanceofChecks
if (gear.isEmpty() && stack.getItem() instanceof ICoreItem) {
gear = stack;
} else if (!foundModKit && stack.getItem() instanceof ModKitItem) {
type = ModKitItem.getSelectedType(stack);
if (type == PartType.NONE) {
return false;
}
foundModKit = true;
} else {
return false;
}
}
}
return !gear.isEmpty() && foundModKit && GearData.hasPartOfType(gear, type);
}
Aggregations