Search in sources :

Example 6 with IFinishedRecipe

use of net.minecraft.data.IFinishedRecipe in project AntimatterAPI by GregTech-Intergalactical.

the class AntimatterRecipeProvider method registerToolRecipes.

protected void registerToolRecipes(Consumer<IFinishedRecipe> consumer, String providerDomain) {
    List<Material> mainMats = AntimatterAPI.all(Material.class).stream().filter(m -> (m.getDomain().equals(providerDomain) && m.has(TOOLS))).collect(Collectors.toList());
    List<Material> handleMats = AntimatterAPI.all(Material.class).stream().filter(m -> (m.getDomain().equals(providerDomain) && m.isHandle())).collect(Collectors.toList());
    handleMats.forEach(handle -> AntimatterAPI.all(Material.class).stream().filter(m -> (m.getDomain().equals(providerDomain) && m.has(RUBBERTOOLS))).forEach(rubber -> {
        Tag<Item> ingotTag = getForgeItemTag("ingots/" + rubber.getId()), rodTag = getForgeItemTag("rods/" + handle.getId());
        addStackRecipe(consumer, Ref.ID, PLUNGER.getId() + "_" + handle.getId() + "_" + rubber.getId(), "antimatter_plungers", "has_material_" + rubber.getId(), this.hasItem(ingotTag), PLUNGER.getToolStack(handle, rubber), of('W', WIRE_CUTTER.getTag(), 'I', ingotTag, 'S', Tags.Items.SLIMEBALLS, 'R', rodTag, 'F', FILE.getTag()), "WIS", " RI", "R F");
    }));
    mainMats.forEach(main -> {
        // TODO: For time being
        if (!main.has(INGOT))
            return;
        final Tag<Item> ingotTag = getForgeItemTag("ingots/" + main.getId()), plateTag = getForgeItemTag("plates/" + main.getId()), mainRodTag = getForgeItemTag("rods/" + main.getId());
        final InventoryChangeTrigger.Instance ingotTrigger = this.hasItem(ingotTag), plateTrigger = this.hasItem(plateTag), rodTrigger = this.hasItem(mainRodTag);
        addStackRecipe(consumer, Ref.ID, WRENCH.getId() + "_" + main.getId(), "antimatter_wrenches", "has_material_" + main.getId(), ingotTrigger, WRENCH.getToolStack(main, NULL), of('I', ingotTag, 'H', HAMMER.getTag()), "IHI", "III", " I ");
        addStackRecipe(consumer, Ref.ID, MORTAR.getId() + "_" + main.getId(), "antimatter_mortars", "has_material_" + main.getId(), ingotTrigger, MORTAR.getToolStack(main, NULL), of('I', ingotTag, 'S', Tags.Items.STONE), " I ", "SIS", "SSS");
        for (DyeColor colour : DyeColor.values()) {
            int colourValue = colour.getMapColor().colorValue;
            ItemStack crowbarStack = CROWBAR.getToolStack(main, NULL);
            crowbarStack.getChildTag(Ref.TAG_TOOL_DATA).putInt(Ref.KEY_TOOL_DATA_SECONDARY_COLOUR, colourValue);
            addStackRecipe(consumer, Ref.ID, CROWBAR.getId() + "_" + main.getId() + "_" + colour.getName(), "antimatter_crowbars", "has_material_" + main.getId(), rodTrigger, crowbarStack, of('H', HAMMER.getTag(), 'C', colour.getTag(), 'R', mainRodTag, 'F', FILE.getTag()), "HCR", "CRC", "RCF");
        }
        for (Material handle : handleMats) {
            String handleId = handle.getId().equals("wood") ? "wooden" : handle.getId();
            final Tag<Item> rodTag = getForgeItemTag("rods/" + handleId);
            addStackRecipe(consumer, Ref.ID, PICKAXE.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_pickaxes", "has_material_" + main.getId(), ingotTrigger, PICKAXE.getToolStack(main, handle), of('I', ingotTag, 'R', rodTag), "III", " R ", " R ");
            addStackRecipe(consumer, Ref.ID, AXE.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_axes", "has_material_" + main.getId(), ingotTrigger, AXE.getToolStack(main, handle), of('I', ingotTag, 'R', rodTag), "II ", "IR ", " R ");
            addStackRecipe(consumer, Ref.ID, HOE.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_hoes", "has_material_" + main.getId(), ingotTrigger, HOE.getToolStack(main, handle), of('I', ingotTag, 'R', rodTag), "II ", " R ", " R ");
            addStackRecipe(consumer, Ref.ID, SHOVEL.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_shovels", "has_material_" + main.getId(), ingotTrigger, SHOVEL.getToolStack(main, handle), of('I', ingotTag, 'R', rodTag), "I", "R", "R");
            addStackRecipe(consumer, Ref.ID, SWORD.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_swords", "has_material_" + main.getId(), ingotTrigger, SWORD.getToolStack(main, handle), of('I', ingotTag, 'R', rodTag), "I", "I", "R");
            addStackRecipe(consumer, Ref.ID, HAMMER.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_hammers", "has_material_" + main.getId(), ingotTrigger, HAMMER.getToolStack(main, handle), of('I', ingotTag, 'R', rodTag), "II ", "IIR", "II ");
            addStackRecipe(consumer, Ref.ID, SAW.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_saws", "has_material_" + main.getId(), plateTrigger, SAW.getToolStack(main, handle), of('P', plateTag, 'R', rodTag, 'F', FILE.getTag(), 'H', HAMMER.getTag()), "PPR", "FH ");
            addStackRecipe(consumer, Ref.ID, FILE.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_files", "has_material_" + main.getId(), plateTrigger, FILE.getToolStack(main, handle), of('P', plateTag, 'R', rodTag), "P", "P", "R");
            addStackRecipe(consumer, Ref.ID, KNIFE.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_knives", "has_material_" + main.getId(), plateTrigger, KNIFE.getToolStack(main, handle), of('P', plateTag, 'R', rodTag, 'F', FILE.getTag(), 'H', HAMMER.getTag()), "FPH", " R ");
            addStackRecipe(consumer, Ref.ID, SCREWDRIVER.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_screwdrivers", "has_material_" + main.getId(), rodTrigger, SCREWDRIVER.getToolStack(main, handle), of('M', mainRodTag, 'R', rodTag, 'F', FILE.getTag(), 'H', HAMMER.getTag()), " FM", " MH", "R  ");
            addStackRecipe(consumer, Ref.ID, WIRE_CUTTER.getId() + "_" + main.getId() + "_" + handle.getId(), "antimatter_wire_cutters", "has_material_" + main.getId(), plateTrigger, WIRE_CUTTER.getToolStack(main, handle), b -> b.put('P', plateTag).put('R', rodTag).put('F', FILE.getTag()).put('H', HAMMER.getTag()).put('S', SCREWDRIVER.getTag()).put('W', getForgeItemTag("screws/" + main.getId())), "PFP", "HPS", "RWR");
        }
    });
}
Also used : CookingRecipeBuilder(net.minecraft.data.CookingRecipeBuilder) Tags(net.minecraftforge.common.Tags) DynamicResourcePack(muramasa.antimatter.datagen.resources.DynamicResourcePack) Ingredient(net.minecraft.item.crafting.Ingredient) AntimatterAPI(muramasa.antimatter.AntimatterAPI) Item(net.minecraft.item.Item) RUBBERTOOLS(muramasa.antimatter.material.MaterialTag.RUBBERTOOLS) Function(java.util.function.Function) Utils(muramasa.antimatter.util.Utils) Dist(net.minecraftforge.api.distmarker.Dist) DyeColor(net.minecraft.item.DyeColor) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map) IFinishedRecipe(net.minecraft.data.IFinishedRecipe) ConditionalRecipe(net.minecraftforge.common.crafting.ConditionalRecipe) Data(muramasa.antimatter.Data) Ref(muramasa.antimatter.Ref) DataGenerator(net.minecraft.data.DataGenerator) ICriterionInstance(net.minecraft.advancements.ICriterionInstance) Material(muramasa.antimatter.material.Material) ImmutableMap(com.google.common.collect.ImmutableMap) InventoryChangeTrigger(net.minecraft.advancements.criterion.InventoryChangeTrigger) Set(java.util.Set) BlockOre(muramasa.antimatter.ore.BlockOre) Tag(net.minecraft.tags.Tag) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) ImmutableMap.of(com.google.common.collect.ImmutableMap.of) IAntimatterProvider(muramasa.antimatter.datagen.IAntimatterProvider) AntimatterShapedRecipeBuilder(muramasa.antimatter.datagen.builder.AntimatterShapedRecipeBuilder) Consumer(java.util.function.Consumer) RecipeProvider(net.minecraft.data.RecipeProvider) IItemProvider(net.minecraft.util.IItemProvider) List(java.util.List) ConfigCondition(muramasa.antimatter.recipe.condition.ConfigCondition) ResourceLocation(net.minecraft.util.ResourceLocation) Item(net.minecraft.item.Item) InventoryChangeTrigger(net.minecraft.advancements.criterion.InventoryChangeTrigger) Material(muramasa.antimatter.material.Material) Tag(net.minecraft.tags.Tag) DyeColor(net.minecraft.item.DyeColor) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IFinishedRecipe (net.minecraft.data.IFinishedRecipe)6 ItemStack (net.minecraft.item.ItemStack)6 Consumer (java.util.function.Consumer)5 Collectors (java.util.stream.Collectors)4 Item (net.minecraft.item.Item)4 ResourceLocation (net.minecraft.util.ResourceLocation)4 Arrays (java.util.Arrays)3 List (java.util.List)3 DataGenerator (net.minecraft.data.DataGenerator)3 Lists (com.google.common.collect.Lists)2 MOD_ID (com.ldtteam.structurize.api.util.constant.Constants.MOD_ID)2 BlockTimberFrame (com.ldtteam.structurize.blocks.decorative.BlockTimberFrame)2 TimberFrameCentreType (com.ldtteam.structurize.blocks.types.TimberFrameCentreType)2 TimberFrameType (com.ldtteam.structurize.blocks.types.TimberFrameType)2 WoodType (com.ldtteam.structurize.blocks.types.WoodType)2 ModItems.buildTool (com.ldtteam.structurize.items.ModItems.buildTool)2 ItemStorage (com.minecolonies.api.crafting.ItemStorage)2 CustomRecipeProvider (com.minecolonies.coremod.generation.CustomRecipeProvider)2 Map (java.util.Map)2 AntimatterAPI (muramasa.antimatter.AntimatterAPI)2