Search in sources :

Example 21 with SimpleItemStack

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

the class ProcessingCrystallized method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    if (entry.material instanceof SolidMaterial) {
        ItemStack stack = simpleStack.asItemStack();
        ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, ((SolidMaterial) entry.material).macerateInto);
        RecipeMap.HAMMER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack)).outputs(dustStack).duration(10).EUt(10).buildAndRegister();
        RecipeMap.MACERATOR_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack)).outputs(dustStack).duration(20).EUt(16).buildAndRegister();
    }
}
Also used : SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) ItemStack(net.minecraft.item.ItemStack) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack)

Example 22 with SimpleItemStack

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

the class ProcessingDirtyDust method registerOre.

// @Override
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack itemStack) {
    if (entry.material instanceof DustMaterial) {
        DustMaterial material = (DustMaterial) entry.material;
        ItemStack stack = itemStack.asItemStack();
        ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, material);
        if (entry.orePrefix == OrePrefix.dustPure && material.separatedOnto != null) {
            ItemStack separatedStack = OreDictUnifier.get(OrePrefix.dustSmall, material.separatedOnto);
            RecipeMap.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder().inputs(stack).outputs(dustStack).chancedOutput(separatedStack, 4000).duration((int) material.separatedOnto.getMass()).EUt(24).buildAndRegister();
        }
        int byProductIndex;
        if (entry.orePrefix == OrePrefix.dustRefined) {
            byProductIndex = 2;
        } else if (entry.orePrefix == OrePrefix.dustPure) {
            byProductIndex = 1;
        } else
            byProductIndex = 0;
        FluidMaterial byproduct = GTUtility.selectItemInList(byProductIndex, material, material.oreByProducts, FluidMaterial.class);
        RecipeBuilder builder = RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder().inputs(stack).outputs(dustStack).duration((int) (material.getMass() * 4)).EUt(24);
        if (byproduct instanceof DustMaterial) {
            builder.outputs(OreDictUnifier.get(OrePrefix.dustTiny, byproduct));
        } else {
            builder.fluidOutputs(byproduct.getFluid(GTValues.L / 9));
        }
        builder.buildAndRegister();
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack) RecipeBuilder(gregtech.api.recipes.RecipeBuilder)

Example 23 with SimpleItemStack

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

the class ProcessingGear method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    if (entry.material instanceof SolidMaterial) {
        SolidMaterial material = (SolidMaterial) entry.material;
        ItemStack stack = simpleStack.asItemStack();
        boolean isSmall = entry.orePrefix == OrePrefix.gearSmall;
        if (material.hasFlag(DustMaterial.MatFlags.SMELT_INTO_FLUID)) {
            RecipeMap.FLUID_SOLIDFICATION_RECIPES.recipeBuilder().notConsumable(isSmall ? MetaItems.SHAPE_MOLD_GEAR_SMALL : MetaItems.SHAPE_MOLD_GEAR).fluidInputs(material.getFluid(L * (isSmall ? 1 : 4))).outputs(stack).duration(isSmall ? 20 : 100).EUt(8).buildAndRegister();
        }
        if (isSmall) {
            if (material instanceof MetalMaterial && !material.hasFlag(DustMaterial.MatFlags.NO_SMASHING)) {
                ModHandler.addShapedRecipe("sgear_" + material, stack, "h##", "#P#", 'P', OreDictUnifier.get(OrePrefix.plate, material));
            }
        } else {
            ModHandler.addShapedRecipe("gear_" + material, stack, "RPR", "PdP", "RPR", 'P', OreDictUnifier.get(OrePrefix.plate, material), 'R', OreDictUnifier.get(OrePrefix.stick, material));
        }
    }
}
Also used : SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 24 with SimpleItemStack

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

the class ProcessingPlank method registerOre.

