Search in sources :

Example 6 with GateVariant

use of buildcraft.transport.gate.GateVariant in project BuildCraft by BuildCraft.

the class BCTransportRecipes method registerRecipes.

@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
    addPipeRecipe(BCTransportItems.pipeItemWood, "plankWood");
    addPipeRecipe(BCTransportItems.pipeItemCobble, "cobblestone");
    addPipeRecipe(BCTransportItems.pipeItemStone, "stone");
    addPipeRecipe(BCTransportItems.pipeItemQuartz, "blockQuartz");
    addPipeRecipe(BCTransportItems.pipeItemIron, "ingotIron");
    addPipeRecipe(BCTransportItems.pipeItemGold, "ingotGold");
    addPipeRecipe(BCTransportItems.pipeItemClay, Blocks.CLAY);
    addPipeRecipe(BCTransportItems.pipeItemSandstone, new ItemStack(Blocks.SANDSTONE, 1, OreDictionary.WILDCARD_VALUE));
    addPipeRecipe(BCTransportItems.pipeItemVoid, new ItemStack(Items.DYE, 1, EnumDyeColor.BLACK.getDyeDamage()), "dustRedstone");
    addPipeRecipe(BCTransportItems.pipeItemObsidian, Blocks.OBSIDIAN);
    addPipeRecipe(BCTransportItems.pipeItemDiamond, Items.DIAMOND);
    addPipeRecipe(BCTransportItems.pipeItemLapis, Blocks.LAPIS_BLOCK);
    addPipeRecipe(BCTransportItems.pipeItemDaizuli, Blocks.LAPIS_BLOCK, Items.DIAMOND);
    addPipeRecipe(BCTransportItems.pipeItemDiaWood, "plankWood", Items.DIAMOND);
    addPipeRecipe(BCTransportItems.pipeItemStripes, "gearGold");
    addPipeUpgradeRecipe(BCTransportItems.pipeItemDiaWood, BCTransportItems.pipeItemEmzuli, Blocks.LAPIS_BLOCK);
    Item waterproof = BCTransportItems.waterproof;
    if (waterproof == null) {
        waterproof = Items.SLIME_BALL;
    }
    addPipeUpgradeRecipe(BCTransportItems.pipeItemWood, BCTransportItems.pipeFluidWood, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemCobble, BCTransportItems.pipeFluidCobble, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemStone, BCTransportItems.pipeFluidStone, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemQuartz, BCTransportItems.pipeFluidQuartz, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemIron, BCTransportItems.pipeFluidIron, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemGold, BCTransportItems.pipeFluidGold, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemClay, BCTransportItems.pipeFluidClay, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemSandstone, BCTransportItems.pipeFluidSandstone, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemVoid, BCTransportItems.pipeFluidVoid, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemObsidian, BCTransportItems.pipeFluidObsidian, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemDiamond, BCTransportItems.pipeFluidDiamond, waterproof);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemDiaWood, BCTransportItems.pipeFluidDiaWood, waterproof);
    String upgrade = "dustRedstone";
    addPipeUpgradeRecipe(BCTransportItems.pipeItemWood, BCTransportItems.pipePowerWood, upgrade);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemCobble, BCTransportItems.pipePowerCobble, upgrade);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemStone, BCTransportItems.pipePowerStone, upgrade);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemQuartz, BCTransportItems.pipePowerQuartz, upgrade);
    // addPipeUpgradeRecipe(BCTransportItems.pipeItemIron, BCTransportItems.pipePowerIron, upgrade);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemGold, BCTransportItems.pipePowerGold, upgrade);
    addPipeUpgradeRecipe(BCTransportItems.pipeItemSandstone, BCTransportItems.pipePowerSandstone, upgrade);
    // addPipeUpgradeRecipe(BCTransportItems.pipeItemDiamond, BCTransportItems.pipePowerDiamond, upgrade);
    if (BCTransportItems.plugGate != null) {
        // You can craft some of the basic gate types in a normal crafting table
        RecipeBuilderShaped builder = new RecipeBuilderShaped();
        builder.add(" m ");
        builder.add("mrm");
        builder.add(" b ");
        builder.map('r', "dustRedstone");
        builder.map('b', BCTransportItems.plugBlocker, Blocks.COBBLESTONE);
        // Base craftable types
        builder.map('m', Items.BRICK);
        makeGateRecipe(builder, EnumGateMaterial.CLAY_BRICK, EnumGateModifier.NO_MODIFIER);
        builder.map('m', "ingotIron");
        makeGateRecipe(builder, EnumGateMaterial.IRON, EnumGateModifier.NO_MODIFIER);
        builder.map('m', Items.NETHERBRICK);
        makeGateRecipe(builder, EnumGateMaterial.NETHER_BRICK, EnumGateModifier.NO_MODIFIER);
        // Iron modifier addition
        GateVariant variant = new GateVariant(EnumGateLogic.AND, EnumGateMaterial.IRON, EnumGateModifier.NO_MODIFIER);
        ItemStack ironGateBase = BCTransportItems.plugGate.getStack(variant);
        builder = new RecipeBuilderShaped();
        builder.add(" m ");
        builder.add("mgm");
        builder.add(" m ");
        builder.map('g', ironGateBase);
        builder.map('m', new ItemStack(Items.DYE, 1, EnumDyeColor.BLUE.getDyeDamage()));
        makeGateRecipe(builder, EnumGateMaterial.IRON, EnumGateModifier.LAPIS);
        builder.map('m', Items.QUARTZ);
        makeGateRecipe(builder, EnumGateMaterial.IRON, EnumGateModifier.QUARTZ);
        // TODO: Create a recipe class for this instead!
        for (EnumGateMaterial material : EnumGateMaterial.VALUES) {
            if (material == EnumGateMaterial.CLAY_BRICK) {
                continue;
            }
            for (EnumGateModifier modifier : EnumGateModifier.VALUES) {
                GateVariant varAnd = new GateVariant(EnumGateLogic.AND, material, modifier);
                ItemStack resultAnd = BCTransportItems.plugGate.getStack(varAnd);
                GateVariant varOr = new GateVariant(EnumGateLogic.OR, material, modifier);
                ItemStack resultOr = BCTransportItems.plugGate.getStack(varOr);
                String regNamePrefix = resultOr.getItem().getRegistryName() + "_" + modifier + "_" + material;
                ForgeRegistries.RECIPES.register(new ShapedOreRecipe(resultOr.getItem().getRegistryName(), resultAnd, "i", 'i', new IngredientNBTBC(resultOr)).setRegistryName(regNamePrefix + "_or"));
                ForgeRegistries.RECIPES.register(new ShapedOreRecipe(resultAnd.getItem().getRegistryName(), resultOr, "i", 'i', new IngredientNBTBC(resultAnd)).setRegistryName(regNamePrefix + "_and"));
            }
        }
    }
    if (BCTransportItems.plugPulsar != null) {
        ItemStack output = new ItemStack(BCTransportItems.plugPulsar);
        ItemStack redstoneEngine;
        if (BCCoreBlocks.engine != null) {
            redstoneEngine = BCCoreBlocks.engine.getStack(EnumEngineType.WOOD);
        } else {
            redstoneEngine = new ItemStack(Blocks.REDSTONE_BLOCK);
        }
        if (SILICON_TABLE_ASSEMBLY != null) {
            Set<IngredientStack> input = new HashSet<>();
            input.add(new IngredientStack(Ingredient.fromStacks(redstoneEngine)));
            input.add(new IngredientStack(CraftingHelper.getIngredient("ingotIron"), 2));
            AssemblyRecipe recipe = new AssemblyRecipeBasic("plug_pulsar", 1000 * MjAPI.MJ, input, output);
            AssemblyRecipeRegistry.register(recipe);
        }
    }
    if (BCTransportItems.plugGate != null) {
        IngredientStack lapis = IngredientStack.of("gemLapis");
        makeGateAssembly(20_000, EnumGateMaterial.IRON, EnumGateModifier.NO_MODIFIER, EnumRedstoneChipset.IRON);
        makeGateAssembly(40_000, EnumGateMaterial.NETHER_BRICK, EnumGateModifier.NO_MODIFIER, EnumRedstoneChipset.IRON, IngredientStack.of(new ItemStack(Blocks.NETHER_BRICK)));
        makeGateAssembly(80_000, EnumGateMaterial.GOLD, EnumGateModifier.NO_MODIFIER, EnumRedstoneChipset.GOLD);
        makeGateModifierAssembly(40_000, EnumGateMaterial.IRON, EnumGateModifier.LAPIS, lapis);
        makeGateModifierAssembly(60_000, EnumGateMaterial.IRON, EnumGateModifier.QUARTZ, IngredientStack.of(EnumRedstoneChipset.QUARTZ.getStack()));
        makeGateModifierAssembly(80_000, EnumGateMaterial.IRON, EnumGateModifier.DIAMOND, IngredientStack.of(EnumRedstoneChipset.DIAMOND.getStack()));
        makeGateModifierAssembly(80_000, EnumGateMaterial.NETHER_BRICK, EnumGateModifier.LAPIS, lapis);
        makeGateModifierAssembly(100_000, EnumGateMaterial.NETHER_BRICK, EnumGateModifier.QUARTZ, IngredientStack.of(EnumRedstoneChipset.QUARTZ.getStack()));
        makeGateModifierAssembly(120_000, EnumGateMaterial.NETHER_BRICK, EnumGateModifier.DIAMOND, IngredientStack.of(EnumRedstoneChipset.DIAMOND.getStack()));
        makeGateModifierAssembly(100_000, EnumGateMaterial.GOLD, EnumGateModifier.LAPIS, lapis);
        makeGateModifierAssembly(140_000, EnumGateMaterial.GOLD, EnumGateModifier.QUARTZ, IngredientStack.of(EnumRedstoneChipset.QUARTZ.getStack()));
        makeGateModifierAssembly(180_000, EnumGateMaterial.GOLD, EnumGateModifier.DIAMOND, IngredientStack.of(EnumRedstoneChipset.DIAMOND.getStack()));
    }
    if (BCTransportItems.plugLightSensor != null) {
        AssemblyRecipeRegistry.register(new AssemblyRecipeBasic("light-sensor", 500 * MjAPI.MJ, ImmutableSet.of(IngredientStack.of(Blocks.DAYLIGHT_DETECTOR)), new ItemStack(BCTransportItems.plugLightSensor)));
    }
    if (BCTransportItems.plugFacade != null) {
        AssemblyRecipeRegistry.register(FacadeAssemblyRecipes.INSTANCE);
        ForgeRegistries.RECIPES.register(FacadeSwapRecipe.INSTANCE);
    }
    if (BCTransportItems.wire != null) {
        for (EnumDyeColor color : ColourUtil.COLOURS) {
            String name = String.format("wire-%s", color.getUnlocalizedName());
            ImmutableSet<IngredientStack> input = ImmutableSet.of(IngredientStack.of("dustRedstone"), IngredientStack.of(ColourUtil.getDyeName(color)));
            AssemblyRecipeRegistry.register(new AssemblyRecipeBasic(name, 10_000 * MjAPI.MJ, input, new ItemStack(BCTransportItems.wire, 8, color.getMetadata())));
        }
    }
    if (BCTransportItems.plugLens != null) {
        for (EnumDyeColor colour : ColourUtil.COLOURS) {
            String name = String.format("lens-regular-%s", colour.getUnlocalizedName());
            IngredientStack stainedGlass = IngredientStack.of("blockGlass" + ColourUtil.getName(colour));
            ImmutableSet<IngredientStack> input = ImmutableSet.of(stainedGlass);
            ItemStack output = BCTransportItems.plugLens.getStack(colour, false);
            AssemblyRecipeRegistry.register(new AssemblyRecipeBasic(name, 500 * MjAPI.MJ, input, output));
            name = String.format("lens-filter-%s", colour.getUnlocalizedName());
            output = BCTransportItems.plugLens.getStack(colour, true);
            input = ImmutableSet.of(stainedGlass, IngredientStack.of(new ItemStack(Blocks.IRON_BARS)));
            AssemblyRecipeRegistry.register(new AssemblyRecipeBasic(name, 500 * MjAPI.MJ, input, output));
        }
        IngredientStack glass = IngredientStack.of("blockGlass");
        ImmutableSet<IngredientStack> input = ImmutableSet.of(glass);
        ItemStack output = BCTransportItems.plugLens.getStack(null, false);
        AssemblyRecipeRegistry.register(new AssemblyRecipeBasic("lens-regular", 500 * MjAPI.MJ, input, output));
        output = BCTransportItems.plugLens.getStack(null, true);
        input = ImmutableSet.of(glass, IngredientStack.of(new ItemStack(Blocks.IRON_BARS)));
        AssemblyRecipeRegistry.register(new AssemblyRecipeBasic("lens-filter", 500 * MjAPI.MJ, input, output));
    }
}
Also used : ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) GateVariant(buildcraft.transport.gate.GateVariant) EnumDyeColor(net.minecraft.item.EnumDyeColor) Item(net.minecraft.item.Item) AssemblyRecipeBasic(buildcraft.api.recipes.AssemblyRecipeBasic) EnumGateMaterial(buildcraft.transport.gate.EnumGateMaterial) AssemblyRecipe(buildcraft.api.recipes.AssemblyRecipe) RecipeBuilderShaped(buildcraft.lib.recipe.RecipeBuilderShaped) ItemStack(net.minecraft.item.ItemStack) IngredientStack(buildcraft.api.recipes.IngredientStack) EnumGateModifier(buildcraft.transport.gate.EnumGateModifier) IngredientNBTBC(buildcraft.lib.recipe.IngredientNBTBC) HashSet(java.util.HashSet) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

GateVariant (buildcraft.transport.gate.GateVariant)6 AssemblyRecipeBasic (buildcraft.api.recipes.AssemblyRecipeBasic)3 IngredientStack (buildcraft.api.recipes.IngredientStack)3 ItemStack (net.minecraft.item.ItemStack)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 AssemblyRecipe (buildcraft.api.recipes.AssemblyRecipe)1 PluggableDefinition (buildcraft.api.transport.pluggable.PluggableDefinition)1 IngredientNBTBC (buildcraft.lib.recipe.IngredientNBTBC)1 RecipeBuilderShaped (buildcraft.lib.recipe.RecipeBuilderShaped)1 EnumGateLogic (buildcraft.transport.gate.EnumGateLogic)1 EnumGateMaterial (buildcraft.transport.gate.EnumGateMaterial)1 EnumGateModifier (buildcraft.transport.gate.EnumGateModifier)1 PluggableGate (buildcraft.transport.plug.PluggableGate)1 HashSet (java.util.HashSet)1 EnumDyeColor (net.minecraft.item.EnumDyeColor)1 Item (net.minecraft.item.Item)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 ShapedOreRecipe (net.minecraftforge.oredict.ShapedOreRecipe)1