use of mekanism.api.recipes.FluidSlurryToSlurryRecipe in project Mekanism by mekanism.
the class FluidSlurryToSlurryRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof FluidSlurryToSlurryRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
FluidSlurryToSlurryRecipe recipe = (FluidSlurryToSlurryRecipe) iRecipe;
List<@NonNull FluidStack> fluidRepresentations = recipe.getFluidInput().getRepresentations();
List<@NonNull SlurryStack> slurryRepresentations = recipe.getChemicalInput().getRepresentations();
for (FluidStack fluidRepresentation : fluidRepresentations) {
NormalizedSimpleStack nssFluid = NSSFluid.createFluid(fluidRepresentation);
for (SlurryStack slurryRepresentation : slurryRepresentations) {
SlurryStack output = recipe.getOutput(fluidRepresentation, slurryRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(nssFluid, fluidRepresentation.getAmount());
ingredientHelper.put(slurryRepresentation);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
Aggregations