use of mekanism.api.recipes.ItemStackGasToItemStackRecipe in project Mekanism by mekanism.
the class ItemStackGasToItemStackRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof ItemStackGasToItemStackRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
ItemStackGasToItemStackRecipe recipe = (ItemStackGasToItemStackRecipe) iRecipe;
List<@NonNull ItemStack> itemRepresentations = recipe.getItemInput().getRepresentations();
List<@NonNull GasStack> gasRepresentations = recipe.getChemicalInput().getRepresentations();
for (GasStack gasRepresentation : gasRepresentations) {
NSSGas nssGas = NSSGas.createGas(gasRepresentation);
long gasAmount = gasRepresentation.getAmount() * TileEntityAdvancedElectricMachine.BASE_TICKS_REQUIRED;
for (ItemStack itemRepresentation : itemRepresentations) {
ItemStack output = recipe.getOutput(itemRepresentation, gasRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(itemRepresentation);
ingredientHelper.put(nssGas, gasAmount);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
Aggregations