Search in sources :

Example 1 with TimberFrameCentreType

use of com.ldtteam.structurize.blocks.types.TimberFrameCentreType in project minecolonies by ldtteam.

the class SawmillTimberFrameRecipeProvider method registerRecipes.

@Override
protected void registerRecipes(final Consumer<IFinishedRecipe> consumer) {
    for (final WoodType frameType : WoodType.values()) {
        for (final TimberFrameCentreType centreType : TimberFrameCentreType.values()) {
            final String id = String.format("%s_%s_timber_frame", frameType.getSerializedName(), centreType.getSerializedName());
            final ItemStorage frame = new ItemStorage(new ItemStack(frameType.getMaterial(), 1));
            final ItemStorage centre = new ItemStorage(new ItemStack(centreType.getMaterial()));
            final List<ItemStack> results = Arrays.stream(TimberFrameType.values()).map(type -> idToStructurize(BlockTimberFrame.getName(type, frameType, centreType), 4)).collect(Collectors.toList());
            CustomRecipeBuilder.create("sawmill_crafting", id).inputs(Lists.newArrayList(frame, centre, new ItemStorage(new ItemStack(buildTool.get())))).alternateOutputs(results.subList(1, results.size())).result(results.get(0)).mustExist(true).build(consumer);
        }
    }
}
Also used : Arrays(java.util.Arrays) BlockTimberFrame(com.ldtteam.structurize.blocks.decorative.BlockTimberFrame) TimberFrameCentreType(com.ldtteam.structurize.blocks.types.TimberFrameCentreType) TimberFrameType(com.ldtteam.structurize.blocks.types.TimberFrameType) Collectors(java.util.stream.Collectors) Consumer(java.util.function.Consumer) CustomRecipeProvider(com.minecolonies.coremod.generation.CustomRecipeProvider) ItemStack(net.minecraft.item.ItemStack) List(java.util.List) Lists(com.google.common.collect.Lists) WoodType(com.ldtteam.structurize.blocks.types.WoodType) ResourceLocation(net.minecraft.util.ResourceLocation) IFinishedRecipe(net.minecraft.data.IFinishedRecipe) ModItems.buildTool(com.ldtteam.structurize.items.ModItems.buildTool) ItemStorage(com.minecolonies.api.crafting.ItemStorage) NotNull(org.jetbrains.annotations.NotNull) DataGenerator(net.minecraft.data.DataGenerator) ForgeRegistries(net.minecraftforge.registries.ForgeRegistries) MOD_ID(com.ldtteam.structurize.api.util.constant.Constants.MOD_ID) WoodType(com.ldtteam.structurize.blocks.types.WoodType) TimberFrameCentreType(com.ldtteam.structurize.blocks.types.TimberFrameCentreType) ItemStack(net.minecraft.item.ItemStack) ItemStorage(com.minecolonies.api.crafting.ItemStorage)

Example 2 with TimberFrameCentreType

use of com.ldtteam.structurize.blocks.types.TimberFrameCentreType in project minecolonies by Minecolonies.

the class SawmillTimberFrameRecipeProvider method registerRecipes.

@Override
protected void registerRecipes(final Consumer<IFinishedRecipe> consumer) {
    for (final WoodType frameType : WoodType.values()) {
        for (final TimberFrameCentreType centreType : TimberFrameCentreType.values()) {
            final String id = String.format("%s_%s_timber_frame", frameType.getSerializedName(), centreType.getSerializedName());
            final ItemStorage frame = new ItemStorage(new ItemStack(frameType.getMaterial(), 1));
            final ItemStorage centre = new ItemStorage(new ItemStack(centreType.getMaterial()));
            final List<ItemStack> results = Arrays.stream(TimberFrameType.values()).map(type -> idToStructurize(BlockTimberFrame.getName(type, frameType, centreType), 4)).collect(Collectors.toList());
            CustomRecipeBuilder.create("sawmill_crafting", id).inputs(Lists.newArrayList(frame, centre, new ItemStorage(new ItemStack(buildTool.get())))).alternateOutputs(results.subList(1, results.size())).result(results.get(0)).mustExist(true).build(consumer);
        }
    }
}
Also used : Arrays(java.util.Arrays) BlockTimberFrame(com.ldtteam.structurize.blocks.decorative.BlockTimberFrame) TimberFrameCentreType(com.ldtteam.structurize.blocks.types.TimberFrameCentreType) TimberFrameType(com.ldtteam.structurize.blocks.types.TimberFrameType) Collectors(java.util.stream.Collectors) Consumer(java.util.function.Consumer) CustomRecipeProvider(com.minecolonies.coremod.generation.CustomRecipeProvider) ItemStack(net.minecraft.item.ItemStack) List(java.util.List) Lists(com.google.common.collect.Lists) WoodType(com.ldtteam.structurize.blocks.types.WoodType) ResourceLocation(net.minecraft.util.ResourceLocation) IFinishedRecipe(net.minecraft.data.IFinishedRecipe) ModItems.buildTool(com.ldtteam.structurize.items.ModItems.buildTool) ItemStorage(com.minecolonies.api.crafting.ItemStorage) NotNull(org.jetbrains.annotations.NotNull) DataGenerator(net.minecraft.data.DataGenerator) ForgeRegistries(net.minecraftforge.registries.ForgeRegistries) MOD_ID(com.ldtteam.structurize.api.util.constant.Constants.MOD_ID) WoodType(com.ldtteam.structurize.blocks.types.WoodType) TimberFrameCentreType(com.ldtteam.structurize.blocks.types.TimberFrameCentreType) ItemStack(net.minecraft.item.ItemStack) ItemStorage(com.minecolonies.api.crafting.ItemStorage)

Aggregations

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 Arrays (java.util.Arrays)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 Collectors (java.util.stream.Collectors)2 DataGenerator (net.minecraft.data.DataGenerator)2 IFinishedRecipe (net.minecraft.data.IFinishedRecipe)2 ItemStack (net.minecraft.item.ItemStack)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 ForgeRegistries (net.minecraftforge.registries.ForgeRegistries)2 NotNull (org.jetbrains.annotations.NotNull)2