Search in sources :

Example 1 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ProcessingPlate method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    ItemStack stack = simpleStack.asItemStack();
    boolean noSmashing = entry.material.hasFlag(NO_SMASHING);
    long materialMass = entry.material.getMass();
    switch(entry.orePrefix) {
        case plate:
            if (entry.material instanceof FluidMaterial) {
                RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder().notConsumable(MetaItems.SHAPE_MOLD_PLATE).fluidInputs(((FluidMaterial) entry.material).getFluid(L)).outputs(OreDictUnifier.get(OrePrefix.plate, entry.material)).duration(32).EUt(8).buildAndRegister();
            }
            RecipeMap.IMPLOSION_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(2, stack)).explosivesAmount(2).outputs(OreDictUnifier.get(OrePrefix.compressed, entry.material), OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh)).buildAndRegister();
            if (entry.material == Materials.Paper)
                ModHandler.addShapedRecipe("papar_f_scane_" + entry.material, GTUtility.copyAmount(3, stack), "XXX", 'X', new ItemStack(Items.REEDS, 1, W));
            if (!noSmashing) {
                ModHandler.addShapedRecipe("ingot_t_plate_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "h", "X", "X", 'X', new UnificationEntry(OrePrefix.ingot, entry.material));
                ModHandler.addShapedRecipe("ingot_t_plate_od_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "H", "X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', new UnificationEntry(OrePrefix.ingot, entry.material));
                ModHandler.addShapedRecipe("gem_t_plate_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "h", "X", 'X', new UnificationEntry(OrePrefix.gem, entry.material));
                ModHandler.addShapedRecipe("gem_t_plate_od_" + entry.material, OreDictUnifier.get(OrePrefix.plate, entry.material), "H", "X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', new UnificationEntry(OrePrefix.gem, entry.material));
            }
            if (entry.material.hasFlag(MORTAR_GRINDABLE))
                ModHandler.addShapedRecipe("plate_t_dust_" + entry.material, OreDictUnifier.get(OrePrefix.dust, entry.material), "X", "m", 'X', new UnificationEntry(OrePrefix.plate, entry.material));
            break;
        case plateDense:
            if (!noSmashing) {
                RecipeMap.BENDER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.plate, entry.material, 9)).outputs(GTUtility.copyAmount(1, stack)).duration((int) Math.max(materialMass * 9L, 1L)).EUt(96).buildAndRegister();
            }
            break;
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 2 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ProcessingToolOther method registerOre.

// @Override
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    if (entry.material != Materials.Stone && entry.material != Materials.Flint) {
        if (entry.material != Materials.Rubber) {
            ModHandler.addShapedRecipe("plunger_" + entry.material + "_" + entry.material, MetaItems.PLUNGER.getStackForm(entry.material, entry.material), "xRR", " SR", "S f", 'S', new UnificationEntry(OrePrefix.stick, entry.material), 'R', new UnificationEntry(OrePrefix.plate, Materials.Rubber));
        }
        if (!ModHandler.isMaterialWood(entry.material) && !entry.material.hasFlag(NO_SMASHING)) {
            if (entry.material instanceof SolidMaterial) {
                SolidMaterial solidMaterial = (SolidMaterial) entry.material;
                ModHandler.addShapedRecipe("screwdriver_" + solidMaterial + "_" + solidMaterial.handleMaterial, MetaItems.SCREWDRIVER.getStackForm(solidMaterial, solidMaterial.handleMaterial), " fS", " Sh", "W  ", 'S', OreDictUnifier.get(OrePrefix.stick, solidMaterial), 'W', OreDictUnifier.get(OrePrefix.stick, solidMaterial));
            }
            ModHandler.addShapedRecipe("wrench_" + entry.material + "_" + entry.material, MetaItems.WRENCH.getStackForm(entry.material, entry.material), "IhI", "III", " I ", 'I', OreDictUnifier.get(OrePrefix.ingot, entry.material));
            ModHandler.addShapedRecipe("crowbar_" + entry.material + "_" + entry.material, MetaItems.CROWBAR.getStackForm(entry.material, entry.material), "hDS", "DSD", "SDf", 'S', OreDictUnifier.get(OrePrefix.stick, entry.material), 'D', EnumDyeColor.BLUE);
            ModHandler.addShapedRecipe("wirecutter_" + entry.material + "_" + entry.material, MetaItems.WIRECUTTER.getStackForm(entry.material, entry.material), "PfP", "hPd", "STS", 'S', OreDictUnifier.get(OrePrefix.stick, entry.material), 'P', OreDictUnifier.get(OrePrefix.plate, entry.material), 'T', OreDictUnifier.get(OrePrefix.screw, entry.material));
            ModHandler.addShapedRecipe("scoop_" + entry.material + "_" + entry.material, MetaItems.SCOOP.getStackForm(entry.material, entry.material), "SWS", "SSS", "xSh", 'S', OreDictUnifier.get(OrePrefix.stick, entry.material), 'W', new ItemStack(Blocks.WOOL, 1, 32767));
            ModHandler.addShapedRecipe("branchcutter_" + entry.material + "_" + entry.material, MetaItems.BRANCHCUTTER.getStackForm(entry.material, entry.material), "PfP", "PdP", "STS", 'S', OreDictUnifier.get(OrePrefix.stick, entry.material), 'P', OreDictUnifier.get(OrePrefix.plate, entry.material), 'T', OreDictUnifier.get(OrePrefix.screw, entry.material));
            ModHandler.addShapedRecipe("knife_" + entry.material + "_" + entry.material, MetaItems.KNIFE.getStackForm(entry.material, entry.material), "fPh", " S ", 'S', OreDictUnifier.get(OrePrefix.stick, entry.material), 'P', OreDictUnifier.get(OrePrefix.plate, entry.material));
            ModHandler.addShapedRecipe("butchknife_" + entry.material + "_" + entry.material, MetaItems.BUTCHERYKNIFE.getStackForm(entry.material, entry.material), "PPf", "PP ", "Sh ", 'S', OreDictUnifier.get(OrePrefix.stick, entry.material), 'P', OreDictUnifier.get(OrePrefix.plate, entry.material));
            ModHandler.addShapedRecipe("soldiron_lv_" + entry.material + "_" + Materials.Rubber, // TODO electric tools
            MetaItems.SOLDERING_IRON_LV.getStackForm(entry.material, Materials.Rubber), "LBf", "Sd ", "P  ", 'B', OreDictUnifier.get(OrePrefix.bolt, entry.material), 'P', OreDictUnifier.get(OrePrefix.plate, entry.material), 'S', OreDictUnifier.get(OrePrefix.stick, Materials.Iron), 'L', MetaItems.BATTERY_RE_LV_LITHIUM.getStackForm());
        }
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 3 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ProcessingWire method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    ItemStack stack = simpleStack.asItemStack();
    switch(entry.orePrefix) {
        case wireGt01:
            if (entry.material == Materials.Cobalt || entry.material == Materials.Lead || entry.material == Materials.Tin || entry.material == Materials.Zinc || entry.material == Materials.SolderingAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_t_cable01", OreDictUnifier.get(OrePrefix.cableGt01, entry.material), entry, new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Items.STRING));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 1, 15)).outputs(OreDictUnifier.get(OrePrefix.cableGt01, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt01, entry.material)).outputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 1, 15)).duration(100).EUt(8).buildAndRegister();
            } else if (entry.material == Materials.RedAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_t_cable01", OreDictUnifier.get(OrePrefix.cableGt01, entry.material), entry, new UnificationEntry(OrePrefix.plate, Materials.Paper));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper)).outputs(OreDictUnifier.get(OrePrefix.cableGt01, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt01, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper)).duration(100).EUt(8).buildAndRegister();
            } else {
                RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(stack).circuitMeta(24).fluidInputs(Materials.Rubber.getFluid(L)).outputs(OreDictUnifier.get(OrePrefix.cableGt01, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt01, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Rubber)).duration(100).EUt(8).buildAndRegister();
            }
            if (!entry.material.hasFlag(DustMaterial.MatFlags.NO_SMASHING)) {
                RecipeMap.BENDER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack)).outputs(OreDictUnifier.get(OrePrefix.springSmall, entry.material, 2)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.WIREMILL_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack)).outputs(OreDictUnifier.get(OrePrefix.wireFine, entry.material, 4)).duration(200).EUt(8).buildAndRegister();
                RecipeMap.WIREMILL_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.ingot, entry.material)).outputs(GTUtility.copy(GTUtility.copyAmount(2, stack), OreDictUnifier.get(OrePrefix.wireFine, entry.material, 8))).duration(100).EUt(4).buildAndRegister();
                RecipeMap.WIREMILL_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.stick, entry.material)).outputs(GTUtility.copy(stack, OreDictUnifier.get(OrePrefix.wireFine, entry.material, 4))).duration(50).EUt(4).buildAndRegister();
            }
            if (!entry.material.hasFlag(DustMaterial.MatFlags.NO_WORKING)) {
                ModHandler.addShapedRecipe(entry.material + "_t_wire01", OreDictUnifier.get(OrePrefix.wireGt01, entry.material), "Xx", 'X', OreDictUnifier.get(OrePrefix.plate, entry.material));
            }
            RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(2, stack)).circuitMeta(2).outputs(OreDictUnifier.get(OrePrefix.wireGt02, entry.material)).duration(150).EUt(8).buildAndRegister();
            RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(4, stack)).circuitMeta(4).outputs(OreDictUnifier.get(OrePrefix.wireGt04, entry.material)).duration(200).EUt(8).buildAndRegister();
            RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(8, stack)).circuitMeta(8).outputs(OreDictUnifier.get(OrePrefix.wireGt08, entry.material)).duration(300).EUt(8).buildAndRegister();
            RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(12, stack)).circuitMeta(12).outputs(OreDictUnifier.get(OrePrefix.wireGt12, entry.material)).duration(400).EUt(8).buildAndRegister();
            RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(16, stack)).circuitMeta(16).outputs(OreDictUnifier.get(OrePrefix.wireGt16, entry.material)).duration(500).EUt(8).buildAndRegister();
            break;
        case wireGt02:
            if (entry.material == Materials.Cobalt || entry.material == Materials.Lead || entry.material == Materials.Tin || entry.material == Materials.Zinc || entry.material == Materials.SolderingAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_t_cable02", OreDictUnifier.get(OrePrefix.cableGt02, entry.material), entry, new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Items.STRING));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 1, 15)).outputs(OreDictUnifier.get(OrePrefix.cableGt02, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt02, entry.material)).outputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 1, 15)).duration(100).EUt(8).buildAndRegister();
            } else if (entry.material == Materials.RedAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_t_cable02", OreDictUnifier.get(OrePrefix.cableGt02, entry.material), entry, new UnificationEntry(OrePrefix.plate, Materials.Paper));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper)).outputs(OreDictUnifier.get(OrePrefix.cableGt02, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt02, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper)).duration(100).EUt(8).buildAndRegister();
            } else {
                RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(stack).circuitMeta(24).fluidInputs(Materials.Rubber.getFluid(L)).outputs(OreDictUnifier.get(OrePrefix.cableGt02, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt02, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Rubber)).duration(100).EUt(8).buildAndRegister();
            }
            ModHandler.addShapelessRecipe(entry.material + "_wire02_t_wire01", OreDictUnifier.get(OrePrefix.wireGt01, entry.material, 2), entry);
            ModHandler.addShapelessRecipe(entry.material + "_wire01_t_wire02", GTUtility.copyAmount(1, stack), new UnificationEntry(OrePrefix.wireGt01, entry.material), new UnificationEntry(OrePrefix.wireGt01, entry.material));
            break;
        case wireGt04:
            if (entry.material == Materials.Cobalt || entry.material == Materials.Lead || entry.material == Materials.Tin || entry.material == Materials.Zinc || entry.material == Materials.SolderingAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_t_cable04", OreDictUnifier.get(OrePrefix.cableGt04, entry.material), entry, new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Items.STRING));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 2, 15)).outputs(OreDictUnifier.get(OrePrefix.cableGt04, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt04, entry.material)).outputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 2, 15)).duration(100).EUt(8).buildAndRegister();
            } else if (entry.material == Materials.RedAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_t_cable04", OreDictUnifier.get(OrePrefix.cableGt04, entry.material), entry, new UnificationEntry(OrePrefix.plate, Materials.Paper), new UnificationEntry(OrePrefix.plate, Materials.Paper));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper, 2)).outputs(OreDictUnifier.get(OrePrefix.cableGt04, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt04, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper, 2)).duration(100).EUt(8).buildAndRegister();
            } else {
                RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(stack).circuitMeta(24).fluidInputs(Materials.Rubber.getFluid(2 * L)).outputs(OreDictUnifier.get(OrePrefix.cableGt04, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt04, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Rubber, 2)).duration(100).EUt(8).buildAndRegister();
            }
            ModHandler.addShapelessRecipe(entry.material + "_wire04_t_wire01", OreDictUnifier.get(OrePrefix.wireGt01, entry.material, 4), entry);
            ModHandler.addShapelessRecipe(entry.material + "_wire02_t_wire04", GTUtility.copyAmount(1, stack), new UnificationEntry(OrePrefix.wireGt02, entry.material), new UnificationEntry(OrePrefix.wireGt02, entry.material));
            break;
        case wireGt08:
            if (entry.material == Materials.Cobalt || entry.material == Materials.Lead || entry.material == Materials.Tin || entry.material == Materials.Zinc || entry.material == Materials.SolderingAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_wire08_t_cable08", OreDictUnifier.get(OrePrefix.cableGt08, entry.material), entry, new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Items.STRING));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 3, 15)).outputs(OreDictUnifier.get(OrePrefix.cableGt08, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt08, entry.material)).outputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 3, 15)).duration(100).EUt(8).buildAndRegister();
            } else if (entry.material == Materials.RedAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_wire08_t_cable08", OreDictUnifier.get(OrePrefix.cableGt08, entry.material), entry, new UnificationEntry(OrePrefix.plate, Materials.Paper), new UnificationEntry(OrePrefix.plate, Materials.Paper), new UnificationEntry(OrePrefix.plate, Materials.Paper));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper)).outputs(OreDictUnifier.get(OrePrefix.cableGt08, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt08, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper, 3)).duration(100).EUt(8).buildAndRegister();
            } else {
                RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(stack).circuitMeta(24).fluidInputs(Materials.Rubber.getFluid(3 * L)).outputs(OreDictUnifier.get(OrePrefix.cableGt08, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt08, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Rubber, 3)).duration(100).EUt(8).buildAndRegister();
            }
            ModHandler.addShapelessRecipe(entry.material + "_wire08_t_wire01", OreDictUnifier.get(OrePrefix.wireGt01, entry.material, 8), entry);
            ModHandler.addShapelessRecipe(entry.material + "_wire04_t_wire08", GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.wireGt04, entry.material), OreDictUnifier.get(OrePrefix.wireGt04, entry.material));
            break;
        case wireGt12:
            if (entry.material == Materials.Cobalt || entry.material == Materials.Lead || entry.material == Materials.Tin || entry.material == Materials.Zinc || entry.material == Materials.SolderingAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_wire12_t_cable12", OreDictUnifier.get(OrePrefix.cableGt12, entry.material), entry, new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Blocks.CARPET, 1, 15), new ItemStack(Items.STRING));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 4, 15)).outputs(OreDictUnifier.get(OrePrefix.cableGt12, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt12, entry.material)).outputs(GTUtility.copyAmount(1, stack), new ItemStack(Blocks.CARPET, 4, 15)).duration(100).EUt(8).buildAndRegister();
            } else if (entry.material == Materials.RedAlloy) {
                ModHandler.addShapelessRecipe(entry.material + "_wire12_t_cable12", OreDictUnifier.get(OrePrefix.cableGt12, entry.material), entry, new UnificationEntry(OrePrefix.plate, Materials.Paper), new UnificationEntry(OrePrefix.plate, Materials.Paper), new UnificationEntry(OrePrefix.plate, Materials.Paper), new UnificationEntry(OrePrefix.plate, Materials.Paper));
                RecipeMap.BOXINATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper, 4)).outputs(OreDictUnifier.get(OrePrefix.cableGt12, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt12, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Paper, 4)).duration(100).EUt(8).buildAndRegister();
            } else {
                RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(stack).circuitMeta(24).fluidInputs(Materials.Rubber.getFluid(4 * L)).outputs(OreDictUnifier.get(OrePrefix.cableGt12, entry.material)).duration(100).EUt(8).buildAndRegister();
                RecipeMap.UNBOXINATOR_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.cableGt12, entry.material)).outputs(GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.plate, Materials.Rubber, 4)).duration(100).EUt(8).buildAndRegister();
            }
            ModHandler.addShapelessRecipe(entry.material + "_wire12_t_wire01", OreDictUnifier.get(OrePrefix.wireGt01, entry.material, 12), entry);
            ModHandler.addShapelessRecipe(entry.material + "_wire12_t_wire08_04", GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.wireGt08, entry.material), OreDictUnifier.get(OrePrefix.wireGt04, entry.material));
            break;
        case wireGt16:
            ModHandler.addShapelessRecipe(entry.material + "_wire01_t_wire16", OreDictUnifier.get(OrePrefix.wireGt01, entry.material, 16), entry);
            ModHandler.addShapelessRecipe(entry.material + "_wire08_t_wire16", GTUtility.copyAmount(1, stack), OreDictUnifier.get(OrePrefix.wireGt08, entry.material), OreDictUnifier.get(OrePrefix.wireGt08, entry.material));
            break;
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 4 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class OreDictUnifier method getUnificated.

