Ejemplo n.º 1
0
  /**
   * Renders the duration any potion effects that the player currently has on the left side of the
   * screen.
   */
  public static void RenderOntoHUD() {
    // if the player is in the world
    // and not in a menu (except for chat and the custom Options menu)
    // and F3 not shown
    if (PotionTimers.Enabled && mc.inGameHasFocus
        || (mc.currentScreen != null
                && (mc.currentScreen instanceof GuiChat || TabIsSelectedInOptionsGui()))
            && !mc.gameSettings.showDebugInfo) {
      Collection potionEffects =
          mc.thePlayer.getActivePotionEffects(); // key:potionId, value:potionEffect
      Iterator it = potionEffects.iterator();

      int x = potionLocX;
      int y = potionLocY;

      x /= PotionScale;
      y /= PotionScale;
      GL11.glScalef(PotionScale, PotionScale, PotionScale);

      int i = 0;
      while (it.hasNext()) {
        PotionEffect potionEffect = (PotionEffect) it.next();
        Potion potion = Potion.potionTypes[potionEffect.getPotionID()];
        Boolean isFromBeacon = potionEffect.getIsAmbient(); // Minecraft bug: this is always false

        if (!isFromBeacon) // ignore effects from Beacons (Minecraft bug: isFromBeacon is always
        // false)
        {
          if (ShowPotionIcons) {
            DrawPotionIcon(x, y, potion);
            DrawPotionDuration(x + 10, y, potion, potionEffect);
          } else DrawPotionDuration(x, y, potion, potionEffect);

          y += 10;
          i++;
        }
      }

      GL11.glScalef(1f / PotionScale, 1f / PotionScale, 1f / PotionScale);
    }
  }