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);
}
}
}
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();
}
}
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();
}
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);
}
}
}
Aggregations