From 5f3ece629c83615184ecd1adffea462555257d95 Mon Sep 17 00:00:00 2001 From: iChun Date: Wed, 25 Dec 2013 17:03:19 +0800 Subject: [PATCH] Add render offset to event. --- .../entity/RendererLivingEntity.java.patch | 8 ++++---- .../client/event/RenderLivingEvent.java | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index f4cf46127..e9689d1ab 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -24,7 +24,7 @@ // JAVADOC METHOD $$ func_76986_a public void doRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) { -+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this))) return; ++ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this, par2, par4, par6))) return; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); this.mainModel.onGround = this.renderSwingProgress(par1EntityLivingBase, par9); @@ -32,7 +32,7 @@ GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); this.passSpecialRender(par1EntityLivingBase, par2, par4, par6); -+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this)); ++ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this, par2, par4, par6)); } // JAVADOC METHOD $$ func_77036_a @@ -40,7 +40,7 @@ // JAVADOC METHOD $$ func_77033_b protected void passSpecialRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6) { -+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLivingBase, this))) return; ++ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLivingBase, this, par2, par4, par6))) return; GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if (this.func_110813_b(par1EntityLivingBase)) @@ -57,7 +57,7 @@ } } } -+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Post(par1EntityLivingBase, this)); ++ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Post(par1EntityLivingBase, this, par2, par4, par6)); } protected boolean func_110813_b(EntityLivingBase par1EntityLivingBase) diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index d20322f15..7108688ca 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -9,35 +9,41 @@ public abstract class RenderLivingEvent extends Event { public final EntityLivingBase entity; public final RendererLivingEntity renderer; + public final double x; + public final double y; + public final double z; - public RenderLivingEvent(EntityLivingBase entity, RendererLivingEntity renderer) + public RenderLivingEvent(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z) { this.entity = entity; this.renderer = renderer; + this.x = x; + this.y = y; + this.z = z; } @Cancelable public static class Pre extends RenderLivingEvent { - public Pre(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } + public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } public static class Post extends RenderLivingEvent { - public Post(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } + public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } public abstract static class Specials extends RenderLivingEvent { - public Specials(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } + public Specials(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } @Cancelable public static class Pre extends Specials { - public Pre(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } + public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } public static class Post extends Specials { - public Post(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } + public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } } }