aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/recipes/NeuRecipe.java
blob: cfa091d5470781f4ab9b724af11e04e9d46f0992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package io.github.moulberry.notenoughupdates.recipes;

import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import net.minecraft.util.ResourceLocation;

import java.util.List;
import java.util.Set;

public interface NeuRecipe {
    Set<Ingredient> getIngredients();

    Set<Ingredient> getOutputs();

    List<RecipeSlot> getSlots();

    void drawExtraInfo(GuiItemRecipe gui);

    default void drawExtraBackground(GuiItemRecipe gui) {
    }

    default void drawHoverInformation(GuiItemRecipe gui, int mouseX, int mouseY) {
    }

    JsonObject serialize();

    ResourceLocation getBackground();

    static NeuRecipe parseRecipe(NEUManager manager, JsonObject recipe, JsonObject output) {
        if (recipe.has("type")) {
            switch (recipe.get("type").getAsString().intern()) {
                case "forge":
                    return ForgeRecipe.parseForgeRecipe(manager, recipe, output);
            }
        }
        return CraftingRecipe.parseCraftingRecipe(manager, recipe, output);
    }
}