Search in sources :

Example 1 with ChestplateRepairRecipe

use of com.mcmoddev.lib.recipe.ChestplateRepairRecipe in project BaseMetals by MinecraftModDevelopmentMods.

the class ArmorRepair method parse.

@Override
public IRecipe parse(final JsonContext context, final JsonObject json) {
    final String material = JsonUtils.getString(json, "material");
    final String type = JsonUtils.getString(json, "armorType").toLowerCase();
    final MMDMaterial mat = Materials.getMaterialByName(material.toLowerCase());
    switch(type) {
        case "boots":
            return new BootsRepairRecipe(mat);
        case "leggings":
            return new LeggingsRepairRecipe(mat);
        case "chestplate":
            return new ChestplateRepairRecipe(mat);
        case "helmet":
            return new HelmetRepairRecipe(mat);
        case "shield":
            return new ShieldRepairRecipe(mat);
        default:
            throw new JsonSyntaxException("Unknown Armor Type '" + type + "' specified!");
    }
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) LeggingsRepairRecipe(com.mcmoddev.lib.recipe.LeggingsRepairRecipe) ShieldRepairRecipe(com.mcmoddev.lib.recipe.ShieldRepairRecipe) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) HelmetRepairRecipe(com.mcmoddev.lib.recipe.HelmetRepairRecipe) BootsRepairRecipe(com.mcmoddev.lib.recipe.BootsRepairRecipe) ChestplateRepairRecipe(com.mcmoddev.lib.recipe.ChestplateRepairRecipe)

Aggregations

JsonSyntaxException (com.google.gson.JsonSyntaxException)1 MMDMaterial (com.mcmoddev.lib.material.MMDMaterial)1 BootsRepairRecipe (com.mcmoddev.lib.recipe.BootsRepairRecipe)1 ChestplateRepairRecipe (com.mcmoddev.lib.recipe.ChestplateRepairRecipe)1 HelmetRepairRecipe (com.mcmoddev.lib.recipe.HelmetRepairRecipe)1 LeggingsRepairRecipe (com.mcmoddev.lib.recipe.LeggingsRepairRecipe)1 ShieldRepairRecipe (com.mcmoddev.lib.recipe.ShieldRepairRecipe)1