Search in sources :

Example 6 with FluidMaterial

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

the class LargeTurbineWorkableHandler method addOutputFluids.

private void addOutputFluids(FuelRecipe currentRecipe, int fuelAmountUsed) {
    if (largeTurbine.turbineType == TurbineType.STEAM) {
        int waterFluidAmount = fuelAmountUsed / 15;
        if (waterFluidAmount > 0) {
            FluidStack waterStack = Materials.Water.getFluid(waterFluidAmount);
            largeTurbine.exportFluidHandler.fill(waterStack, true);
        }
    } else if (largeTurbine.turbineType == TurbineType.PLASMA) {
        FluidMaterial material = MetaFluids.getMaterialFromFluid(currentRecipe.getRecipeFluid().getFluid());
        if (material != null) {
            largeTurbine.exportFluidHandler.fill(material.getFluid(fuelAmountUsed), true);
        }
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) FluidStack(net.minecraftforge.fluids.FluidStack)

Example 7 with FluidMaterial

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

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

the class DecompositionRecipeHandler method processDecomposition.

public static void processDecomposition(OrePrefix decomposePrefix, FluidMaterial material) {
    if (material.materialComponents.isEmpty() || (!material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING) && !material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_CENTRIFUGING)) || // disable decomposition if explicitly disabled for this material or for one of it's components
    material.hasFlag(DISABLE_DECOMPOSITION))
        return;
    ArrayList<ItemStack> outputs = new ArrayList<>();
    ArrayList<FluidStack> fluidOutputs = new ArrayList<>();
    int totalInputAmount = 0;
    // compute outputs
    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) (1000 * component.amount)));
        }
    }
    // generate builder
    RecipeBuilder builder;
    if (material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING)) {
        builder = RecipeMaps.ELECTROLYZER_RECIPES.recipeBuilder().duration((int) material.getAverageProtons() * totalInputAmount * 8).EUt(getElectrolyzingVoltage(material.materialComponents.stream().map(s -> s.material).collect(Collectors.toList())));
    } else {
        builder = RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder().duration((int) Math.ceil(material.getAverageMass() * totalInputAmount * 1.5)).EUt(30);
    }
    builder.outputs(outputs);
    builder.fluidOutputs(fluidOutputs);
    // finish builder
    if (decomposePrefix != null) {
        builder.input(decomposePrefix, material, totalInputAmount);
    } else {
        builder.fluidInputs(material.getFluid(1000));
    }
    if (material.hasFlag(DECOMPOSITION_REQUIRES_HYDROGEN)) {
        builder.fluidInputs(Materials.Hydrogen.getFluid(1000 * 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) ItemStack(net.minecraft.item.ItemStack) RecipeBuilder(gregtech.api.recipes.RecipeBuilder)

Example 9 with FluidMaterial

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

the class MetaFluids method init.

public static void init() {
    Materials.Water.setMaterialFluid(FluidRegistry.WATER);
    Materials.Lava.setMaterialFluid(FluidRegistry.LAVA);
    FluidRegistry.registerFluid(DISTILLED_WATER);
    Materials.DistilledWater.setMaterialFluid(DISTILLED_WATER);
    fluidSprites.add(AUTO_GENERATED_FLUID_TEXTURE);
    FluidTooltipUtil.registerTooltip(FluidRegistry.WATER, FluidTooltipUtil.getWaterTooltip());
    FluidTooltipUtil.registerTooltip(DISTILLED_WATER, FluidTooltipUtil.getWaterTooltip());
    // alternative names for forestry fluids
    setAlternativeFluidName(Materials.Ethanol, FluidType.NORMAL, "bio.ethanol");
    setAlternativeFluidName(Materials.Honey, FluidType.NORMAL, "for.honey");
    setAlternativeFluidName(Materials.SeedOil, FluidType.NORMAL, "seed.oil");
    setAlternativeFluidName(Materials.Ice, FluidType.NORMAL, "fluid.ice");
    setDefaultTexture(Materials.Air, FluidType.NORMAL);
    setDefaultTexture(Materials.Oxygen, FluidType.NORMAL);
    setDefaultTexture(Materials.Hydrogen, FluidType.NORMAL);
    setDefaultTexture(Materials.Deuterium, FluidType.NORMAL);
    setDefaultTexture(Materials.Tritium, FluidType.NORMAL);
    setDefaultTexture(Materials.Helium, FluidType.NORMAL);
    setDefaultTexture(Materials.Argon, FluidType.NORMAL);
    setDefaultTexture(Materials.Radon, FluidType.NORMAL);
    setDefaultTexture(Materials.Fluorine, FluidType.NORMAL);
    setDefaultTexture(Materials.TitaniumTetrachloride, FluidType.NORMAL);
    setDefaultTexture(Materials.Helium3, FluidType.NORMAL);
    setDefaultTexture(Materials.Methane, FluidType.NORMAL);
    setDefaultTexture(Materials.Nitrogen, FluidType.NORMAL);
    setDefaultTexture(Materials.NitrogenDioxide, FluidType.NORMAL);
    setDefaultTexture(Materials.Steam, FluidType.NORMAL);
    setDefaultTexture(Materials.OilHeavy, FluidType.NORMAL);
    setDefaultTexture(Materials.OilMedium, FluidType.NORMAL);
    setDefaultTexture(Materials.OilLight, FluidType.NORMAL);
    setDefaultTexture(Materials.HydrogenSulfide, FluidType.NORMAL);
    setDefaultTexture(Materials.SulfuricGas, FluidType.NORMAL);
    setDefaultTexture(Materials.Gas, FluidType.NORMAL);
    setDefaultTexture(Materials.SulfuricNaphtha, FluidType.NORMAL);
    setDefaultTexture(Materials.SulfuricLightFuel, FluidType.NORMAL);
    setDefaultTexture(Materials.SulfuricHeavyFuel, FluidType.NORMAL);
    setDefaultTexture(Materials.Naphtha, FluidType.NORMAL);
    setDefaultTexture(Materials.LightFuel, FluidType.NORMAL);
    setDefaultTexture(Materials.HeavyFuel, FluidType.NORMAL);
    setDefaultTexture(Materials.LPG, FluidType.NORMAL);
    setDefaultTexture(Materials.CrackedLightFuel, FluidType.NORMAL);
    setDefaultTexture(Materials.CrackedHeavyFuel, FluidType.NORMAL);
    setDefaultTexture(Materials.UUAmplifier, FluidType.NORMAL);
    setDefaultTexture(Materials.Chlorine, FluidType.NORMAL);
    setDefaultTexture(Materials.Mercury, FluidType.NORMAL);
    setDefaultTexture(Materials.NitroFuel, FluidType.NORMAL);
    setDefaultTexture(Materials.SodiumPersulfate, FluidType.NORMAL);
    setDefaultTexture(Materials.Glyceryl, FluidType.NORMAL);
    setDefaultTexture(Materials.Lubricant, FluidType.NORMAL);
    setDefaultTexture(Materials.Creosote, FluidType.NORMAL);
    setDefaultTexture(Materials.SeedOil, FluidType.NORMAL);
    setDefaultTexture(Materials.Oil, FluidType.NORMAL);
    setDefaultTexture(Materials.Fuel, FluidType.NORMAL);
    setDefaultTexture(Materials.Honey, FluidType.NORMAL);
    setDefaultTexture(Materials.Biomass, FluidType.NORMAL);
    setDefaultTexture(Materials.Ethanol, FluidType.NORMAL);
    setDefaultTexture(Materials.SulfuricAcid, FluidType.NORMAL);
    setDefaultTexture(Materials.Milk, FluidType.NORMAL);
    setDefaultTexture(Materials.McGuffium239, FluidType.NORMAL);
    setDefaultTexture(Materials.Glue, FluidType.NORMAL);
    for (Material material : Material.MATERIAL_REGISTRY) {
        if (!(material instanceof FluidMaterial))
            continue;
        FluidMaterial fluidMaterial = (FluidMaterial) material;
        if (fluidMaterial.shouldGenerateFluid() && fluidMaterial.getMaterialFluid() == null) {
            int temperature = fluidMaterial.getFluidTemperature();
            Fluid fluid = registerFluid(fluidMaterial, FluidType.NORMAL, temperature);
            fluidMaterial.setMaterialFluid(fluid);
            FluidTooltipUtil.registerTooltip(fluid, fluidMaterial.chemicalFormula);
        }
        if (fluidMaterial.shouldGeneratePlasma() && fluidMaterial.getMaterialPlasma() == null) {
            Fluid fluid = registerFluid(fluidMaterial, FluidType.PLASMA, 30000);
            fluidMaterial.setMaterialPlasma(fluid);
            FluidTooltipUtil.registerTooltip(fluid, fluidMaterial.chemicalFormula);
        }
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) Material(gregtech.api.unification.material.type.Material) FluidMaterial(gregtech.api.unification.material.type.FluidMaterial)

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