private void render(int x, int y, BossInfo info) { this.drawTexturedModalRect(x, y, 0, info.getColor().ordinal() * 5 * 2, 182, 5); if (info.getOverlay() != BossInfo.Overlay.PROGRESS) { this.drawTexturedModalRect(x, y, 0, 80 + (info.getOverlay().ordinal() - 1) * 5 * 2, 182, 5); } int i = (int)(info.getPercent() * 183.0F); if (i > 0) { this.drawTexturedModalRect(x, y, 0, info.getColor().ordinal() * 5 * 2 + 5, i, 5); if (info.getOverlay() != BossInfo.Overlay.PROGRESS) { this.drawTexturedModalRect(x, y, 0, 80 + (info.getOverlay().ordinal() - 1) * 5 * 2 + 5, i, 5); } } }
public SPacketUpdateBossInfo(SPacketUpdateBossInfo.Operation operationIn, BossInfo data) { this.operation = operationIn; this.uniqueId = data.getUniqueId(); this.name = data.getName(); this.percent = data.getPercent(); this.color = data.getColor(); this.overlay = data.getOverlay(); this.darkenSky = data.shouldDarkenSky(); this.playEndBossMusic = data.shouldPlayEndBossMusic(); this.createFog = data.shouldCreateFog(); }
/** * Reads the raw packet data from the data stream. */ public void readPacketData(PacketBuffer buf) throws IOException { this.uniqueId = buf.readUuid(); this.operation = (SPacketUpdateBossInfo.Operation)buf.readEnumValue(SPacketUpdateBossInfo.Operation.class); switch (this.operation) { case ADD: this.name = buf.readTextComponent(); this.percent = buf.readFloat(); this.color = (BossInfo.Color)buf.readEnumValue(BossInfo.Color.class); this.overlay = (BossInfo.Overlay)buf.readEnumValue(BossInfo.Overlay.class); this.setFlags(buf.readUnsignedByte()); case REMOVE: default: break; case UPDATE_PCT: this.percent = buf.readFloat(); break; case UPDATE_NAME: this.name = buf.readTextComponent(); break; case UPDATE_STYLE: this.color = (BossInfo.Color)buf.readEnumValue(BossInfo.Color.class); this.overlay = (BossInfo.Overlay)buf.readEnumValue(BossInfo.Overlay.class); break; case UPDATE_PROPERTIES: this.setFlags(buf.readUnsignedByte()); } }
public boolean shouldPlayEndBossMusic() { if (!this.mapBossInfos.isEmpty()) { for (BossInfo bossinfo : this.mapBossInfos.values()) { if (bossinfo.shouldPlayEndBossMusic()) { return true; } } } return false; }
public boolean shouldDarkenSky() { if (!this.mapBossInfos.isEmpty()) { for (BossInfo bossinfo : this.mapBossInfos.values()) { if (bossinfo.shouldDarkenSky()) { return true; } } } return false; }
public boolean shouldCreateFog() { if (!this.mapBossInfos.isEmpty()) { for (BossInfo bossinfo : this.mapBossInfos.values()) { if (bossinfo.shouldCreateFog()) { return true; } } } return false; }
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; } } } }
public BossInfo.Color getColor() { return this.color; }
public BossInfo.Overlay getOverlay() { return this.overlay; }
@SideOnly(Side.CLIENT) public BossInfo.Color getColor() { return this.color; }
@SideOnly(Side.CLIENT) public BossInfo.Overlay getOverlay() { return this.overlay; }