Search in sources :

Example 1 with RecipeMixedMaterialItem

use of net.silentchaos512.gems.recipe.RecipeMixedMaterialItem in project SilentGems by SilentChaos512.

the class ActionAddMixedMaterialRecipe method apply.

@Override
public void apply() {
    // Add the real recipe.
    IRecipe irecipe = new RecipeMixedMaterialItem(tier, toolItem, recipe);
    irecipe.setRegistryName(new ResourceLocation("crafttweaker", calculateName()));
    ForgeRegistries.RECIPES.register(irecipe);
    // Also add example recipes.
    List<EnumMaterialTier> tiers = new ArrayList<>();
    if (tier == null) {
        for (EnumMaterialTier t : EnumMaterialTier.values()) {
            tiers.add(t);
        }
    } else {
        tiers.add(tier);
    }
    List<String> recipeLines = new ArrayList<>();
    int index = 0;
    while (index < recipe.length && recipe[index] instanceof String) {
        recipeLines.add((String) recipe[index++]);
    }
    List<Object> extraParams = new ArrayList<>();
    for (; index < recipe.length; ++index) {
        extraParams.add(recipe[index]);
    }
    EnumMaterialTier[] arrayTiers = tiers.toArray(new EnumMaterialTier[tiers.size()]);
    String[] arrayLines = recipeLines.toArray(new String[recipeLines.size()]);
    Object[] arrayExtraParams = extraParams.toArray();
    if (toolItem instanceof ITool)
        ToolHelper.addExampleRecipe(toolItem, arrayTiers, arrayLines, arrayExtraParams);
}
Also used : RecipeMixedMaterialItem(net.silentchaos512.gems.recipe.RecipeMixedMaterialItem) IRecipe(net.minecraft.item.crafting.IRecipe) ArrayList(java.util.ArrayList) ITool(net.silentchaos512.gems.api.ITool) ResourceLocation(net.minecraft.util.ResourceLocation) EnumMaterialTier(net.silentchaos512.gems.api.lib.EnumMaterialTier)

Example 2 with RecipeMixedMaterialItem

use of net.silentchaos512.gems.recipe.RecipeMixedMaterialItem in project SilentGems by SilentChaos512.

the class ModRecipes method registerAll.

