Search in sources :

Example 1 with PigmentStackIngredient

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);
        }
    }
}
Also used : IOreInfo(mekanism.client.gui.machine.GuiChemicalCrystallizer.IOreInfo) ChemicalStack(mekanism.api.chemical.ChemicalStack) Item(net.minecraft.item.Item) IIngredients(mezz.jei.api.ingredients.IIngredients) ChemicalCrystallizerRecipe(mekanism.api.recipes.ChemicalCrystallizerRecipe) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) IGuiHelper(mezz.jei.api.helpers.IGuiHelper) SlurryStack(mekanism.api.chemical.slurry.SlurryStack) HashSet(java.util.HashSet) GuiGauge(mekanism.client.gui.element.gauge.GuiGauge) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map) Slurry(mekanism.api.chemical.slurry.Slurry) Nonnull(javax.annotation.Nonnull) MekanismBlocks(mekanism.common.registries.MekanismBlocks) IRecipeLayout(mezz.jei.api.gui.IRecipeLayout) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) WeakHashMap(java.util.WeakHashMap) Nullable(javax.annotation.Nullable) BaseRecipeCategory(mekanism.client.jei.BaseRecipeCategory) SlotOverlay(mekanism.common.inventory.container.slot.SlotOverlay) SlotType(mekanism.client.gui.element.slot.SlotType) DataType(mekanism.common.tile.component.config.DataType) Set(java.util.Set) ITag(net.minecraft.tags.ITag) PigmentStackIngredient(mekanism.api.recipes.inputs.chemical.PigmentStackIngredient) GuiChemicalCrystallizer(mekanism.client.gui.machine.GuiChemicalCrystallizer) Collectors(java.util.stream.Collectors) MekanismJEI(mekanism.client.jei.MekanismJEI) IGuiItemStackGroup(mezz.jei.api.gui.ingredient.IGuiItemStackGroup) GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) IGuiIngredient(mezz.jei.api.gui.ingredient.IGuiIngredient) ProgressType(mekanism.client.gui.element.progress.ProgressType) SlurryStackIngredient(mekanism.api.recipes.inputs.chemical.SlurryStackIngredient) GasStackIngredient(mekanism.api.recipes.inputs.chemical.GasStackIngredient) IIngredientType(mezz.jei.api.ingredients.IIngredientType) GaugeType(mekanism.client.gui.element.gauge.GaugeType) IGuiIngredientGroup(mezz.jei.api.gui.ingredient.IGuiIngredientGroup) MekanismTags(mekanism.common.tags.MekanismTags) VanillaTypes(mezz.jei.api.constants.VanillaTypes) Collections(java.util.Collections) IChemicalStackIngredient(mekanism.api.recipes.inputs.chemical.IChemicalStackIngredient) BoxedChemicalStack(mekanism.api.chemical.merged.BoxedChemicalStack) InfusionStackIngredient(mekanism.api.recipes.inputs.chemical.InfusionStackIngredient) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) HashSet(java.util.HashSet) Set(java.util.Set) PigmentStackIngredient(mekanism.api.recipes.inputs.chemical.PigmentStackIngredient) IGuiItemStackGroup(mezz.jei.api.gui.ingredient.IGuiItemStackGroup) GasStackIngredient(mekanism.api.recipes.inputs.chemical.GasStackIngredient) Item(net.minecraft.item.Item) ITag(net.minecraft.tags.ITag) Slurry(mekanism.api.chemical.slurry.Slurry) SlurryStackIngredient(mekanism.api.recipes.inputs.chemical.SlurryStackIngredient) ItemStack(net.minecraft.item.ItemStack) SlurryStack(mekanism.api.chemical.slurry.SlurryStack) InfusionStackIngredient(mekanism.api.recipes.inputs.chemical.InfusionStackIngredient)

Aggregations

MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 WeakHashMap (java.util.WeakHashMap)1 Collectors (java.util.stream.Collectors)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 ChemicalStack (mekanism.api.chemical.ChemicalStack)1 BoxedChemicalStack (mekanism.api.chemical.merged.BoxedChemicalStack)1 Slurry (mekanism.api.chemical.slurry.Slurry)1 SlurryStack (mekanism.api.chemical.slurry.SlurryStack)1 ChemicalCrystallizerRecipe (mekanism.api.recipes.ChemicalCrystallizerRecipe)1 GasStackIngredient (mekanism.api.recipes.inputs.chemical.GasStackIngredient)1 IChemicalStackIngredient (mekanism.api.recipes.inputs.chemical.IChemicalStackIngredient)1 InfusionStackIngredient (mekanism.api.recipes.inputs.chemical.InfusionStackIngredient)1 PigmentStackIngredient (mekanism.api.recipes.inputs.chemical.PigmentStackIngredient)1 SlurryStackIngredient (mekanism.api.recipes.inputs.chemical.SlurryStackIngredient)1 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)1