// public static void register() {
// OrePrefix.plank.addProcessingHandler(new ProcessingPlank());
// }
// 
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    ItemStack stack = simpleStack.asItemStack();
    if (entry.material == Materials.Wood) {
        RecipeMap.LATHE_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack)).outputs(OreDictUnifier.get(OrePrefix.stick, Materials.Wood, 2)).duration(10).EUt(8).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(8, stack), OreDictUnifier.get(OrePrefix.dust, Materials.Redstone, 1)).outputs(new ItemStack(Blocks.NOTEBLOCK, 1)).duration(200).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(8, stack), OreDictUnifier.get(OrePrefix.gem, Materials.Diamond, 1)).outputs(new ItemStack(Blocks.JUKEBOX, 1)).duration(400).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(6, stack), new ItemStack(Items.BOOK, 3)).outputs(new ItemStack(Blocks.BOOKSHELF, 1)).duration(400).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack)).circuitMeta(1).outputs(new ItemStack(Blocks.WOODEN_BUTTON, 1)).duration(100).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(2, stack)).circuitMeta(2).outputs(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE)).duration(200).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(3, stack)).circuitMeta(3).outputs(new ItemStack(Blocks.TRAPDOOR)).duration(300).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(4, stack)).circuitMeta(4).outputs(new ItemStack(Blocks.CRAFTING_TABLE)).duration(400).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(6, stack)).circuitMeta(6).outputs(new ItemStack(Items.OAK_DOOR)).duration(600).EUt(4).buildAndRegister();
        RecipeMap.ASSEMBLER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(8, stack)).circuitMeta(8).outputs(new ItemStack(Blocks.CHEST, 1)).duration(800).EUt(4).buildAndRegister();
        if (stack.getItemDamage() == W) {
            for (byte i = 0; i < 64; i++) {
                // FIXME
                ItemStack itemStack = stack.copy();
                itemStack.setItemDamage(i);
                ItemStack output = ModHandler.getRecipeOutput(null, itemStack, itemStack, itemStack);
                if (!output.isEmpty() && output.getCount() >= 3) {
                    RecipeMap.CUTTER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, itemStack)).outputs(GTUtility.copyAmount(output.getCount() / 3, output)).duration(25).EUt(4).buildAndRegister();
                    // ModHandler.removeRecipe(itemStack, itemStack, itemStack);
                    ModHandler.addShapedRecipe("slab?_" + entry.material, GTUtility.copyAmount(output.getCount() / 3, output), "sP", 'P', itemStack);
                }
                if (itemStack.isEmpty() && i >= 16)
                    break;
            }
        } else {
            ItemStack output = ModHandler.getRecipeOutput(null, stack, stack, stack);
            if (!output.isEmpty() && output.getCount() >= 3) {
                RecipeMap.CUTTER_RECIPES.recipeBuilder().inputs(GTUtility.copyAmount(1, stack)).outputs(GTUtility.copyAmount(output.getCount() / 3, output)).duration(25).EUt(4).buildAndRegister();
                // ModHandler.removeRecipe(stack, stack, stack);
                ModHandler.addShapedRecipe("slab?_" + entry.material, GTUtility.copyAmount(output.getCount() / 3, output), "sP", 'P', stack);
            }
        }
    }
}
Also used : SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 25 with SimpleItemStack

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

the class ProcessingRotor method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    if (entry.material instanceof SolidMaterial && !entry.material.hasFlag(NO_UNIFICATION | NO_WORKING)) {
        SolidMaterial material = (SolidMaterial) entry.material;
        ItemStack stack = simpleStack.asItemStack();
        ItemStack plateStack = OreDictUnifier.get(OrePrefix.plate, material);
        ItemStack ringStack = OreDictUnifier.get(OrePrefix.ring, material);
        ModHandler.addShapedRecipe("rotor_" + entry.material, stack, "PhP", "SRf", "PdP", 'P', plateStack, 'R', ringStack, 'S', OreDictUnifier.get(OrePrefix.screw, material));
    // RecipeMap.ASSEMBLER_RECIPES.recipeBuilder()
    // .inputs(GTUtility.copyAmount(4, plateStack), ringStack)
    // .outputs(stack)
    // .fluidInputs(Materials.SolderingAlloy.getFluid(32)) // TODO MATERIAL FLUIDS
    // .duration(240)
    // .EUt(24)
    // .buildAndRegister();
    }
}
Also used : SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Aggregations

SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)28 ItemStack (net.minecraft.item.ItemStack)25 UnificationEntry (gregtech.api.unification.stack.UnificationEntry)11 DustMaterial (gregtech.api.unification.material.type.DustMaterial)9 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)8 GemMaterial (gregtech.api.unification.material.type.GemMaterial)6 MaterialStack (gregtech.api.unification.stack.MaterialStack)6 Nullable (javax.annotation.Nullable)6 MetalMaterial (gregtech.api.unification.material.type.MetalMaterial)5 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)5 OrePrefix (gregtech.api.unification.ore.OrePrefix)4 CaseFormat (com.google.common.base.CaseFormat)3 Joiner (com.google.common.base.Joiner)3 ImmutableList (com.google.common.collect.ImmutableList)3 M (gregtech.api.GTValues.M)3 FluidMaterial (gregtech.api.unification.material.type.FluidMaterial)3 Material (gregtech.api.unification.material.type.Material)3 java.util (java.util)3 MinecraftForge (net.minecraftforge.common.MinecraftForge)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3