Search in sources :

Example 1 with BCFluidBlock

use of buildcraft.lib.fluid.BCFluidBlock in project BuildCraft by BuildCraft.

the class BCEnergyFluids method defineFluid.

private static BCFluid defineFluid(int[] data, int heat, String name) {
    final int density = data[0];
    final int baseViscosity = data[1];
    final int boilPoint = data[2];
    final int baseQuanta = data[3];
    final int texLight = data[4];
    final int texDark = data[5];
    final boolean sticky = data[6] == 1;
    String fullName = name + (heat == 0 ? "" : "_heat_" + heat);
    int tempAdjustedViscosity = baseViscosity * (4 - heat) / 4;
    int boilAdjustedDensity = density * (heat >= boilPoint ? -1 : 1);
    String fluidTexture = "buildcraftenergy:blocks/fluids/" + name + "_heat_" + heat;
    BCFluid def = new BCFluid(fullName, new ResourceLocation(fluidTexture + "_still"), new ResourceLocation(fluidTexture + "_flow"));
    def.setBlockName(name + "_heat_" + heat);
    def.setMapColour(getMapColor(texDark));
    def.setFlammable(true);
    def.setHeat(heat);
    def.setUnlocalizedName(name);
    def.setTemperature(300 + 20 * heat);
    def.setViscosity(tempAdjustedViscosity);
    def.setDensity(boilAdjustedDensity);
    def.setGaseous(def.getDensity() < 0);
    def.setColour(texLight, texDark);
    def.setHeatable(true);
    FluidManager.register(def);
    BCFluidBlock block = (BCFluidBlock) def.getBlock();
    block.setLightOpacity(3);
    block.setSticky(sticky);
    // Distance that the fluid will travel: 1->16
    // Higher heat values travel a little further
    block.setQuantaPerBlock(baseQuanta + (baseQuanta > 6 ? heat : heat / 2));
    allFluids.add(def);
    return def;
}
Also used : BCFluid(buildcraft.lib.fluid.BCFluid) ResourceLocation(net.minecraft.util.ResourceLocation) BCFluidBlock(buildcraft.lib.fluid.BCFluidBlock)

Aggregations

BCFluid (buildcraft.lib.fluid.BCFluid)1 BCFluidBlock (buildcraft.lib.fluid.BCFluidBlock)1 ResourceLocation (net.minecraft.util.ResourceLocation)1