Esempio n. 1
0
  public static void drawMultilineTip(int x, int y, List<String> list) {
    if (list.isEmpty()) return;

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    RenderHelper.disableStandardItemLighting();

    int w = 0;
    int h = -2;
    for (int i = 0; i < list.size(); i++) {
      String s = list.get(i);
      ITooltipLineHandler line = getTipLine(s);
      Dimension d =
          line != null
              ? line.getSize()
              : new Dimension(
                  getStringWidth(s),
                  list.get(i).endsWith(TOOLTIP_LINESPACE) && i + 1 < list.size() ? 12 : 10);
      w = Math.max(w, d.width);
      h += d.height;
    }

    if (x < 8) x = 8;
    else if (x > displaySize().width - w - 8) x -= 24 + w; // flip side of cursor
    y = (int) MathHelper.clip(y, 8, displaySize().height - 8 - h);

    gui.incZLevel(300);
    drawTooltipBox(x - 4, y - 4, w + 7, h + 7);
    for (String s : list) {
      ITooltipLineHandler line = getTipLine(s);
      if (line != null) {
        line.draw(x, y);
        y += line.getSize().height;
      } else {
        fontRenderer.drawStringWithShadow(s, x, y, -1);
        y += s.endsWith(TOOLTIP_LINESPACE) ? 12 : 10;
      }
    }

    tipLineHandlers.clear();
    gui.incZLevel(-300);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();
  }
Esempio n. 2
0
 public static void drawTexturedModalRect(int x, int y, int tx, int ty, int w, int h) {
   gui.drawTexturedModalRect(x, y, tx, ty, w, h);
 }
Esempio n. 3
0
 public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) {
   gui.drawGradientRect(x, y, x + w, y + h, colour1, colour2);
 }