List of usage examples for net.minecraftforge.client.event RenderGameOverlayEvent getType
public ElementType getType()
From source file:com.specialeffect.gui.IconOverlay.java
License:Open Source License
@SubscribeEvent public void onRenderExperienceBar(RenderGameOverlayEvent event) { // We draw after the ExperienceBar has drawn. The event raised by GuiIngameForge.pre() // will return true from isCancelable. If you call event.setCanceled(true) in // that case, the portion of rendering which this event represents will be canceled. // We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns // false and that the eventType represents the ExperienceBar event. if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { return;// w w w . ja va 2 s . c o m } // Don't show if the debug screen is open if (Minecraft.getMinecraft().gameSettings.showDebugInfo) { return; } if (mVisible) { this.rescale(); this.drawTexture(); } }
From source file:com.specialeffect.gui.JoystickControlOverlay.java
License:Open Source License
@SubscribeEvent public void onRenderExperienceBar(RenderGameOverlayEvent event) { // We draw after the ExperienceBar has drawn. The event raised by GuiIngameForge.pre() // will return true from isCancelable. If you call event.setCanceled(true) in // that case, the portion of rendering which this event represents will be canceled. // We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns // false and that the eventType represents the ExperienceBar event. if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { return;//from w w w . j a v a2 s. com } if (mVisible) { this.rescale(); GL11.glDisable(GL11.GL_LIGHTING); this.mc.renderEngine.bindTexture(mResource); GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD); GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.5f); ModUtils.drawTexQuad(0, 0, mDisplayWidth, mDisplayHeight); // reset GL attributes! GL11.glPopAttrib(); } }
From source file:com.specialeffect.gui.StateOverlay.java
License:Open Source License
@SubscribeEvent public void onRenderExperienceBar(RenderGameOverlayEvent event) { // We draw after the ExperienceBar has drawn. The event raised by GuiIngameForge.pre() // will return true from isCancelable. If you call event.setCanceled(true) in // that case, the portion of rendering which this event represents will be canceled. // We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns // false and that the eventType represents the ExperienceBar event. if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { return;/* w w w. j av a2 s .c om*/ } // Don't show if the debug screen is open if (Minecraft.getMinecraft().gameSettings.showDebugInfo) { return; } this.rescale(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); // LEFT icons int xPos = mIconPadding; int yPos = mIconPadding; for (int i = 0; i < mResourcesLeft.size(); i++) { if (mFlagsLeft.get(i)) { drawScaledTextureWithGlow(mResourcesLeft.get(i), xPos, yPos, mIconSize, mIconSize); } xPos += mIconSize + mIconPadding; } // RIGHT ICONS xPos = mDisplayWidth - mIconSize - mIconPadding; for (int i = 0; i < mResourcesRight.size(); i++) { if (mFlagsRight.get(i)) { drawScaledTextureWithGlow(mResourcesRight.get(i), xPos, yPos, mIconSize, mIconSize); } xPos -= (mIconSize + mIconPadding); } }
From source file:jayavery.accesstweaks.Sounds.java
License:Open Source License
/** Override vanilla subtitles with this module's subtitles. */ @SubscribeEvent/* ww w.j ava 2 s . com*/ public static void guiOverlay(RenderGameOverlayEvent event) { if (event.getType() == ElementType.SUBTITLES) { event.setCanceled(true); guiSubtitles.renderSubtitles(event.getResolution()); } }