Search in sources :

Example 1 with SimpleItemStack

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

the class ProcessingCraftingLens method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    ItemStack stack = simpleStack.asItemStack();
    if (entry.material == MarkerMaterials.Color.Red) {
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.foil, Materials.Copper)).notConsumable(stack).outputs(MetaItems.CIRCUIT_PARTS_WIRING_BASIC.getStackForm()).duration(64).EUt(30).buildAndRegister();
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.foil, Materials.AnnealedCopper)).notConsumable(stack).outputs(MetaItems.CIRCUIT_PARTS_WIRING_BASIC.getStackForm()).duration(64).EUt(30).buildAndRegister();
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.foil, Materials.Gold)).notConsumable(stack).outputs(MetaItems.CIRCUIT_PARTS_WIRING_ADVANCED.getStackForm()).duration(64).EUt(120).buildAndRegister();
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.foil, Materials.Electrum)).notConsumable(stack).outputs(MetaItems.CIRCUIT_PARTS_WIRING_ADVANCED.getStackForm()).duration(64).EUt(120).buildAndRegister();
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.foil, Materials.Platinum)).notConsumable(stack).outputs(MetaItems.CIRCUIT_PARTS_WIRING_ELITE.getStackForm()).duration(64).EUt(480).buildAndRegister();
    } else if (entry.material == MarkerMaterials.Color.Green) {
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.plate, Materials.Olivine)).notConsumable(stack).outputs(MetaItems.CIRCUIT_PARTS_CRYSTAL_CHIP_ELITE.getStackForm()).duration(256).EUt(480).buildAndRegister();
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(OreDictUnifier.get(OrePrefix.plate, Materials.Emerald)).notConsumable(stack).outputs(MetaItems.CIRCUIT_PARTS_CRYSTAL_CHIP_ELITE.getStackForm()).duration(256).EUt(480).buildAndRegister();
    } else if (entry.material == MarkerMaterials.Color.White) {
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.SANDSTONE, 1, 2)).notConsumable(stack).outputs(new ItemStack(Blocks.SANDSTONE, 1, 1)).duration(20).EUt(16).buildAndRegister();
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.STONE)).notConsumable(stack).outputs(new ItemStack(Blocks.STONEBRICK, 1, 3)).duration(50).EUt(16).buildAndRegister();
        RecipeMap.LASER_ENGRAVER_RECIPES.recipeBuilder().inputs(new ItemStack(Blocks.QUARTZ_BLOCK)).notConsumable(stack).outputs(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1)).duration(50).EUt(16).buildAndRegister();
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack)

Example 2 with SimpleItemStack

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

the class ProcessingCrushed method registerOre.

/*public static void register() {
	    ProcessingCrushed processing = new ProcessingCrushed();
		OrePrefix.clump.addProcessingHandler(processing);
		OrePrefix.shard.addProcessingHandler(processing);
		OrePrefix.crushed.addProcessingHandler(processing);
		OrePrefix.dirtyGravel.addProcessingHandler(processing);
	}*/
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    ItemStack stack = simpleStack.asItemStack();
    if (entry.material instanceof SolidMaterial) {
        SolidMaterial material = (SolidMaterial) entry.material;
        ItemStack impureDustStack = OreDictUnifier.get(OrePrefix.dustImpure, material);
        ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, material);
        DustMaterial byproductMaterial = GTUtility.selectItemInList(0, material, material.oreByProducts, DustMaterial.class);
        // fallback for dirtyGravel, shard & clump
        if (impureDustStack.isEmpty()) {
            impureDustStack = dustStack;
        }
        RecipeMap.HAMMER_RECIPES.recipeBuilder().inputs(stack).outputs(impureDustStack).duration(10).EUt(16).buildAndRegister();
        RecipeMap.MACERATOR_RECIPES.recipeBuilder().inputs(stack).outputs(impureDustStack).duration(100).EUt(24).chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial), 1000);
        RecipeMap.ORE_WASHER_RECIPES.recipeBuilder().inputs(stack).fluidInputs(ModHandler.getWater(1000)).outputs(OreDictUnifier.get(entry.orePrefix == OrePrefix.crushed ? OrePrefix.crushedPurified : OrePrefix.dustPure, material), OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
        RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder().inputs(stack).duration((int) entry.material.getMass() * 20).outputs(OreDictUnifier.get(entry.orePrefix == OrePrefix.crushed ? OrePrefix.crushedCentrifuged : OrePrefix.dust, entry.material), OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
        if (material.washedIn != null) {
            DustMaterial washingByproduct = GTUtility.selectItemInList(3, material, material.oreByProducts, DustMaterial.class);
            RecipeMap.CHEMICAL_BATH_RECIPES.recipeBuilder().inputs(stack).fluidInputs(material.washedIn.getFluid(1000)).outputs(OreDictUnifier.get(entry.orePrefix == OrePrefix.crushed ? OrePrefix.crushedPurified : OrePrefix.dustPure, entry.material)).chancedOutput(OreDictUnifier.get(OrePrefix.dust, washingByproduct), 7000).chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Stone), 4000).duration(800).EUt(8).buildAndRegister();
        }
    }
}
Also used : SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 3 with SimpleItemStack

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

