use of mekanism.api.recipes.inputs.chemical.PigmentStackIngredient in project Mekanism by mekanism.
the class ChemicalCrystallizerRecipeCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayout recipeLayout, ChemicalCrystallizerRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
initItem(itemStacks, 0, false, output, recipe.getOutputDefinition());
IChemicalStackIngredient<?, ?> input = recipe.getInput();
if (input instanceof GasStackIngredient) {
initChemical(recipeLayout, recipe, MekanismJEI.TYPE_GAS, (GasStackIngredient) input, null);
} else if (input instanceof InfusionStackIngredient) {
initChemical(recipeLayout, recipe, MekanismJEI.TYPE_INFUSION, (InfusionStackIngredient) input, null);
} else if (input instanceof PigmentStackIngredient) {
initChemical(recipeLayout, recipe, MekanismJEI.TYPE_PIGMENT, (PigmentStackIngredient) input, null);
} else if (input instanceof SlurryStackIngredient) {
SlurryStackIngredient slurryInput = (SlurryStackIngredient) input;
Set<ITag<Item>> tags = new HashSet<>();
for (SlurryStack slurryStack : slurryInput.getRepresentations()) {
Slurry slurry = slurryStack.getType();
if (!slurry.isIn(MekanismTags.Slurries.DIRTY)) {
ITag<Item> oreTag = slurry.getOreTag();
if (oreTag != null) {
tags.add(oreTag);
}
}
}
if (tags.size() == 1) {
initChemical(recipeLayout, recipe, MekanismJEI.TYPE_SLURRY, slurryInput, itemStacks);
// TODO: Eventually come up with a better way to do this to allow for if there outputs based on the input and multiple input types
tags.stream().findFirst().ifPresent(tag -> initItem(itemStacks, 1, false, slurryOreSlot, tag.getValues().stream().map(ItemStack::new).collect(Collectors.toList())));
} else {
initChemical(recipeLayout, recipe, MekanismJEI.TYPE_SLURRY, slurryInput, null);
}
}
}
Aggregations