Search in sources :

Example 1 with Fluids

use of forestry.core.fluids.Fluids in project ForestryMC by ForestryMC.

the class Config method loadConfigFluids.

private static void loadConfigFluids() {
    for (Fluids fluid : Fluids.values()) {
        String fluidName = Translator.translateToLocal("fluid." + fluid.getTag());
        boolean enabledFluid = !Config.disabledFluids.contains(fluid.getTag());
        String enableFluidComment = Translator.translateToLocalFormatted("for.config.fluids.enable.format", fluidName);
        enabledFluid = configFluid.getBoolean("enableFluid", fluid.getTag(), enabledFluid, enableFluidComment);
        if (!enabledFluid) {
            Config.disabledFluids.add(fluid.getTag());
        }
        boolean enabledFluidBlock = !Config.disabledBlocks.contains(fluid.getTag());
        String enableFluidBlockComment = Translator.translateToLocalFormatted("for.config.fluid.blocks.enable.format", fluidName);
        enabledFluidBlock = configFluid.getBoolean("enableFluidBlock", fluid.getTag(), enabledFluidBlock, enableFluidBlockComment);
        if (!enabledFluidBlock) {
            Config.disabledBlocks.add(fluid.getTag());
        }
    }
    configFluid.save();
}
Also used : Fluids(forestry.core.fluids.Fluids)

Example 2 with Fluids

use of forestry.core.fluids.Fluids in project ForestryMC by ForestryMC.

the class RenderMachine method renderTank.

private void renderTank(ModelRenderer tankModel, ResourceLocation textureBase, TankRenderInfo renderInfo, float factor) {
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    textureManager.bindTexture(textureBase);
    tankModel.render(factor);
    ResourceLocation textureResourceTankLevel = texturesTankLevels.get(renderInfo.getLevel());
    if (textureResourceTankLevel == null) {
        return;
    }
    // TODO: render fluid overlay on tank
    Fluids fluidDefinition = Fluids.getFluidDefinition(renderInfo.getFluidStack());
    Color primaryTankColor = fluidDefinition == null ? Color.BLUE : fluidDefinition.getParticleColor();
    float[] colors = new float[3];
    primaryTankColor.getRGBColorComponents(colors);
    GlStateManager.color(colors[0], colors[1], colors[2], 1.0f);
    textureManager.bindTexture(textureResourceTankLevel);
    tankModel.render(factor);
    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) Fluids(forestry.core.fluids.Fluids) ResourceLocation(net.minecraft.util.ResourceLocation) Color(java.awt.Color)

Aggregations

Fluids (forestry.core.fluids.Fluids)2 Color (java.awt.Color)1 TextureManager (net.minecraft.client.renderer.texture.TextureManager)1 ResourceLocation (net.minecraft.util.ResourceLocation)1