the class ProcessingCrushedCentrifuged method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack itemStack) {
    if (entry.material instanceof SolidMaterial) {
        ItemStack stack = itemStack.asItemStack();
        SolidMaterial solidMaterial = (SolidMaterial) entry.material;
        ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, solidMaterial);
        ItemStack byproductStack = OreDictUnifier.get(OrePrefix.dust, GTUtility.selectItemInList(2, solidMaterial, solidMaterial.oreByProducts, DustMaterial.class), 1);
        RecipeMap.HAMMER_RECIPES.recipeBuilder().inputs(stack).outputs(dustStack).duration(10).EUt(16).buildAndRegister();
        RecipeMap.MACERATOR_RECIPES.recipeBuilder().inputs(stack).outputs(dustStack).chancedOutput(byproductStack, 1000).buildAndRegister();
    }
}
Also used : SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial) ItemStack(net.minecraft.item.ItemStack) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack)

Example 4 with SimpleItemStack

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

the class ProcessingCrushedPurified method registerOre.

// public static void register() {
// OrePrefix.crushedPurified.addProcessingHandler(new ProcessingCrushedPurified());
// }
// @Override
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack itemStack) {
    if (entry.material instanceof SolidMaterial) {
        ItemStack crushedPurifiedStack = itemStack.asItemStack();
        SolidMaterial solidMaterial = (SolidMaterial) entry.material;
        ItemStack crushedCentrifugedStack = OreDictUnifier.get(OrePrefix.crushedCentrifuged, solidMaterial);
        ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, solidMaterial);
        ItemStack byproductStack = OreDictUnifier.get(OrePrefix.dustTiny, GTUtility.selectItemInList(1, solidMaterial, solidMaterial.oreByProducts, DustMaterial.class));
        if (!crushedCentrifugedStack.isEmpty()) {
            RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder().inputs(crushedPurifiedStack).outputs(crushedCentrifugedStack, byproductStack).duration((int) (entry.material.getMass() * 20)).EUt(60).buildAndRegister();
        } else {
            RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder().inputs(crushedPurifiedStack).outputs(dustStack, byproductStack).duration((int) (entry.material.getMass() * 20)).EUt(60).buildAndRegister();
        }
        if (entry.material instanceof GemMaterial) {
            ItemStack exquisiteStack = OreDictUnifier.get(OrePrefix.gemExquisite, entry.material);
            ItemStack flawlessStack = OreDictUnifier.get(OrePrefix.gemFlawless, entry.material);
            ItemStack gemStack = OreDictUnifier.get(OrePrefix.gem, entry.material);
            ItemStack flawedStack = OreDictUnifier.get(OrePrefix.gemFlawed, entry.material);
            ItemStack chippedStack = OreDictUnifier.get(OrePrefix.gemChipped, entry.material);
            if (entry.material.hasFlag(GemMaterial.MatFlags.HIGH_SIFTER_OUTPUT)) {
                RecipeMap.SIFTER_RECIPES.recipeBuilder().inputs(crushedPurifiedStack).chancedOutput(exquisiteStack, 300).chancedOutput(flawlessStack, 1200).chancedOutput(gemStack, 4500).chancedOutput(flawedStack, 1400).chancedOutput(chippedStack, 2800).chancedOutput(dustStack, 3500).duration(800).EUt(16).buildAndRegister();
            } else {
                RecipeMap.SIFTER_RECIPES.recipeBuilder().inputs(crushedPurifiedStack).chancedOutput(exquisiteStack, 100).chancedOutput(flawlessStack, 400).chancedOutput(gemStack, 1500).chancedOutput(flawedStack, 2000).chancedOutput(chippedStack, 4000).chancedOutput(dustStack, 5000).duration(800).EUt(16).buildAndRegister();
            }
        }
    }
}
Also used : SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial) ItemStack(net.minecraft.item.ItemStack) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) GemMaterial(gregtech.api.unification.material.type.GemMaterial)

