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);
}
}
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;
}
Aggregations