Files
MinecraftForge/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch
T
2013-07-26 12:49:14 +08:00

55 lines
2.2 KiB
Diff

--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java
@@ -17,6 +17,9 @@
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.RenderLivingEvent;
+import net.minecraftforge.common.MinecraftForge;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -28,6 +31,9 @@
/** The model to be used during the render passes. */
protected ModelBase renderPassModel;
+
+ public static float NAME_TAG_RANGE = 64.0f;
+ public static float NAME_TAG_RANGE_SNEAK = 32.0f;
public RendererLivingEntity(ModelBase par1ModelBase, float par2)
{
@@ -442,12 +448,13 @@
*/
protected void passSpecialRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6)
{
+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLivingBase, this))) return;
if (this.func_110813_b(par1EntityLivingBase))
{
float f = 1.6F;
float f1 = 0.016666668F * f;
double d3 = par1EntityLivingBase.getDistanceSqToEntity(this.renderManager.livingPlayer);
- float f2 = par1EntityLivingBase.isSneaking() ? 32.0F : 64.0F;
+ float f2 = par1EntityLivingBase.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE;
if (d3 < (double)(f2 * f2))
{
@@ -491,6 +498,7 @@
}
}
}
+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Post(par1EntityLivingBase, this));
}
protected boolean func_110813_b(EntityLivingBase par1EntityLivingBase)
@@ -570,7 +578,9 @@
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre((EntityLivingBase)par1Entity, this))) return;
this.func_130000_a((EntityLivingBase)par1Entity, par2, par4, par6, par8, par9);
+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post((EntityLivingBase)par1Entity, this));
}
}