use of net.minecraftforge.common.brewing.BrewingOreRecipe in project Gaspunk by Ladysnake.
the class GasRecipeDeserializer method deserializeRecipe.
private static void deserializeRecipe(JsonObject json, JsonContext context) {
String resultName = JsonUtils.getString(json, "result");
IGas result = ModGases.REGISTRY.getValue(new ResourceLocation(resultName));
if (result == null)
throw new JsonParseException("Unrecognized gas: " + resultName);
JsonObject jsInput = JsonUtils.getJsonObject(json, "input");
ItemStack in;
if (jsInput.has("gas"))
in = getBottle(ModGases.REGISTRY.getValue(new ResourceLocation(JsonUtils.getString(jsInput, "gas"))));
else
in = CraftingHelper.getItemStack(jsInput, context);
JsonObject jsIngredient = JsonUtils.getJsonObject(json, "ingredient");
String type = JsonUtils.getString(jsIngredient, "type", "minecraft:item");
if ("forge:ore_dict".equals(type)) {
String ingredient = JsonUtils.getString(jsIngredient, "ore");
BrewingRecipeRegistry.addRecipe(new BrewingOreRecipe(in, ingredient, ((ItemGasTube) ModItems.GAS_TUBE).getItemStackFor(result)));
} else if ("minecraft:item".equals(type)) {
ItemStack ingredient = CraftingHelper.getItemStack(jsIngredient, context);
BrewingRecipeRegistry.addRecipe(new BrewingRecipe(in, ingredient, ((ItemGasTube) ModItems.GAS_TUBE).getItemStackFor(result)));
}
}
Aggregations