Merge pull request #1254 from Adubbz/master

Added a RenderFogEvent
This commit is contained in:
LexManos 2014-07-28 13:29:49 -07:00
commit 7170a8c4c6
2 changed files with 26 additions and 0 deletions

View file

@ -193,3 +193,11 @@
if (entitylivingbase.func_70644_a(Potion.field_76440_q))
{
f1 = 5.0F;
@@ -1930,6 +1980,7 @@
GL11.glFogf(GL11.GL_FOG_START, f1 * 0.05F);
GL11.glFogf(GL11.GL_FOG_END, Math.min(f1, 192.0F) * 0.5F);
}
+ MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.EntityViewRenderEvent.RenderFogEvent(this, entitylivingbase, block, p_78468_2_, p_78468_1_, f1));
}
GL11.glEnable(GL11.GL_COLOR_MATERIAL);

View file

@ -5,6 +5,7 @@ import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.entity.EntityLivingBase;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.Event.Result;
/**
* Event that hooks into EntityRenderer, allowing any feature to customize visual attributes of
@ -41,6 +42,23 @@ public abstract class EntityViewRenderEvent extends Event
}
}
/**
* Event that allows any feature to customize the rendering of fog.
*/
@HasResult
public static class RenderFogEvent extends EntityViewRenderEvent
{
public final int fogMode;
public final float farPlaneDistance;
public RenderFogEvent(EntityRenderer renderer, EntityLivingBase entity, Block block, double renderPartialTicks, int fogMode, float farPlaneDistance)
{
super(renderer, entity, block, renderPartialTicks);
this.fogMode = fogMode;
this.farPlaneDistance = farPlaneDistance;
}
}
/**
* Event that allows any feature to customize the color of fog the player sees.
* NOTE: Any change made to one of the color variables will affect the result seen in-game.