Add pre and post event to rendering Chat, allowing for placement of the chat box. Closes #733

This commit is contained in:
Lex Manos 2013-09-30 14:32:12 -07:00
parent 71ececdbb4
commit 01cf29a202
2 changed files with 25 additions and 4 deletions

View File

@ -723,12 +723,19 @@ public class GuiIngameForge extends GuiIngame
protected void renderChat(int width, int height)
{
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, (float)(height - 48), 0.0F);
mc.mcProfiler.startSection("chat");
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
if (MinecraftForge.EVENT_BUS.post(event)) return;
GL11.glPushMatrix();
GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F);
persistantChatGUI.drawChat(updateCounter);
mc.mcProfiler.endSection();
GL11.glPopMatrix();
post(CHAT);
mc.mcProfiler.endSection();
}
protected void renderPlayerList(int width, int height)

View File

@ -24,7 +24,8 @@ public class RenderGameOverlayEvent extends Event
EXPERIENCE,
TEXT,
HEALTHMOUNT,
JUMPBAR
JUMPBAR,
CHAT
}
public final float partialTicks;
@ -79,4 +80,17 @@ public class RenderGameOverlayEvent extends Event
this.right = right;
}
}
public static class Chat extends Pre
{
public int posX;
public int posY;
public Chat(RenderGameOverlayEvent parent, int posX, int posY)
{
super(parent, ElementType.CHAT);
this.posX = posX;
this.posY = posY;
}
}
}