@SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.EXPERIENCE) return; else { ScaledResolution sr = event.getResolution(); EntityPlayer player = Minecraft.getMinecraft().player; if (!player.capabilities.isCreativeMode) { double healthBarWidth = (double) player.getHealth() / player.getMaxHealth() * 81.0; int xPos = sr.getScaledWidth() / 2 - 91; int yPos = sr.getScaledHeight() - 39; mc.renderEngine.bindTexture(location); this.drawTexturedModalRect(xPos, yPos, 0, 0, 81, 9); this.drawTexturedModalRect(xPos, yPos, 0, 9, (int) healthBarWidth, 8); } } }
@SubscribeEvent public static void onHudRender(RenderGameOverlayEvent.Pre event) { if (event.getType() == ElementType.ALL) { PlayerHUDRenderer.render(event.getPartialTicks()); } if ( event.getType() == ElementType.HOTBAR || event.getType() == ElementType.FOOD || event.getType() == ElementType.HEALTH || event.getType() == ElementType.EXPERIENCE) { event.setCanceled(true); } }
@SubscribeEvent public void renderOverlay(RenderGameOverlayEvent evt) { if (activated && evt.type == ElementType.CROSSHAIRS) { glEnable(GL_BLEND); mat.setUniforms(mat.newUniformBlock().setFloat("aspect", (float) evt.resolution.getScaledWidth() / evt.resolution.getScaledHeight())); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); for (Instance i : instances) { pipeline.draw(mat, mesh, i, 0); } pipeline.flush(); evt.setCanceled(true); } }
@SubscribeEvent public void onRenderExperienceBar(RenderGameOverlayEvent.Post event) { if (event.type != ElementType.EXPERIENCE) { return; } if (!DragonPlayer.get(mc.thePlayer).isDragon()) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); int level = DragonPlayer.get(mc.thePlayer).getLevel(); if (mc.playerController.gameIsSurvivalOrAdventure() && level > 0) { mc.mcProfiler.startSection("dragonLevel"); int color = Color.MAGENTA.getRGB(); String text = "" + level; int x = (event.resolution.getScaledWidth() - mc.fontRenderer.getStringWidth(text)) / 2; int y = event.resolution.getScaledHeight() - 31 - 4 - 12; mc.fontRenderer.drawString(text, x, y, color); mc.mcProfiler.endSection(); } }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.LOWEST) public void onRender(RenderGameOverlayEvent.Post event) { EntityPlayer player = Minecraft.getMinecraft().player; ItemStack held = player.getHeldItem(EnumHand.MAIN_HAND); if (event.isCanceled() || event.getType() != ElementType.EXPERIENCE) { return; } if (!held.isEmpty() && held.getItem() == this) { int slot = UtilPlayer.getFirstSlotWithBlock(player); if (slot >= 0) { ItemStack stack = player.inventory.getStackInSlot(slot); int leftOff = 0, rightOff = -18, topOff = 0, bottOff = 0; int xmain = RenderLoc.locToX(EventRender.renderLocation, leftOff, rightOff); int ymain = RenderLoc.locToY(EventRender.renderLocation, topOff, bottOff); if (!stack.isEmpty()) ModCyclic.proxy.renderItemOnScreen(stack, xmain, ymain); } } }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.LOWEST) public void onRender(RenderGameOverlayEvent.Post event) { if (event.isCanceled() || event.getType() != ElementType.EXPERIENCE) { return; } EntityPlayer effectivePlayer = ModCyclic.proxy.getClientPlayer(); ItemStack heldWand = UtilSpellCaster.getPlayerWandIfHeld(effectivePlayer); if (heldWand.isEmpty()) { return; } int itemSlot = ItemCyclicWand.BuildType.getSlot(heldWand); ItemStack current = InventoryWand.getFromSlot(heldWand, itemSlot); if (!current.isEmpty()) { //THE ITEM INSIDE THE BUILDY WHEEL int leftOff = 7, rightOff = -26, topOff = 36, bottOff = -2; int xmain = RenderLoc.locToX(renderLocation, leftOff, rightOff); int ymain = RenderLoc.locToY(renderLocation, topOff, bottOff); ModCyclic.proxy.renderItemOnScreen(current, xmain, ymain); // ModCyclic.proxy.renderItemOnScreen(current, RenderLoc.xoffset - 1, RenderLoc.ypadding + RenderLoc.spellSize * 2); } }
@SubscribeEvent(priority = EventPriority.NORMAL) public void onRenderExperienceBar(RenderGameOverlayEvent event) { if (event.isCancelable() || event.type != ElementType.EXPERIENCE) { return; } if (!mc.thePlayer.capabilities.isCreativeMode) { int posX = event.resolution.getScaledWidth() / 2 + 10; int posY = event.resolution.getScaledHeight() - 48; ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) Minecraft.getMinecraft().thePlayer); float maxMana = props.getMaxMana(); int manabarwidth = (int) ((float) props.getMana() / maxMana * 48); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); this.mc.getTextureManager().bindTexture(texturepath); mc.renderEngine.bindTexture(new ResourceLocation(TheDarkEra.MODID + ":textures/gui/SoulBar.png")); mc.ingameGUI.drawTexturedModalRect(posX, posY, 0, 0, 50, 5); mc.ingameGUI.drawTexturedModalRect(posX + 1, posY + 1, 0, 6, manabarwidth, 3); String a = ""+props.getMaxMana(); String b = ""+props.getMana(); mc.fontRenderer.drawStringWithShadow(a, posX, posY, 0xFFFFFF); mc.fontRenderer.drawStringWithShadow(b, posX, posY+8, 0xFFFFFF); System.out.println(maxMana); } }
@SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent.Pre event) { if (event.type != ElementType.ALL) return; Minecraft mc = Minecraft.getMinecraft(); ScaledResolution var5 = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); int var6 = var5.getScaledWidth(); int var7 = var5.getScaledHeight(); mc.entityRenderer.setupOverlayRendering(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F); bindOverlayTexture(); zLevel = -90f; this.drawTexturedModalRect(0, var7 / 6, 0, 0, 147, 182); fontRenderer.setUnicodeFlag(true); int i = 0; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
@SubscribeEvent public void afterDraw (RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.ALL) return; if (ZTS.displayStatus() == 1) { computeDrawPosIfChanged(); drawRect(rectX1, rectSnY1, rectX2, rectSnY2, ZTS.toggleSneak?colorPack(0,0,196,196):colorPack(196,196,196,64)); drawString(mc.fontRendererObj, sneakTxt, rectX1 + 2, rectSnY1 + 2, MIM.sneak?colorPack(255,255,0,96):colorPack(64,64,64,128)); drawRect(rectX1, rectSpY1, rectX2, rectSpY2, ZTS.toggleSprint?colorPack(0,0,196,196):colorPack(196,196,196,64)); drawString(mc.fontRendererObj, sprintTxt, rectX1 + 2, rectSpY1 + 2, MIM.sprint?colorPack(255,255,0,96):colorPack(64,64,64,128)); } else if (ZTS.displayStatus() == 2) { // no optimization here - I don't like the text only display anyway computeTextPos(onlyTxt = MIM.displayText()); drawString(mc.fontRendererObj, onlyTxt, rectX1, rectSnY1, colorPack(255,255,255,192)); } }
@SubscribeEvent(priority = EventPriority.NORMAL) public void onRenderMountHealth(RenderGameOverlayEvent event) { if (event.type == ElementType.EXPERIENCE || event.type == ElementType.FOOD || event.type == ElementType.JUMPBAR ) { YesOrNo = true; } if (!event.isCancelable() || !YesOrNo)return; if(this.mc.thePlayer.ridingEntity != null) { GuiIngameForge.renderFood = true; } if(GuiIngameForge.renderExperiance) { if(this.mc.thePlayer.ridingEntity instanceof EntityHorse) { GuiIngameForge.renderJumpBar = Keyboard.isKeyDown(Keyboard.KEY_SPACE); } } }
@SubscribeEvent public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre e) { Minecraft mc = Minecraft.getMinecraft(); if (mc.thePlayer != null) { if (e.type == ElementType.CROSSHAIRS) { if (mc.thePlayer.getHeldItem() != null) { ItemStack held = mc.thePlayer.getHeldItem(); if (held.getItem() == FarragoMod.RIFLE) { RifleRenderer.renderCrosshairs(mc, held, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight()); RifleRenderer.renderHotbar(mc, held, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight()); e.setCanceled(true); } } } else if (e.type == ElementType.HOTBAR) { if (mc.thePlayer.inventory.armorInventory[1] != null) { ItemStack legs = mc.thePlayer.inventory.armorInventory[1]; if (legs.getItem() == FarragoMod.UTILITY_BELT) { UtilityBeltRenderer.render(mc, legs, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight()); e.setCanceled(true); } } } } }
@Override public void render(int x, int y, ScaledResolution resolution, ElementType type) { Location location = PlayerHelper.getLookingAt(); String tile = ""; String blockName = ""; if (!(location.getBlock() instanceof IDebugInfo)) { if (location.getTile() != null) tile = "\\" + "tile"; blockName = Block.blockRegistry.getNameForObject(location.getBlock()) + ":" + location.getMetadata() + tile; this.font.drawStringWithShadow("Looking At: " + blockName, x, y, 0xFFFFFF); } else { IDebugInfo info = (IDebugInfo)location.getBlock(); List<String> lines = new ArrayList<String>(); info.getInformation(Minecraft.getMinecraft().theWorld, location.getX(), location.getY(), location.getZ(), lines); int lastX = 0; for (String line : lines) { this.font.drawStringWithShadow(line, lastX, y, 0xFFFFFF); lastX += font.FONT_HEIGHT; } } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent event) { if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { return; } if (!this.mc.inGameHasFocus) { return; } if (FMLClientHandler.instance().getClient().currentScreen != null ) { return; } drawMetalOverlay(); }
@SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { if (event.type == ElementType.ALL) { if (overlayFramebuffer == null) { overlayFramebuffer = new GXFramebuffer(128, 128); } if (gx == null) { return; } overlayFramebuffer.bind(); gx.render((int)(128), (int)(128)); overlayFramebuffer.unbind(); GL11.glEnable(GL11.GL_TEXTURE_2D); overlayFramebuffer.bindTexture(); RenderUtils.setColor(255, 255, 255); RenderUtils.texturedRectangle(0, 0, 128, 128, 0F, 1F, 1F, 0F); overlayFramebuffer.unbindTexture(); } }
@SubscribeEvent public void renderFramebuffersOverlay(RenderGameOverlayEvent.Post event) { if (event.type != ElementType.ALL) return; //cleanse monitor list Iterator<WeakReference<ComponentMonitor>> iter = monitors.iterator(); while (iter.hasNext()) { WeakReference<ComponentMonitor> w = iter.next(); if (w.get() == null) { iter.remove(); } else { ComponentMonitor ex = (ComponentMonitor) w.get(); if (ex.fb != null && ex.owner != null) { ex.fb.bind(); ex.owner.gx.render(ex.width, ex.height); ex.fb.unbind(); } } } }
@SubscribeEvent public void onRenderOfOverlay(RenderGameOverlayEvent event) { // Check the event is not cancellable if (event.isCancelable()) { return; } // Check it's not for experience if (event.type != ElementType.EXPERIENCE) { return; } // Check if hud enabled if (!RadioUtils.inProgress) { return; } // Otherwise, proceed to render icon ScaledResolution screenResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); int height = screenResolution.getScaledHeight(); height = height - mc.fontRendererObj.FONT_HEIGHT; mc.fontRendererObj.drawString(statusIndicator, 1, height, 0xFFFFFF); }
@SubscribeEvent public void hideHealth(RenderGameOverlayEvent event) { if(mc.thePlayer.getActivePotionEffect(ModPotions.lessening) != null && event.type.equals(ElementType.HEALTH) && event.isCancelable()) { event.setCanceled(true); mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID, "/textures/gui/icons.png")); GL11.glPushMatrix(); for (int i = 0; i < Math.round(mc.thePlayer.getMaxHealth()/2); i++) { drawTexturedModalRect((int) (mc.displayWidth/6.5+(i*9)), mc.displayHeight/2-38, 0, 0, 9, 9); } for (int i = 0; i < Math.round(mc.thePlayer.getHealth()/2); i++) { drawTexturedModalRect((int) (mc.displayWidth/6.5+(i*9)), mc.displayHeight/2-38, 9, 0, 9, 9); } GL11.glPopMatrix(); mc.getTextureManager().bindTexture(new ResourceLocation("minecraft:textures/gui/icons.png")); } }
@ForgeSubscribe public void drawOverlay(final RenderGameOverlayEvent.Post event) { if (!Loader.isModLoaded("tukmc_Vz")) { if (event.type == ElementType.FOOD) { final Minecraft client = Minecraft.getMinecraft(); client.renderEngine.bindTexture(texture); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); final int bars = (int) (9 * HungerSystem.getPercentage(client.thePlayer)); // int bars = 4; for (int x = bars; x > 0; x--) { drawTexturedModalRect(event.resolution.getScaledWidth() / 2 + width + -x * 8 + 9 * width, event.resolution.getScaledHeight() - 39, u, v, width, height); } client.renderEngine.bindTexture(HungerOverlay.icons); } } }
@SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.EXPERIENCE) return; else { ScaledResolution sr = event.getResolution(); EntityPlayer player = mc.player; if (!player.capabilities.isCreativeMode) { Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null); if (statsCap != null) { if (statsCap.getMaxMana() != 0) { double manaBarWidth = (double) statsCap.getMana() / statsCap.getMaxMana() * 81.0; int xPos = sr.getScaledWidth() / 2 + 10; int yPos = sr.getScaledHeight() - 38; mc.renderEngine.bindTexture(location); //if (capMana.getMana() != capMana.getMaxMana()) //{ this.drawTexturedModalRect(xPos, yPos, 0, 18, 81, 6); this.drawTexturedModalRect(xPos, yPos, 0, 24, (int) manaBarWidth, 5); //} } } } } }
@SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent.Pre event) { if (event.getType() == ElementType.HEALTH) { event.setCanceled(true); } /* * Repositions other Gui elements. */ if (event.getType() == ElementType.ARMOR) { GuiIngameForge.left_height = 49; } if (event.getType() == ElementType.FOOD) { GuiIngameForge.right_height = 49; } if (event.getType() == ElementType.AIR) { GuiIngameForge.right_height = 59; } }
@SideOnly(Side.CLIENT) @SubscribeEvent public void onRenderOverlayPostEvent(RenderGameOverlayEvent.Post event) { if (event.getType() == ElementType.ALL) { Minecraft minecraft = Minecraft.getMinecraft(); EntityPlayer player = minecraft.player; if (player.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof IInfernalPowerItem) { int maxPower = player.getHeldItem(EnumHand.OFF_HAND).getMaxDamage(); int power = maxPower - player.getHeldItem(EnumHand.OFF_HAND).getItemDamage(); int width = event.getResolution().getScaledWidth(); int height = event.getResolution().getScaledHeight(); GuiIngame gui = Minecraft.getMinecraft().ingameGUI; Minecraft.getMinecraft().getTextureManager().bindTexture(HUD_TEXTURE); GlStateManager.enableBlend(); int y = (height / 2) - (42 / 2); int x = 3; int barHeight = (int) (((float) power / (float) maxPower) * 32); gui.drawTexturedModalRect(x, y, 0, 0, 10, 42); gui.drawTexturedModalRect(x + 1, y + 5 + (32 - barHeight), 10, 5, 8, barHeight); Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.ICONS); GlStateManager.disableBlend(); } } }
@SubscribeEvent public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) { Minecraft mc = Minecraft.getMinecraft(); if (event.getType() == ElementType.ALL) { EntityPlayer player = net.minecraft.client.Minecraft.getMinecraft().player; // a chance to do great things in the realm of huds } }
@SubscribeEvent public void renderOverlayPost(RenderGameOverlayEvent.Post event) { if (event.getType() == ElementType.HOTBAR) { ItemWeapon.inHand = true; } }
@SubscribeEvent public void showProgressUpdate(RenderGameOverlayEvent.Post event) { if (quest == null || Minecraft.getSystemTime() - activationTime > TTL) { quest = null; return; } if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { return; } ScaledResolution viewport = new ScaledResolution(mc); new GuiDailyBadge(quest, mc, viewport.getScaledWidth() - 122, (viewport.getScaledHeight() / 4)); }
private boolean replaceEvent(ElementType el) { if (eventParent.type == el && eventParent.isCanceled()) { eventParent.setCanceled(false); eventParent.setResult(Event.Result.ALLOW); pre(el); return true; } return false; }
@SubscribeEvent public void renderHud(Post event) { ScaledResolution resolution = event.getResolution(); int width = resolution.getScaledWidth(); int height = resolution.getScaledHeight(); EntityPlayer player = Minecraft.getMinecraft().player; ItemStack stack = BaublesSupport.getItem(player, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO); if (stack == null || stack.isEmpty()) return; if (event.getType() == ElementType.EXPERIENCE) { HUD_TEXTURE.bind(); GlStateManager.pushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F); int right = ((width / 2) - (100 / 2)) + 145; int top = height - 17; emptyManaBar.draw(ClientTickHandler.getTicks(), right, top); emptyBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6); GlStateManager.popMatrix(); CapManager manager = new CapManager(player); GlStateManager.pushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F); int visualManaLength = 0; if (manager.getMana() > 0) visualManaLength = (int) (((manager.getMana() * 100) / manager.getMaxMana()) % 101); fullManaBar.drawClipped(ClientTickHandler.getTicks(), right, top, visualManaLength, 5); GlStateManager.color(1.0F, 1.0F, 1.0F); int visualBurnoutLength = 0; if (manager.getBurnout() > 0) visualBurnoutLength = (int) (((manager.getBurnout() * 100) / manager.getMaxBurnout()) % 101); fullBurnoutBar.drawClipped(ClientTickHandler.getTicks(), right, top + 6, visualBurnoutLength, 5); GlStateManager.popMatrix(); } }
@CoreEvent public void onDraw(final @Nonnull RenderGameOverlayEvent.Post event) { if (event.type==ElementType.EXPERIENCE) if (CurrentMode.instance.isMode()) if ((int) (System.currentTimeMillis()/500)%2==0) { final FontRenderer fontrenderer = font(); WRenderer.startTexture(); OpenGL.glPushMatrix(); OpenGL.glTranslatef(5f, 5f, 0f); OpenGL.glScalef(2f, 2f, 1f); OpenGL.glPushMatrix(); OpenGL.glScalef(fontrenderer.FONT_HEIGHT, fontrenderer.FONT_HEIGHT, 1f); OpenGL.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); texture().bindTexture(resSign); WRenderer.startTexture(); RenderHelper.drawRectTexture(GL_QUADS); OpenGL.glPopMatrix(); OpenGL.glTranslatef(fontrenderer.FONT_HEIGHT, 0f, 0f); final String str = I18n.format(CurrentMode.instance.getMode().message); fontrenderer.drawStringWithShadow(str, 0, 0, 0xffffff); OpenGL.glPopMatrix(); } }
@CoreEvent public void onDraw(final @Nonnull RenderGameOverlayEvent.Post event) { if (event.resolution==null) return; if (event.type==ElementType.CHAT&&Client.mc.currentScreen==null) if (!isDelegated()) { setWidth(event.resolution.getScaledWidth()); setHeight(event.resolution.getScaledHeight()); drawScreen(event.mouseX, event.mouseY, event.partialTicks); } }
private void renderItems(RenderGameOverlayEvent event) { if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; ItemStack item = player.inventory.getCurrentItem(); if (item == null) return; if (item.getItem() instanceof ItemBinoculars) renderBinoculars(item, event, player); } }
@SubscribeEvent public void onPostRenderOverlay(RenderGameOverlayEvent.Pre event) { if (event.getType() != ElementType.HOTBAR) { return; } ScaledResolution resolution = event.getResolution(); if (hud == null) { hud = new CivilizationOverlayHandler(Minecraft.getMinecraft()); } hud.render(resolution.getScaledWidth(), resolution.getScaledHeight()); }
@SubscribeEvent public void onRenderGui(RenderGameOverlayEvent event) { if (event.isCancelable() || event.getType() != ElementType.TEXT) { return; } PlayerAether player = PlayerAether.get(this.mc.thePlayer); if (player.poisonInstance() != null) { AetherOverlay.renderCure(this.mc); AetherOverlay.renderPoison(this.mc); } if (player.thePlayer != null) { AetherOverlay.renderIronBubble(this.mc); AetherOverlay.renderCooldown(this.mc); AetherOverlay.renderJumps(this.mc); AetherOverlay.renderBossHP(this.mc); } float portalTime = player.portalAnimTime * 1.2F + (player.prevPortalAnimTime - player.portalAnimTime); if(portalTime > 0.0F) { if (portalTime > 0.0F) { AetherOverlay.renderAetherPortal(portalTime, new ScaledResolution(this.mc)); } } }
/** Override vanilla subtitles with this module's subtitles. */ @SubscribeEvent public static void guiOverlay(RenderGameOverlayEvent event) { if (event.getType() == ElementType.SUBTITLES) { event.setCanceled(true); guiSubtitles.renderSubtitles(event.getResolution()); } }
@SubscribeEvent public void onRenderGui(RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.EXPERIENCE) return; new GUIToolDurability(Minecraft.getMinecraft()); new GUILookAt(Minecraft.getMinecraft()); //new GUIArmorDurability(Minecraft.getMinecraft()); }
@Override public void doRender(@Nonnull final RenderGameOverlayEvent.Pre event) { if (event.getType() == ElementType.TEXT && this.textPanel.hasText()) { final int centerX = event.getResolution().getScaledWidth() / 2; final int centerY = 80; this.textPanel.render(centerX, centerY, Reference.TOP_CENTER); } }
@SubscribeEvent(priority=EventPriority.NORMAL) public void onRenderExperienceBar(RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.EXPERIENCE) { return; } CapabilityMana.IMana props = mc.player.getCapability(CapabilityMana.MANA, null); if (props == null || props.getMaxMana() == 0) { return; } int xPos = 2; int yPos = 2; this.mc.getTextureManager().bindTexture(texture); // Add this block of code before you draw the section of your texture containing transparency GlStateManager.pushAttrib(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); // alpha test and blend needed due to vanilla or Forge rendering bug GlStateManager.enableAlpha(); GlStateManager.enableBlend(); // Here we draw the background bar which contains a transparent section; note the new size drawTexturedModalRect(xPos, yPos, 0, 0, 56, 9); // You can keep drawing without changing anything int manabarwidth = (int)(((float) props.getMana() / props.getMaxMana()) * 49); drawTexturedModalRect(xPos + 3, yPos + 3, 0, 9, manabarwidth, 3); String s = Utils.translateToLocal("gui.manaBar.mana") + " " + props.getMana() + "/" + props.getMaxMana(); yPos += 10; this.mc.fontRenderer.drawString(s, xPos + 1, yPos, 0); this.mc.fontRenderer.drawString(s, xPos - 1, yPos, 0); this.mc.fontRenderer.drawString(s, xPos, yPos + 1, 0); this.mc.fontRenderer.drawString(s, xPos, yPos - 1, 0); this.mc.fontRenderer.drawString(s, xPos, yPos, 8453920); GlStateManager.popAttrib(); }
@SubscribeEvent public void displayEntityStatus(RenderGameOverlayEvent.Pre event) { if (event.getType() != ElementType.CHAT) { return; } ToroHealthMod.proxy.setEntityInCrosshairs(); }
@SubscribeEvent public void drawHealthBar(RenderGameOverlayEvent.Pre event) { if (!showHealthBar || event.getType() != ElementType.CHAT) { return; } updateGuiAge(); updatePositions(); drawSkin(); draw(); }
@SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == ElementType.TEXT && showTextureMap) { GlStateManager.color(1, 1, 1); mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Render.drawTexturedRect(textMapX, textMapY, textMapW, textMapH); ScaledResolution res = event.getResolution(); drawString(TOOLTIP, res, 0xFFFFFF); } }
@SubscribeEvent(priority = EventPriority.NORMAL) public void onRenderOverlay(RenderGameOverlayEvent.Pre event) { if (event.getType() == ElementType.HELMET && Minecraft.getMinecraft().currentScreen instanceof GuiCamera) { event.setCanceled(true); } else if (event.getType() == ElementType.TEXT && profile) { displayDebugInfo(); } if (i > 0) i--; }
@SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.BOTTOM) public static void renderBar(RenderGameOverlayEvent.Pre event) { if (SingleProjection.isProjectionState()) { markEventCanceled(event); HUDManager.setupOverlayRendering(); } else if (event.getType() == ElementType.ALL) HUDManager.render(); }