Example usage for net.minecraftforge.client.event EntityViewRenderEvent.FogColors getRenderPartialTicks

List of usage examples for net.minecraftforge.client.event EntityViewRenderEvent.FogColors getRenderPartialTicks

Introduction

In this page you can find the example usage for net.minecraftforge.client.event EntityViewRenderEvent.FogColors getRenderPartialTicks.

Prototype

public double getRenderPartialTicks() 

Source Link

Usage

From source file:org.blockartistry.DynSurround.client.handlers.FogEffectHandler.java

License:MIT License

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void fogColorEvent(final EntityViewRenderEvent.FogColors event) {

    if (ignoreFog())
        return;/*from w  w w. ja v  a2s  . c o  m*/

    final IBlockState block = ActiveRenderInfo.getBlockStateAtEntityViewpoint(event.getEntity().world,
            event.getEntity(), (float) event.getRenderPartialTicks());
    if (block.getMaterial() == Material.LAVA || block.getMaterial() == Material.WATER)
        return;

    final Color color = this.scanner.getFogColor(EnvironState.getWorld(),
            (float) event.getRenderPartialTicks());
    if (color != null) {
        event.setRed(color.red);
        event.setGreen(color.green);
        event.setBlue(color.blue);
    }
}

From source file:org.blockartistry.mod.DynSurround.client.FogEffectHandler.java

License:MIT License

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void fogColorEvent(final EntityViewRenderEvent.FogColors event) {
    // Timing is everything...
    if (currentFogColor == null)
        return;// w  w  w.  j a  v  a2s  . c  o m

    if (currentFogLevel == 0)
        return;

    final IBlockState block = ActiveRenderInfo.getBlockStateAtEntityViewpoint(event.getEntity().worldObj,
            event.getEntity(), (float) event.getRenderPartialTicks());
    if (block.getMaterial() == Material.LAVA || block.getMaterial() == Material.WATER)
        return;

    event.setRed(currentFogColor.red);
    event.setGreen(currentFogColor.green);
    event.setBlue(currentFogColor.blue);
}