Example 5 with SimpleItemStack

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

the class ProcessingDecomposition method registerOre.

// @Override
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack itemStack) {
    if (entry.material instanceof FluidMaterial) {
        FluidMaterial material = (FluidMaterial) entry.material;
        if (!material.materialComponents.isEmpty() && (material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING) || material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_CENTRIFUGING))) {
            // compute outputs
            ArrayList<ItemStack> outputs = new ArrayList<>();
            ArrayList<FluidStack> fluidOutputs = new ArrayList<>();
            int totalInputAmount = 0;
            for (MaterialStack component : material.materialComponents) {
                totalInputAmount += component.amount;
                if (component.material instanceof DustMaterial) {
                    outputs.add(OreDictUnifier.get(OrePrefix.dust, component.material, (int) component.amount));
                } else if (component.material instanceof FluidMaterial) {
                    FluidMaterial componentMaterial = (FluidMaterial) component.material;
                    fluidOutputs.add(componentMaterial.getFluid((int) (GTValues.L * component.amount)));
                }
            }
            // generate builder
            RecipeBuilder builder;
            if (material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING)) {
                builder = RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder().duration((int) material.getProtons() * totalInputAmount * 8).EUt(Math.min(4, material.materialComponents.size()) * 30);
            } else {
                builder = RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder().duration((int) material.getMass() * totalInputAmount * 2).EUt(30);
            }
            builder.outputs(outputs);
            builder.fluidOutputs(fluidOutputs);
            // finish builder
            if (entry.orePrefix == OrePrefix.dust) {
                builder.inputs(itemStack.asItemStack(totalInputAmount));
            } else {
                builder.fluidInputs(material.getFluid(GTValues.L * totalInputAmount));
            }
            // register recipe
            builder.buildAndRegister();
        }
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) FluidStack(net.minecraftforge.fluids.FluidStack) MaterialStack(gregtech.api.unification.stack.MaterialStack) ArrayList(java.util.ArrayList) DustMaterial(gregtech.api.unification.material.type.DustMaterial) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack) RecipeBuilder(gregtech.api.recipes.RecipeBuilder)

Aggregations

SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)26 ItemStack (net.minecraft.item.ItemStack)24 UnificationEntry (gregtech.api.unification.stack.UnificationEntry)10 DustMaterial (gregtech.api.unification.material.type.DustMaterial)9 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)8 GemMaterial (gregtech.api.unification.material.type.GemMaterial)6 MetalMaterial (gregtech.api.unification.material.type.MetalMaterial)5 MaterialStack (gregtech.api.unification.stack.MaterialStack)5 Nullable (javax.annotation.Nullable)5 OrePrefix (gregtech.api.unification.ore.OrePrefix)4 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)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