public void renderBossHealth() { if (!this.mapBossInfos.isEmpty()) { ScaledResolution scaledresolution = new ScaledResolution(this.client); int i = scaledresolution.getScaledWidth(); int j = 12; for (BossInfoLerping bossinfolerping : this.mapBossInfos.values()) { int k = i / 2 - 91; GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.client.getTextureManager().bindTexture(GUI_BARS_TEXTURES); this.render(k, j, bossinfolerping); String s = bossinfolerping.getName().getFormattedText(); this.client.fontRendererObj.drawStringWithShadow(s, (float)(i / 2 - this.client.fontRendererObj.getStringWidth(s) / 2), (float)(j - 9), 16777215); j += 10 + this.client.fontRendererObj.FONT_HEIGHT; if (j >= scaledresolution.getScaledHeight() / 3) { break; } } } }
public void read(SPacketUpdateBossInfo packetIn) { if (packetIn.getOperation() == SPacketUpdateBossInfo.Operation.ADD) { this.mapBossInfos.put(packetIn.getUniqueId(), new BossInfoLerping(packetIn)); } else if (packetIn.getOperation() == SPacketUpdateBossInfo.Operation.REMOVE) { this.mapBossInfos.remove(packetIn.getUniqueId()); } else { ((BossInfoLerping)this.mapBossInfos.get(packetIn.getUniqueId())).updateFromPacket(packetIn); } }
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoLerping bossInfo, int x, int y, int increment) { RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO, bossInfo, x, y, increment); MinecraftForge.EVENT_BUS.post(evt); return evt; }
public BossInfo(RenderGameOverlayEvent parent, ElementType type, BossInfoLerping bossInfo, int x, int y, int increment) { super(parent, type); this.bossInfo = bossInfo; this.x = x; this.y = y; this.increment = increment; }
public void renderBossHealth() { if (!this.mapBossInfos.isEmpty()) { ScaledResolution scaledresolution = new ScaledResolution(this.client); int i = scaledresolution.getScaledWidth(); int j = 12; for (BossInfoLerping bossinfolerping : this.mapBossInfos.values()) { int k = i / 2 - 91; net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event = net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(scaledresolution, bossinfolerping, k, j, 10 + this.client.fontRendererObj.FONT_HEIGHT); if (!event.isCanceled()) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.client.getTextureManager().bindTexture(GUI_BARS_TEXTURES); this.render(k, j, bossinfolerping); String s = bossinfolerping.getName().getFormattedText(); this.client.fontRendererObj.drawStringWithShadow(s, (float)(i / 2 - this.client.fontRendererObj.getStringWidth(s) / 2), (float)(j - 9), 16777215); } j += event.getIncrement(); net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(scaledresolution); if (j >= scaledresolution.getScaledHeight() / 3) { break; } } } }
/** * @return The {@link BossInfoLerping} currently being rendered */ public BossInfoLerping getBossInfo() { return bossInfo; }