Пример #1
0
  /** Renders dragon's (boss) health on the HUD */
  private void renderBossHealth() {
    if (RenderDragon.entityDragon != null) {
      EntityDragon var1 = RenderDragon.entityDragon;
      RenderDragon.entityDragon = null;
      FontRenderer var2 = this.mc.fontRenderer;
      ScaledResolution var3 =
          new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
      int var4 = var3.getScaledWidth();
      short var5 = 182;
      int var6 = var4 / 2 - var5 / 2;
      int var7 =
          (int) ((float) var1.getDragonHealth() / (float) var1.getMaxHealth() * (float) (var5 + 1));
      byte var8 = 12;
      this.drawTexturedModalRect(var6, var8, 0, 74, var5, 5);
      this.drawTexturedModalRect(var6, var8, 0, 74, var5, 5);

      if (var7 > 0) {
        this.drawTexturedModalRect(var6, var8, 0, 79, var7, 5);
      }

      String var9 = "Boss health";
      var2.drawStringWithShadow(
          var9, var4 / 2 - var2.getStringWidth(var9) / 2, var8 - 10, 16711935);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
    }
  }
Пример #2
0
 private void renderBossHealth() {
   if (RenderDragon.field_41038_a == null) {
     return;
   }
   EntityDragon entitydragon = RenderDragon.field_41038_a;
   RenderDragon.field_41038_a = null;
   FontRenderer fontrenderer = mc.fontRenderer;
   ScaledResolution scaledresolution =
       new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
   int i = scaledresolution.getScaledWidth();
   char c = '\266';
   int j = i / 2 - c / 2;
   int k =
       (int)
           (((float) entitydragon.func_41010_ax() / (float) entitydragon.getMaxHealth())
               * (float) (c + 1));
   byte byte0 = 12;
   drawTexturedModalRect(j, byte0, 0, 74, c, 5);
   drawTexturedModalRect(j, byte0, 0, 74, c, 5);
   if (k > 0) {
     drawTexturedModalRect(j, byte0, 0, 79, k, 5);
   }
   String s = "Boss health";
   fontrenderer.drawStringWithShadow(
       s, i / 2 - fontrenderer.getStringWidth(s) / 2, byte0 - 10, 0xff00ff);
   GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
   GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/icons.png"));
 }