Search in sources :

Example 1 with FluidMaterial

use of gregtech.api.unification.material.type.FluidMaterial 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)

Example 2 with FluidMaterial

use of gregtech.api.unification.material.type.FluidMaterial 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 3 with FluidMaterial

use of gregtech.api.unification.material.type.FluidMaterial in project GregTech by GregTechCE.

the class ArcFurnaceRecipeBuilder method buildAndRegister.

@Override
public void buildAndRegister() {
    if (fluidInputs.isEmpty()) {
        fluidInputs(Materials.Oxygen.getFluid(this.duration));
        for (FluidMaterial material : new FluidMaterial[] { Materials.Argon, Materials.Nitrogen }) {
            int plasmaAmount = (int) Math.max(1L, this.duration / (material.getAverageMass() * 16L));
            SimpleRecipeBuilder builder = RecipeMaps.PLASMA_ARC_FURNACE_RECIPES.recipeBuilder().inputsIngredients(this.inputs).outputs(this.outputs).duration(Math.max(1, this.duration / 16)).EUt(this.EUt / 3).fluidInputs(material.getPlasma(plasmaAmount)).fluidOutputs(material.getFluid(plasmaAmount));
            builder.buildAndRegister();
        }
    }
    super.buildAndRegister();
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial)

Example 4 with FluidMaterial

use of gregtech.api.unification.material.type.FluidMaterial in project GregTech by GregTechCE.

the class DecompositionRecipeHandler method runRecipeGeneration.

public static void runRecipeGeneration() {
    for (Material material : Material.MATERIAL_REGISTRY) {
        if (material instanceof FluidMaterial) {
            OrePrefix prefix = material instanceof DustMaterial ? OrePrefix.dust : null;
            processDecomposition(prefix, (FluidMaterial) material);
        }
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) OrePrefix(gregtech.api.unification.ore.OrePrefix) Material(gregtech.api.unification.material.type.Material) FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial)

Example 5 with FluidMaterial

use of gregtech.api.unification.material.type.FluidMaterial in project GregTech by GregTechCE.

the class WireRecipeHandler method generateWireRecipe.

public static void generateWireRecipe(OrePrefix wirePrefix, IngotMaterial material) {
    int cableAmount = (int) (wirePrefix.materialAmount * 2 / M);
    OrePrefix cablePrefix = OrePrefix.valueOf("cable" + wirePrefix.name().substring(4));
    ItemStack cableStack = OreDictUnifier.get(cablePrefix, material);
    if (material.cableProperties == null)
        return;
    if (isPaperInsulatedCable(material)) {
        if (cableAmount <= 7) {
            Object[] ingredients = new Object[2 + cableAmount];
            ingredients[0] = new UnificationEntry(wirePrefix, material);
            ingredients[ingredients.length - 1] = OreDictNames.string;
            for (int i = 1; i < ingredients.length - 1; i++) {
                ingredients[i] = new ItemStack(Blocks.CARPET, 1, EnumDyeColor.BLACK.getMetadata());
            }
            ModHandler.addShapelessRecipe(String.format("%s_cable_%d", material, cableAmount), cableStack, ingredients);
        }
    }
    if (isPaperInsulatedCable(material)) {
        ItemStack carpetStack = new ItemStack(Blocks.CARPET, cableAmount, EnumDyeColor.BLACK.getMetadata());
        RecipeMaps.PACKER_RECIPES.recipeBuilder().input(wirePrefix, material).inputs(carpetStack).outputs(cableStack).duration(100).EUt(8).buildAndRegister();
    }
    for (FluidMaterial insulationMaterial : INSULATION_MATERIALS.keySet()) {
        int cableTier = GTUtility.getTierByVoltage(material.cableProperties.voltage);
        int materialAmount = getMaterialAmount(cableTier, INSULATION_MATERIALS.get(insulationMaterial));
        if (materialAmount == -1)
            continue;
        if (wirePrefix != OrePrefix.wireGtSingle) {
            RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(OrePrefix.wireGtSingle, material, cableAmount).circuitMeta(24 + ArrayUtils.indexOf(WIRE_DOUBLING_ORDER, wirePrefix)).fluidInputs(insulationMaterial.getFluid(materialAmount * cableAmount)).outputs(cableStack).duration(150).EUt(8).buildAndRegister();
        }
        RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(wirePrefix, material).circuitMeta(24).fluidInputs(insulationMaterial.getFluid(materialAmount * cableAmount)).outputs(cableStack).duration(150).EUt(8).buildAndRegister();
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) OrePrefix(gregtech.api.unification.ore.OrePrefix) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Aggregations

FluidMaterial (gregtech.api.unification.material.type.FluidMaterial)9 ItemStack (net.minecraft.item.ItemStack)5 DustMaterial (gregtech.api.unification.material.type.DustMaterial)4 RecipeBuilder (gregtech.api.recipes.RecipeBuilder)3 SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)3 FluidStack (net.minecraftforge.fluids.FluidStack)3 Material (gregtech.api.unification.material.type.Material)2 OrePrefix (gregtech.api.unification.ore.OrePrefix)2 MaterialStack (gregtech.api.unification.stack.MaterialStack)2 UnificationEntry (gregtech.api.unification.stack.UnificationEntry)2 ArrayList (java.util.ArrayList)2