Search in sources :

Example 1 with BCFluid

use of buildcraft.lib.fluid.BCFluid 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)

Example 2 with BCFluid

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

the class BCEnergySprites method onTextureStitchPre.

@SubscribeEvent
public static void onTextureStitchPre(TextureStitchEvent.Pre event) {
    TextureMap map = event.getMap();
    ResourceLocation[][] fromSprites = new ResourceLocation[3][2];
    for (int h = 0; h < 3; h++) {
        fromSprites[h][0] = new ResourceLocation("buildcraftenergy:blocks/fluids/heat_" + h + "_still");
        fromSprites[h][1] = new ResourceLocation("buildcraftenergy:blocks/fluids/heat_" + h + "_flow");
    }
    for (BCFluid f : BCEnergyFluids.allFluids) {
        AtlasSpriteFluid spriteStill = new AtlasSpriteFluid(f.getStill().toString(), fromSprites[f.getHeatValue()][0], f);
        AtlasSpriteFluid spriteFlow = new AtlasSpriteFluid(f.getFlowing().toString(), fromSprites[f.getHeatValue()][1], f);
        map.setTextureEntry(spriteStill);
        map.setTextureEntry(spriteFlow);
    }
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) BCFluid(buildcraft.lib.fluid.BCFluid) AtlasSpriteFluid(buildcraft.energy.client.sprite.AtlasSpriteFluid) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with BCFluid

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

the class ItemFragileFluidContainer method getItemStackDisplayName.

@Override
public String getItemStackDisplayName(ItemStack stack) {
    FluidStack fluid = getFluid(stack);
    String localized;
    if (fluid == null) {
        localized = "ERROR! NULL FLUID!";
    } else if (fluid.getFluid() instanceof BCFluid) {
        BCFluid bcFluid = (BCFluid) fluid.getFluid();
        if (bcFluid.isHeatable()) {
            // Add the heatable bit to the end of the name
            localized = bcFluid.getBareLocalizedName(fluid);
            String whole = LocaleUtil.localize(getUnlocalizedName() + ".name", localized);
            return whole + LocaleUtil.localize("buildcraft.fluid.heat_" + bcFluid.getHeatValue());
        } else {
            localized = fluid.getLocalizedName();
        }
    } else {
        localized = fluid.getLocalizedName();
    }
    return LocaleUtil.localize(getUnlocalizedName() + ".name", localized);
}
Also used : BCFluid(buildcraft.lib.fluid.BCFluid) FluidStack(net.minecraftforge.fluids.FluidStack)

Example 4 with BCFluid

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

the class BCEnergyModels method onModelBake.

@SubscribeEvent
public static void onModelBake(ModelBakeEvent event) {
    ENGINE_PROGRESS.value = 0.2;
    ENGINE_STAGE.value = EnumPowerStage.BLUE;
    ENGINE_FACING.value = EnumFacing.UP;
    ModelVariableData varData = new ModelVariableData();
    varData.setNodes(ENGINE_STONE.createTickableNodes());
    varData.tick();
    varData.refresh();
    event.getModelRegistry().putObject(new ModelResourceLocation(EnumEngineType.STONE.getItemModelLocation(), "inventory"), new ModelItemSimple(Arrays.stream(ENGINE_STONE.getCutoutQuads()).map(MutableQuad::toBakedItem).collect(Collectors.toList()), ModelItemSimple.TRANSFORM_BLOCK, true));
    varData.setNodes(ENGINE_IRON.createTickableNodes());
    varData.tick();
    varData.refresh();
    event.getModelRegistry().putObject(new ModelResourceLocation(EnumEngineType.IRON.getItemModelLocation(), "inventory"), new ModelItemSimple(Arrays.stream(ENGINE_IRON.getCutoutQuads()).map(MutableQuad::toBakedItem).collect(Collectors.toList()), ModelItemSimple.TRANSFORM_BLOCK, true));
    for (BCFluid fluid : BCEnergyFluids.allFluids) {
        ModelFluid modelFluid = new ModelFluid(fluid);
        event.getModelRegistry().putObject(new ModelResourceLocation("buildcraftenergy:fluid_block_" + fluid.getBlockName()), modelFluid.bake(modelFluid.getDefaultState(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()));
    }
}
Also used : ModelVariableData(buildcraft.lib.misc.data.ModelVariableData) BCFluid(buildcraft.lib.fluid.BCFluid) ModelItemSimple(buildcraft.lib.client.model.ModelItemSimple) ModelFluid(net.minecraftforge.client.model.ModelFluid) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with BCFluid

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

the class BCEnergyRecipes method addHeatExchange.

private static void addHeatExchange(BCFluid[] fluid) {
    for (int i = 0; i < fluid.length - 1; i++) {
        BCFluid cool = fluid[i];
        BCFluid hot = fluid[i + 1];
        FluidStack cool_f = new FluidStack(cool, 10);
        FluidStack hot_f = new FluidStack(hot, 10);
        int ch = cool.getHeatValue();
        int hh = hot.getHeatValue();
        BuildcraftRecipeRegistry.refineryRecipes.addHeatableRecipe(cool_f, hot_f, ch, hh);
        BuildcraftRecipeRegistry.refineryRecipes.addCoolableRecipe(hot_f, cool_f, hh, ch);
    }
}
Also used : BCFluid(buildcraft.lib.fluid.BCFluid) FluidStack(net.minecraftforge.fluids.FluidStack)

Aggregations

BCFluid (buildcraft.lib.fluid.BCFluid)5 ResourceLocation (net.minecraft.util.ResourceLocation)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 AtlasSpriteFluid (buildcraft.energy.client.sprite.AtlasSpriteFluid)1 ModelItemSimple (buildcraft.lib.client.model.ModelItemSimple)1 BCFluidBlock (buildcraft.lib.fluid.BCFluidBlock)1 ModelVariableData (buildcraft.lib.misc.data.ModelVariableData)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 TextureMap (net.minecraft.client.renderer.texture.TextureMap)1 ModelFluid (net.minecraftforge.client.model.ModelFluid)1