public static ItemStack getUnificated(ItemStack itemStack) {
    if (itemStack.isEmpty())
        return ItemStack.EMPTY;
    UnificationEntry unificationEntry = getUnificationEntry(itemStack);
    if (unificationEntry == null || !stackUnificationItems.containsKey(unificationEntry) || !unificationEntry.orePrefix.isUnificationEnabled)
        return itemStack;
    ArrayList<SimpleItemStack> keys = stackUnificationItems.get(unificationEntry);
    keys.sort(Comparator.comparing(a -> a.item.delegate.name().getResourceDomain()));
    return keys.size() > 0 ? keys.get(0).asItemStack(itemStack.getCount()) : itemStack;
}
Also used : java.util(java.util) CaseFormat(com.google.common.base.CaseFormat) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) M(gregtech.api.GTValues.M) GemMaterial(gregtech.api.unification.material.type.GemMaterial) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) Material(gregtech.api.unification.material.type.Material) MetalMaterial(gregtech.api.unification.material.type.MetalMaterial) ItemMaterialInfo(gregtech.api.unification.stack.ItemMaterialInfo) ItemStack(net.minecraft.item.ItemStack) MaterialStack(gregtech.api.unification.stack.MaterialStack) MinecraftForge(net.minecraftforge.common.MinecraftForge) ImmutableList(com.google.common.collect.ImmutableList) OreDictionary(net.minecraftforge.oredict.OreDictionary) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) OrePrefix(gregtech.api.unification.ore.OrePrefix) DustMaterial(gregtech.api.unification.material.type.DustMaterial) Nullable(javax.annotation.Nullable) Joiner(com.google.common.base.Joiner) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack)

