Search in sources :

Example 1 with Recipe

use of com.lowdragmc.multiblocked.api.recipe.Recipe in project Multiblocked by Low-Drag-MC.

the class RecipeMapCategory method setIngredients.

@Override
public void setIngredients(@Nonnull RecipeWrapper wrapper, @Nonnull IIngredients ingredients) {
    Recipe recipe = wrapper.recipe;
    if (recipe.inputs.containsKey(ItemMultiblockCapability.CAP)) {
        ingredients.setInputs(VanillaTypes.ITEM, recipe.inputs.get(ItemMultiblockCapability.CAP).stream().map(Tuple::getA).map(ItemsIngredient.class::cast).flatMap(r -> Arrays.stream(r.ingredient.getItems())).collect(Collectors.toList()));
    }
    if (recipe.outputs.containsKey(ItemMultiblockCapability.CAP)) {
        ingredients.setOutputs(VanillaTypes.ITEM, recipe.outputs.get(ItemMultiblockCapability.CAP).stream().map(Tuple::getA).map(ItemsIngredient.class::cast).flatMap(r -> Arrays.stream(r.ingredient.getItems())).collect(Collectors.toList()));
    }
    checkCommonIngredients(recipe, FluidMultiblockCapability.CAP, ingredients, VanillaTypes.FLUID, FluidStack.class);
    if (Multiblocked.isMekLoaded()) {
        checkCommonIngredients(recipe, ChemicalMekanismCapability.CAP_GAS, ingredients, MekanismJEI.TYPE_GAS, GasStack.class);
        checkCommonIngredients(recipe, ChemicalMekanismCapability.CAP_INFUSE, ingredients, MekanismJEI.TYPE_INFUSION, InfusionStack.class);
        checkCommonIngredients(recipe, ChemicalMekanismCapability.CAP_PIGMENT, ingredients, MekanismJEI.TYPE_PIGMENT, PigmentStack.class);
        checkCommonIngredients(recipe, ChemicalMekanismCapability.CAP_SLURRY, ingredients, MekanismJEI.TYPE_SLURRY, SlurryStack.class);
    }
}
Also used : Recipe(com.lowdragmc.multiblocked.api.recipe.Recipe) Tuple(net.minecraft.util.Tuple)

Example 2 with Recipe

use of com.lowdragmc.multiblocked.api.recipe.Recipe in project Multiblocked by Low-Drag-MC.

the class RecipeMapTypeAdapter method deserialize.

@Override
public RecipeMap deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
    JsonObject json = (JsonObject) jsonElement;
    RecipeMap recipeMap = new RecipeMap(json.get("name").getAsString());
    recipeMap.progressTexture = new ResourceTexture(json.get("progressTexture").getAsString());
    for (JsonElement recipe : json.get("recipes").getAsJsonArray()) {
        recipeMap.addRecipe(Multiblocked.GSON.fromJson(recipe, Recipe.class));
    }
    return recipeMap;
}
Also used : ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) Recipe(com.lowdragmc.multiblocked.api.recipe.Recipe) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) RecipeMap(com.lowdragmc.multiblocked.api.recipe.RecipeMap)

Aggregations

Recipe (com.lowdragmc.multiblocked.api.recipe.Recipe)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)1 RecipeMap (com.lowdragmc.multiblocked.api.recipe.RecipeMap)1 Tuple (net.minecraft.util.Tuple)1