use of net.minecraft.item.ItemPotion in project MineFactoryReloaded by powercrystals.
the class TileEntityAutoBrewer method canBrew.
private boolean canBrew(int row) {
if (_inventory[getTemplateSlot(row)] == null) {
return false;
}
boolean hasIngredients = false;
for (int i = 0; i < 3; i++) {
if (UtilInventory.stacksEqual(_inventory[getTemplateSlot(row)], _inventory[getResourceSlot(row, i)])) {
hasIngredients = true;
break;
}
}
if (!hasIngredients) {
return false;
}
ItemStack ingredient = _inventory[getTemplateSlot(row)];
if (!Item.itemsList[ingredient.itemID].isPotionIngredient()) {
return false;
}
if (_inventory[getProcessSlot(row)] != null && _inventory[getProcessSlot(row)].getItem() instanceof ItemPotion) {
int existingPotion = _inventory[getProcessSlot(row)].getItemDamage();
int newPotion = this.getPotionResult(existingPotion, ingredient);
if (!ItemPotion.isSplash(existingPotion) && ItemPotion.isSplash(newPotion)) {
return true;
}
@SuppressWarnings("unchecked") List<Integer> existingEffects = Item.potion.getEffects(existingPotion);
@SuppressWarnings("unchecked") List<Integer> newEffects = Item.potion.getEffects(newPotion);
if ((existingPotion <= 0 || existingEffects != newEffects) && (existingEffects == null || !existingEffects.equals(newEffects) && newEffects != null) && existingPotion != newPotion) {
return true;
}
}
return false;
}
Aggregations