Example 5 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class ModHandler method addShapelessRecipe.

/**
 * Add Shapeless Crafting Recipes
 */
public static void addShapelessRecipe(String regName, ItemStack result, Object... recipe) {
    boolean skip = false;
    if (result.isEmpty()) {
        GTLog.logger.error("Result cannot be an empty ItemStack. Recipe: {}", regName);
        GTLog.logger.error("Stacktrace:", new IllegalArgumentException());
        skip = true;
    }
    skip |= validateRecipe(regName, recipe);
    if (skip) {
        RecipeMap.setFoundInvalidRecipe(true);
        return;
    }
    for (byte i = 0; i < recipe.length; i++) {
        if (recipe[i] instanceof MetaItem.MetaValueItem) {
            recipe[i] = ((MetaItem<?>.MetaValueItem) recipe[i]).getStackForm();
        } else if (recipe[i] instanceof Enum) {
            recipe[i] = ((Enum<?>) recipe[i]).name();
        } else if (recipe[i] instanceof UnificationEntry) {
            recipe[i] = recipe[i].toString();
        } else if (recipe[i] instanceof Character) {
            String toolName = getToolNameByCharacter((char) recipe[i]);
            if (toolName == null) {
                throw new IllegalArgumentException("Tool name is not found for char " + recipe[i]);
            }
            recipe[i] = toolName;
        } else if (!(recipe[i] instanceof ItemStack || recipe[i] instanceof Item || recipe[i] instanceof Block || recipe[i] instanceof String)) {
            throw new IllegalArgumentException(recipe.getClass().getSimpleName() + " type is not suitable for crafting input.");
        }
    }
    IRecipe shapelessRecipe = new ShapelessOreRecipe(null, result.copy(), recipe).setRegistryName(regName);
    try {
        // workaround for MC bug that makes all shaped recipe inputs that have enchanted items
        // or renamed ones on input fail, even if all ingredients match it
        Field field = ShapelessOreRecipe.class.getDeclaredField("isSimple");
        field.setAccessible(true);
        field.setBoolean(shapelessRecipe, false);
    } catch (ReflectiveOperationException exception) {
        GTLog.logger.error("Failed to mark shapeless recipe as complex", exception);
    }
    ForgeRegistries.RECIPES.register(shapelessRecipe);
}
Also used : MetaItem(gregtech.api.items.metaitem.MetaItem) IRecipe(net.minecraft.item.crafting.IRecipe) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) Item(net.minecraft.item.Item) MetaItem(gregtech.api.items.metaitem.MetaItem) Field(java.lang.reflect.Field) ShapelessOreRecipe(net.minecraftforge.oredict.ShapelessOreRecipe) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Aggregations

UnificationEntry (gregtech.api.unification.stack.UnificationEntry)65 ItemStack (net.minecraft.item.ItemStack)50 OrePrefix (gregtech.api.unification.ore.OrePrefix)11 Material (gregtech.api.unification.material.type.Material)10 SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)10 MaterialStack (gregtech.api.unification.stack.MaterialStack)8 IntCircuitIngredient (gregtech.api.recipes.ingredients.IntCircuitIngredient)6 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)6 MetaValueItem (gregtech.api.items.metaitem.MetaItem.MetaValueItem)5 CountableIngredient (gregtech.api.recipes.CountableIngredient)5 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)4 Nullable (javax.annotation.Nullable)4 CaseFormat (com.google.common.base.CaseFormat)3 Joiner (com.google.common.base.Joiner)3 ImmutableList (com.google.common.collect.ImmutableList)3 GTValues (gregtech.api.GTValues)3 M (gregtech.api.GTValues.M)3 ToolMetaItem (gregtech.api.items.toolitem.ToolMetaItem)3 ModHandler (gregtech.api.recipes.ModHandler)3