@Override
public void registerAll(SRegistry reg) {
    RecipeMaker recipes = reg.recipes;
    // Chaos Essence creation.
    SilentGemsAPI.addAltarRecipe(ModItems.craftingMaterial.chaosEssence, ModItems.craftingMaterial.getStack(Names.CHAOS_ESSENCE_SHARD, 4), 240000, new ItemStack(Items.DIAMOND));
    // Ender Essence creation.
    // SilentGemsAPI.addAltarRecipe(ModItems.craftingMaterial.enderEssence,
    // ModItems.craftingMaterial.getStack(Names.ENDER_ESSENCE_SHARD, 4), 240000,
    // ModItems.craftingMaterial.enderSlimeBall);
    // Light <--> Dark gem conversion.
    ItemStack slimeBall = new ItemStack(Items.SLIME_BALL);
    ItemStack magmaCream = new ItemStack(Items.MAGMA_CREAM);
    ItemStack enderSlime = ModItems.craftingMaterial.enderSlimeBall;
    for (int i = 0; i < 16; ++i) {
        EnumGem classic = EnumGem.values()[i];
        EnumGem dark = EnumGem.values()[i + 16];
        EnumGem light = EnumGem.values()[i + 32];
        ItemStack classicShards = new ItemStack(ModItems.gemShard, 6, classic.ordinal());
        ItemStack darkShards = new ItemStack(ModItems.gemShard, 6, dark.ordinal());
        ItemStack lightShards = new ItemStack(ModItems.gemShard, 6, light.ordinal());
        SilentGemsAPI.addAltarRecipe(darkShards, classic.getItem(), 80000, magmaCream);
        SilentGemsAPI.addAltarRecipe(classicShards, dark.getItem(), 80000, slimeBall);
        SilentGemsAPI.addAltarRecipe(lightShards, classic.getItem(), 80000, enderSlime);
        SilentGemsAPI.addAltarRecipe(classicShards, light.getItem(), 80000, slimeBall);
    }
    // @formatter:off
    // Axe
    recipes.addCustomRecipe("multipart_axe", new RecipeMixedMaterialItem(null, ModItems.axe, "hh", "hr", " r"));
    // Bow
    recipes.addCustomRecipe("multipart_bow_mundane", new RecipeMixedMaterialItem(MUNDANE, ModItems.bow, "rhs", "h s", "rhs", 's', Items.STRING));
    recipes.addCustomRecipe("multipart_bow_regular", new RecipeMixedMaterialItem(REGULAR, ModItems.bow, "rhs", "h s", "rhs", 's', Items.STRING));
    recipes.addCustomRecipe("multipart_bow_super", new RecipeMixedMaterialItem(SUPER, ModItems.bow, "rhs", "h s", "rhs", 's', ModItems.craftingMaterial.gildedString));
    // Dagger
    recipes.addCustomRecipe("multipart_dagger", new RecipeMixedMaterialItem(null, ModItems.dagger, "h", "r"));
    // Hoe
    recipes.addCustomRecipe("multipart_hoe", new RecipeMixedMaterialItem(null, ModItems.hoe, "hh", " r", " r"));
    // Katana
    recipes.addCustomRecipe("multipart_katana", new RecipeMixedMaterialItem(null, ModItems.katana, "hh", "h ", "r "));
    // Machete
    recipes.addCustomRecipe("multipart_machete", new RecipeMixedMaterialItem(null, ModItems.machete, " hh", " h ", "r  "));
    // Paxel
    recipes.addCustomRecipe("multipart_paxel", new RecipeMixedMaterialItem(null, ModItems.paxel, "hhh", "hrh", "hr "));
    // Pickaxe
    recipes.addCustomRecipe("multipart_pickaxe", new RecipeMixedMaterialItem(null, ModItems.pickaxe, "hhh", " r ", " r "));
    // Scepter
    recipes.addCustomRecipe("multipart_scepter", new RecipeMixedMaterialItem(null, ModItems.scepter, " h ", "hrh", "hrh"));
    // Shield
    recipes.addCustomRecipe("multipart_shield", new RecipeMixedMaterialItem(null, ModItems.shield, "hwh", "wrw", " h ", 'w', "plankWood"));
    // Shovel
    recipes.addCustomRecipe("multipart_shovel", new RecipeMixedMaterialItem(null, ModItems.shovel, "h", "r", "r"));
    // Sickle
    recipes.addCustomRecipe("multipart_sickle", new RecipeMixedMaterialItem(null, ModItems.sickle, " h", "hh", "r "));
    // Sword
    recipes.addCustomRecipe("multipart_sword", new RecipeMixedMaterialItem(null, ModItems.sword, "h", "h", "r"));
    // Tomahawk
    recipes.addCustomRecipe("multipart_tomahawk", new RecipeMixedMaterialItem(null, ModItems.tomahawk, "hhh", "hr ", " r "));
    // Helmet
    recipes.addCustomRecipe("multipart_helmet", new RecipeMixedMaterialItem(null, ModItems.gemHelmet, " h ", "hfh", " h "));
    // Chestplate
    recipes.addCustomRecipe("multipart_chestplate", new RecipeMixedMaterialItem(null, ModItems.gemChestplate, " h ", "hfh", " h "));
    // Leggings
    recipes.addCustomRecipe("multipart_leggings", new RecipeMixedMaterialItem(null, ModItems.gemLeggings, " h ", "hfh", " h "));
    // Boots
    recipes.addCustomRecipe("multipart_boots", new RecipeMixedMaterialItem(null, ModItems.gemBoots, " h ", "hfh", " h "));
    // @formatter:on
    recipes.addCustomRecipe("decorate_tool", new RecipeDecorateTool());
    recipes.addCustomRecipe("decorate_armor", new RecipeDecorateArmor());
    recipes.addCustomRecipe("apply_enchantment_token", new RecipeApplyEnchantmentToken());
    recipes.addCustomRecipe("chaos_gem_upgrade", new RecipeChaosGemUpgrade());
    recipes.addCustomRecipe("name_plate_use", new RecipeNamePlate());
    recipes.addCustomRecipe("holding_gem_set_block", new RecipeHoldingGemSetBlock());
    if (ADD_SOUL_RECIPES) {
        recipes.addCustomRecipe("craft_tool_soul", new RecipeToolSoul());
        recipes.addCustomRecipe("apply_tool_soul", new RecipeApplyToolSoul());
    }
}
Also used : RecipeMixedMaterialItem(net.silentchaos512.gems.recipe.RecipeMixedMaterialItem) RecipeNamePlate(net.silentchaos512.gems.recipe.RecipeNamePlate) RecipeApplyEnchantmentToken(net.silentchaos512.gems.recipe.RecipeApplyEnchantmentToken) EnumGem(net.silentchaos512.gems.lib.EnumGem) RecipeToolSoul(net.silentchaos512.gems.recipe.RecipeToolSoul) RecipeChaosGemUpgrade(net.silentchaos512.gems.recipe.RecipeChaosGemUpgrade) RecipeApplyToolSoul(net.silentchaos512.gems.recipe.RecipeApplyToolSoul) RecipeDecorateArmor(net.silentchaos512.gems.recipe.RecipeDecorateArmor) RecipeDecorateTool(net.silentchaos512.gems.recipe.RecipeDecorateTool) RecipeHoldingGemSetBlock(net.silentchaos512.gems.recipe.RecipeHoldingGemSetBlock) ItemStack(net.minecraft.item.ItemStack) RecipeMaker(net.silentchaos512.lib.registry.RecipeMaker)

Aggregations

RecipeMixedMaterialItem (net.silentchaos512.gems.recipe.RecipeMixedMaterialItem)2 ArrayList (java.util.ArrayList)1 ItemStack (net.minecraft.item.ItemStack)1 IRecipe (net.minecraft.item.crafting.IRecipe)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 ITool (net.silentchaos512.gems.api.ITool)1 EnumMaterialTier (net.silentchaos512.gems.api.lib.EnumMaterialTier)1 EnumGem (net.silentchaos512.gems.lib.EnumGem)1 RecipeApplyEnchantmentToken (net.silentchaos512.gems.recipe.RecipeApplyEnchantmentToken)1 RecipeApplyToolSoul (net.silentchaos512.gems.recipe.RecipeApplyToolSoul)1 RecipeChaosGemUpgrade (net.silentchaos512.gems.recipe.RecipeChaosGemUpgrade)1 RecipeDecorateArmor (net.silentchaos512.gems.recipe.RecipeDecorateArmor)1 RecipeDecorateTool (net.silentchaos512.gems.recipe.RecipeDecorateTool)1 RecipeHoldingGemSetBlock (net.silentchaos512.gems.recipe.RecipeHoldingGemSetBlock)1 RecipeNamePlate (net.silentchaos512.gems.recipe.RecipeNamePlate)1 RecipeToolSoul (net.silentchaos512.gems.recipe.RecipeToolSoul)1 RecipeMaker (net.silentchaos512.lib.registry.RecipeMaker)1