/**
  * Utility method: splits the string in different lines so it will fit on the page.
  *
  * @param fontRendererObj the font renderer to check against.
  * @param input the line to split up.
  * @param maxWidth the maximum allowable width of the line before being wrapped.
  * @param scale the scale of the text to the width.
  * @return the string split up into lines by the '\n' character.
  */
 public static String splitInLines(
     FontRenderer fontRendererObj, String input, float maxWidth, float scale) {
   maxWidth = maxWidth / scale;
   String notProcessed = input;
   String output = "";
   while (fontRendererObj.getStringWidth(notProcessed) > maxWidth) {
     int index = 0;
     if (notProcessed != null && !notProcessed.equals("")) {
       // find the first index at which the string exceeds the size limit
       while (notProcessed.length() - 1 > index
           && fontRendererObj.getStringWidth(notProcessed.substring(0, index)) < maxWidth) {
         index = (index + 1) < notProcessed.length() ? index + 1 : index;
       }
       // go back to the first space to cut the string in two lines
       while (index > 0 && notProcessed.charAt(index) != ' ') {
         index--;
       }
       // update the data for the next iteration
       output = output.equals("") ? output : output + '\n';
       output = output + notProcessed.substring(0, index);
       notProcessed =
           notProcessed.length() > index + 1 ? notProcessed.substring(index + 1) : notProcessed;
     }
   }
   return output + '\n' + notProcessed;
 }
  @SubscribeEvent
  public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
    if (event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) {
      boolean up = !Config.dialBottom;
      int xpos = 4;
      int ypos = up ? 50 : event.resolution.getScaledHeight() - 70;

      ItemStack item = ClientHelper.clientPlayer().getCurrentEquippedItem();
      if (item != null && item.getItem() instanceof ItemWandCasting) {
        ItemWandCasting wand = (ItemWandCasting) item.getItem();
        wand.getFocusItem(item);
        ItemFocusBasic focus = wand.getFocus(item);

        if (focus != null && focus instanceof ItemFocusDislocation) {
          ItemStack pickedBlock = ((ItemFocusDislocation) focus).getPickedBlock(item);
          if (pickedBlock != null) {
            Gui.drawRect(xpos - 1, ypos - 1, xpos + 18, ypos + 18, 0x66000000);

            FontRenderer font = ClientHelper.fontRenderer();
            boolean unicode = font.getUnicodeFlag();
            font.setUnicodeFlag(true);
            String name = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltip");
            int strLength = font.getStringWidth(name);

            Gui.drawRect(xpos + 18, ypos, xpos + 18 + strLength + 4, ypos + 9, 0x66000000);
            font.drawStringWithShadow(name, xpos + 20, ypos, 0xFFAA00);

            NBTTagCompound cmp = ((ItemFocusDislocation) focus).getStackTileEntity(item);
            if (cmp != null && !cmp.hasNoTags()) {
              String content =
                  StatCollector.translateToLocal("ttmisc.focusDislocation.tooltipExtra");
              font.getStringWidth(content);

              Gui.drawRect(xpos + 18, ypos + 9, xpos + 18 + strLength + 4, ypos + 18, 0x66000000);
              font.drawStringWithShadow(content, xpos + 20, ypos + 9, 0xFFAA00);
            }

            if (new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a).getItem() != null)
              renderItem.renderItemIntoGUI(
                  font,
                  ClientHelper.minecraft().renderEngine,
                  new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a),
                  xpos,
                  ypos);
            else {
              if (((ItemBlock) pickedBlock.getItem()).field_150939_a == Blocks.reeds)
                renderItem.renderItemIntoGUI(
                    font,
                    ClientHelper.minecraft().renderEngine,
                    new ItemStack(Items.reeds),
                    xpos,
                    ypos);
            }
            font.setUnicodeFlag(unicode);
          }
        }
      }
    }
  }
Example #3
0
  /** Renders an entity's name above its head */
  protected void renderLivingLabel(
      T entityIn, String str, double x, double y, double z, int maxDistance) {
    double d0 = entityIn.getDistanceSqToEntity(this.renderManager.livingPlayer);

    if (d0 <= (double) (maxDistance * maxDistance)) {
      FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
      float f = 1.6F;
      float f1 = 0.016666668F * f;
      GlStateManager.pushMatrix();
      GlStateManager.translate((float) x + 0.0F, (float) y + entityIn.height + 0.5F, (float) z);
      GL11.glNormal3f(0.0F, 1.0F, 0.0F);
      GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
      GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
      GlStateManager.scale(-f1, -f1, f1);
      GlStateManager.disableLighting();
      GlStateManager.depthMask(false);
      GlStateManager.disableDepth();
      GlStateManager.enableBlend();
      GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
      Tessellator tessellator = Tessellator.getInstance();
      WorldRenderer worldrenderer = tessellator.getWorldRenderer();
      int i = 0;

      if (str.equals("deadmau5")) {
        i = -10;
      }

      int j = fontrenderer.getStringWidth(str) / 2;
      GlStateManager.disableTexture2D();
      worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
      worldrenderer
          .pos((double) (-j - 1), (double) (-1 + i), 0.0D)
          .color(0.0F, 0.0F, 0.0F, 0.25F)
          .endVertex();
      worldrenderer
          .pos((double) (-j - 1), (double) (8 + i), 0.0D)
          .color(0.0F, 0.0F, 0.0F, 0.25F)
          .endVertex();
      worldrenderer
          .pos((double) (j + 1), (double) (8 + i), 0.0D)
          .color(0.0F, 0.0F, 0.0F, 0.25F)
          .endVertex();
      worldrenderer
          .pos((double) (j + 1), (double) (-1 + i), 0.0D)
          .color(0.0F, 0.0F, 0.0F, 0.25F)
          .endVertex();
      tessellator.draw();
      GlStateManager.enableTexture2D();
      fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, 553648127);
      GlStateManager.enableDepth();
      GlStateManager.depthMask(true);
      fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, -1);
      GlStateManager.enableLighting();
      GlStateManager.disableBlend();
      GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
      GlStateManager.popMatrix();
    }
  }
Example #4
0
  protected void renderHUDText(int width, int height) {
    mc.mcProfiler.startSection("forgeHudText");
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
    ArrayList<String> listL = new ArrayList<String>();
    ArrayList<String> listR = new ArrayList<String>();

    if (mc.isDemo()) {
      long time = mc.theWorld.getTotalWorldTime();
      if (time >= 120500L) {
        listR.add(I18n.format("demo.demoExpired"));
      } else {
        listR.add(
            I18n.format(
                "demo.remainingTime", StringUtils.ticksToElapsedTime((int) (120500L - time))));
      }
    }

    if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG)) {
      listL.addAll(debugOverlay.getLeft());
      listR.addAll(debugOverlay.getRight());
      post(DEBUG);
    }

    RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, listL, listR);
    if (!MinecraftForge.EVENT_BUS.post(event)) {
      int top = 2;
      for (String msg : listL) {
        if (msg == null) continue;
        drawRect(
            1,
            top - 1,
            2 + fontrenderer.getStringWidth(msg) + 1,
            top + fontrenderer.FONT_HEIGHT - 1,
            -1873784752);
        fontrenderer.drawString(msg, 2, top, 14737632);
        top += fontrenderer.FONT_HEIGHT;
      }

      top = 2;
      for (String msg : listR) {
        if (msg == null) continue;
        int w = fontrenderer.getStringWidth(msg);
        int left = width - 2 - w;
        drawRect(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
        fontrenderer.drawString(msg, left, top, 14737632);
        top += fontrenderer.FONT_HEIGHT;
      }
    }

    mc.mcProfiler.endSection();
    post(TEXT);
  }
  @SideOnly(Side.CLIENT)
  private KnowledgeObject<?> getHoveredObject(
      FontRenderer fontRenderer, int mouseX, int mouseY, int x, int y) {
    if (!(mouseX >= x
        && mouseX <= x + CompendiumPageHandler.innerWidth
        && mouseY >= y
        && parsed.contains(linkColor))) return null;

    boolean origFont = fontRenderer.getUnicodeFlag();
    fontRenderer.setUnicodeFlag(true);

    List<String> list =
        fontRenderer.listFormattedStringToWidth(parsed, CompendiumPageHandler.innerWidth);

    if (mouseY <= y + list.size() * fontRenderer.FONT_HEIGHT) {
      boolean multiLine = false;
      int count = -1, index, prevIndex;
      String lineStr;

      for (int line = 0; line < list.size(); line++) {
        lineStr = list.get(line);
        prevIndex = -1;

        while ((index = lineStr.indexOf(linkColor, ++prevIndex)) != -1) {
          prevIndex = index;

          if (multiLine) multiLine = false;
          else ++count;

          int startX = x + fontRenderer.getStringWidth(lineStr.substring(0, prevIndex = index));

          if ((index = lineStr.indexOf(EnumChatFormatting.BLACK.toString(), index)) == -1) {
            index = lineStr.length();
            multiLine = true;
          }

          if (mouseY >= y + line * fontRenderer.FONT_HEIGHT
              && mouseY <= y + (line + 1) * fontRenderer.FONT_HEIGHT
              && mouseX >= startX
              && mouseX
                  <= startX + fontRenderer.getStringWidth(lineStr.substring(prevIndex, index))) {
            fontRenderer.setUnicodeFlag(origFont);
            return count < parsedObjects.size() ? parsedObjects.get(count) : null;
          }
        }
      }
    }

    fontRenderer.setUnicodeFlag(origFont);
    return null;
  }
Example #6
0
  @SubscribeEvent
  public void onRenderGameOverlayPost(Post event) {
    if (event.type == ElementType.ALL) {

      Minecraft mc = Minecraft.getMinecraft();
      FontRenderer fr = mc.fontRenderer;
      Profiler p = mc.mcProfiler;
      p.startSection("gimmetime-hud");

      switch (ConfigHandler.analog_digital) {
        case 0: // None
          break;
        case 1: // Analog
          p.startSection("clock");
          RenderUtil.drawClock(32, 34, 24);
          p.endSection();
          break;
        case 2: // Digital
          p.startSection("clock");
          drawString(TimeUtil.getTime(), 1, 1);
          p.endSection();
          break;
        case 3: // Both
          p.startSection("clock");
          RenderUtil.drawClock(32, 34, 24);
          drawString(TimeUtil.getTime(), 64, 1);
          p.endSection();
          break;
      }

      if (currentAlarm != null) {
        p.startSection("alarm");
        String title = currentAlarm.getTitle() + " - " + TimeUtil.getAlarmTimeString();
        drawString(
            title,
            (event.resolution.getScaledWidth() / 2) - (fr.getStringWidth(title) / 2),
            (event.resolution.getScaledHeight() / 2) - (fr.FONT_HEIGHT + 4));
        String closeHint =
            StatCollector.translateToLocalFormatted(
                "hud.alarmAlert.close",
                GameSettings.getKeyDisplayString(KeyHandler.INSTANCE.clock.getKeyCode()));
        drawString(
            closeHint,
            (event.resolution.getScaledWidth() / 2) - (fr.getStringWidth(closeHint) / 2),
            (event.resolution.getScaledHeight() / 2) + (fr.FONT_HEIGHT - 2));
        p.endSection();
      }

      p.endSection();
    }
  }
Example #7
0
 public void updateAndRender(float renderTickTime) {
   if (scale == null) {
     return;
   }
   ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
   final int height = 64;
   int guiTop = resolution.getScaledHeight() - height;
   int guiLeft = resolution.getScaledWidth();
   GlStateManager.pushMatrix();
   GlStateManager.translate(guiLeft, guiTop, 0f);
   GlStateManager.scale(scale.get(), scale.get(), 1f);
   GlStateManager.enableBlend();
   for (int i = messages.size() - 1; i >= 0; i--) {
     JoinLeaveMessage message = messages.get(i);
     message.timeLeft -= renderTickTime;
     int alpha = 255;
     if (message.timeLeft < visibleTime.get() / 5f) {
       alpha = (int) Math.max(11, (255f * (message.timeLeft / (visibleTime.get() / 5f))));
     }
     if (message.timeLeft <= 0) {
       messages.remove(i);
     }
     String formattedText = message.chatComponent.getFormattedText();
     fontRenderer.drawString(
         formattedText,
         -fontRenderer.getStringWidth(formattedText) - 16,
         message.y,
         16777215 | (alpha << 24),
         true);
   }
   GlStateManager.disableBlend();
   GlStateManager.popMatrix();
 }
 protected void drawAuxGraphics(int posX, int posY) {
   ItemHashMap<Integer> items = this.getItemCounts();
   ArrayList<ItemStack> li = new ArrayList(items.keySet());
   Collections.sort(li, new AlphabeticItemComparator());
   for (int i = recipeTextOffset; i < li.size(); i++) {
     ItemStack is = li.get(i);
     int num = items.get(is);
     String s0 = is.getDisplayName();
     String s = String.format(": x%d", num);
     FontRenderer fr =
         s0.contains(FontType.OBFUSCATED.id) ? FontType.OBFUSCATED.renderer : fontRendererObj;
     s0 = DelegateFontRenderer.stripFlags(s0);
     fr.drawString(
         s0,
         posX + descX + 3,
         posY + descY + (fr.FONT_HEIGHT + 2) * (i - recipeTextOffset),
         0xffffff);
     fontRendererObj.drawString(
         s,
         posX + descX + 3 + fr.getStringWidth(s0),
         posY + descY + (fr.FONT_HEIGHT + 2) * (i - recipeTextOffset),
         0xffffff);
     if (i - recipeTextOffset > 9) break;
   }
 }
Example #9
0
  protected void renderRecordOverlay(int width, int height, float partialTicks) {
    if (recordPlayingUpFor > 0) {
      mc.mcProfiler.startSection("overlayMessage");
      float hue = (float) recordPlayingUpFor - partialTicks;
      int opacity = (int) (hue * 256.0F / 20.0F);
      if (opacity > 255) opacity = 255;

      if (opacity > 0) {
        GlStateManager.pushMatrix();
        GlStateManager.translate((float) (width / 2), (float) (height - 68), 0.0F);
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
        int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
        fontrenderer.drawString(
            recordPlaying,
            -fontrenderer.getStringWidth(recordPlaying) / 2,
            -4,
            color | (opacity << 24));
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
      }

      mc.mcProfiler.endSection();
    }
  }
Example #10
0
 Text append(String text, TextFormat format, FontRenderer fontrenderer) {
   this.text += addFormat(text, format);
   float scale = format.size / (float) fontrenderer.FONT_HEIGHT;
   this.dimensions =
       new Vector2D(
           fontrenderer.getStringWidth(this.text) * scale, fontrenderer.FONT_HEIGHT * scale);
   return this;
 }
  @Override
  public int getStringWidth(String s) {
    if (s.indexOf("SPECIAL:") < 0) {
      return realRenderer.getStringWidth(s);
    }

    return 21;
  }
  private void drawCenteredString(
      FontRenderer fontRenderer, String string, int x, int y, int colour) {
    String fixedString = string.replaceAll("\\P{InBasic_Latin}", "");
    int fixedStringWidth = fontRenderer.getStringWidth(fixedString);
    int centeredX = x - fixedStringWidth / 2;

    fontRenderer.drawStringWithShadow(string, centeredX, y, colour);
  }
Example #13
0
  @SideOnly(Side.CLIENT)
  public static void renderText(int x, int y, int width, int height, String unlocalizedText) {
    FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
    boolean unicode = renderer.getUnicodeFlag();
    renderer.setUnicodeFlag(true);
    String text = StatCollector.translateToLocal(unlocalizedText).replaceAll("&", "\u00a7");
    String[] textEntries = text.split("<br>");

    String lastFormat = "";
    String pendingFormat = "";
    for (String s : textEntries) {
      List<String> wrappedLines = new ArrayList();
      String workingOn = "";

      int i = 0;
      String[] tokens = s.split(" ");
      for (String s1 : tokens) {
        boolean skipPending = false;
        String format = FontHelper.getFormatFromString(s1);

        if (!format.isEmpty() && s1.length() > 0 && s1.charAt(0) != '\u00a7') {
          skipPending = true;
          pendingFormat = format;
          format = "";
        }

        if (!pendingFormat.isEmpty() && !skipPending) {
          format = pendingFormat;
          pendingFormat = "";
        }

        if (MathHelper.stringNullOrLengthZero(format)) format = lastFormat;

        if (renderer.getStringWidth(workingOn + " " + s1) >= width) {
          wrappedLines.add(workingOn);
          workingOn = "";
        }
        workingOn = workingOn + format + " " + s1;

        if (i == tokens.length - 1) wrappedLines.add(workingOn);

        ++i;
        lastFormat = format;
      }

      for (String s1 : wrappedLines) {
        y += 10;
        renderer.drawString(s1, x, y, 0);
      }

      y += 10;
    }

    renderer.setUnicodeFlag(unicode);
  }
Example #14
0
  protected void renderToolHightlight(ScaledResolution res) {
    if (this.mc.gameSettings.heldItemTooltips && !this.mc.playerController.isSpectator()) {
      mc.mcProfiler.startSection("toolHighlight");

      if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null) {
        String name = this.highlightingItemStack.getDisplayName();
        if (this.highlightingItemStack.hasDisplayName()) name = EnumChatFormatting.ITALIC + name;

        name =
            this.highlightingItemStack.getItem().getHighlightTip(this.highlightingItemStack, name);

        int opacity = (int) ((float) this.remainingHighlightTicks * 256.0F / 10.0F);
        if (opacity > 255) opacity = 255;

        if (opacity > 0) {
          int y = res.getScaledHeight() - 59;
          if (!mc.playerController.shouldDrawHUD()) y += 14;

          GlStateManager.pushMatrix();
          GlStateManager.enableBlend();
          GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
          FontRenderer font =
              highlightingItemStack.getItem().getFontRenderer(highlightingItemStack);
          if (font != null) {
            int x = (res.getScaledWidth() - font.getStringWidth(name)) / 2;
            font.drawStringWithShadow(name, x, y, WHITE | (opacity << 24));
          } else {
            int x = (res.getScaledWidth() - fontrenderer.getStringWidth(name)) / 2;
            fontrenderer.drawStringWithShadow(name, x, y, WHITE | (opacity << 24));
          }
          GlStateManager.disableBlend();
          GlStateManager.popMatrix();
        }
      }

      mc.mcProfiler.endSection();
    } else if (this.mc.thePlayer.isSpectator()) {
      this.spectatorGui.func_175263_a(res);
    }
  }
 public static void renderLocalizedGuiName(
     FontRenderer fontRenderer, int xSize, String name, String append, int colour) {
   String unlocalizedName = "inventory." + LibModInfo.ID.toLowerCase() + ":" + name + ".name";
   String localizedName = StatCollector.translateToLocal(unlocalizedName);
   String renderText = unlocalizedName;
   if (!unlocalizedName.equals(localizedName)) {
     renderText = localizedName;
   }
   if (append != null) {
     renderText = renderText + " - " + append;
   }
   int xPos = xSize / 2 - fontRenderer.getStringWidth(renderText) / 2;
   fontRenderer.drawString(renderText, xPos, 6, colour);
 }
Example #16
0
  @Override
  public void render(float paramFloat) {
    Minecraft mc = Minecraft.getMinecraft();

    if (mc.currentScreen instanceof GuiAdvancedHUDConfiguration
        || mc.currentScreen instanceof GuiScreenReposition) {
      itemName = "TOOLTIP";
    }

    if (itemName != null && !itemName.isEmpty()) {
      FontRenderer fontrenderer = mc.fontRenderer;
      int posX = 0;
      if (Alignment.isLeft(alignment)) {
        posX = this.posX;
      } else if (Alignment.isHorizontalCenter(alignment)) {
        posX = this.posX + (getWidth() - fontrenderer.getStringWidth(itemName)) / 2;
      } else {
        posX = this.posX + getWidth() - fontrenderer.getStringWidth(itemName);
      }

      fontrenderer.drawStringWithShadow(itemRarityColorCode + itemName, posX, posY, stringColor);
    }
  }
  public void renderItemStack(
      FontRenderer par1FontRenderer,
      RenderEngine par2RenderEngine,
      ItemStack par3ItemStack,
      int par4,
      int par5,
      String par6Str) {
    if (par3ItemStack != null) {
      if (par3ItemStack.stackSize > 1 || par6Str != null) {
        String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        par1FontRenderer.drawStringWithShadow(
            s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
      }

      if (par3ItemStack.isItemDamaged()) {
        int k =
            (int)
                Math.round(
                    13.0D
                        - (double) par3ItemStack.getItemDamageForDisplay()
                            * 13.0D
                            / (double) par3ItemStack.getMaxDamage());
        int l =
            (int)
                Math.round(
                    255.0D
                        - (double) par3ItemStack.getItemDamageForDisplay()
                            * 255.0D
                            / (double) par3ItemStack.getMaxDamage());
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        Tessellator tessellator = Tessellator.instance;
        int i1 = 255 - l << 16 | l << 8;
        int j1 = (255 - l) / 4 << 16 | 16128;
        this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0);
        this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1);
        this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      }
    }
  }
Example #18
0
  @SideOnly(Side.CLIENT)
  public void renderManaBar(IGuiLexiconEntry gui, T recipe, int mx, int my) {
    FontRenderer font = Minecraft.getMinecraft().fontRenderer;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    int x = gui.getLeft() + gui.getWidth() / 2 - 50;
    int y = gui.getTop() + 120;

    boolean unicode = font.getUnicodeFlag();
    font.setUnicodeFlag(true);
    String stopStr = StatCollector.translateToLocal("botaniamisc.shiftToStopSpin");
    font.drawString(stopStr, x + 50 - font.getStringWidth(stopStr) / 2, y + 15, 0x99000000);
    font.setUnicodeFlag(unicode);

    GL11.glDisable(GL11.GL_BLEND);
  }
Example #19
0
  protected void renderExperience(int width, int height) {
    bind(icons);
    if (pre(EXPERIENCE)) return;
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.disableBlend();

    if (mc.playerController.gameIsSurvivalOrAdventure()) {
      mc.mcProfiler.startSection("expBar");
      int cap = this.mc.thePlayer.xpBarCap();
      int left = width / 2 - 91;

      if (cap > 0) {
        short barWidth = 182;
        int filled = (int) (mc.thePlayer.experience * (float) (barWidth + 1));
        int top = height - 32 + 3;
        drawTexturedModalRect(left, top, 0, 64, barWidth, 5);

        if (filled > 0) {
          drawTexturedModalRect(left, top, 0, 69, filled, 5);
        }
      }

      this.mc.mcProfiler.endSection();

      if (mc.playerController.gameIsSurvivalOrAdventure() && mc.thePlayer.experienceLevel > 0) {
        mc.mcProfiler.startSection("expLevel");
        boolean flag1 = false;
        int color = flag1 ? 16777215 : 8453920;
        String text = "" + mc.thePlayer.experienceLevel;
        int x = (width - fontrenderer.getStringWidth(text)) / 2;
        int y = height - 31 - 4;
        fontrenderer.drawString(text, x + 1, y, 0);
        fontrenderer.drawString(text, x - 1, y, 0);
        fontrenderer.drawString(text, x, y + 1, 0);
        fontrenderer.drawString(text, x, y - 1, 0);
        fontrenderer.drawString(text, x, y, color);
        mc.mcProfiler.endSection();
      }
    }
    GlStateManager.enableBlend();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

    post(EXPERIENCE);
  }
 @Override
 public void drawInformation(
     int positionX, int positionY, int width, int height, int page, FontRenderer fontRenderer) {
   width = Math.max(width, 20);
   int currentY = drawHead(positionX, positionY, width, fontRenderer);
   switch (page) {
     case 0:
       currentY = drawBaseInformation(positionX, currentY, width, fontRenderer);
       String TAG_STATUS =
           StatCollector.translateToLocal(MHFCReference.unlocalized_tag_status_long);
       currentY +=
           MHFCGuiUtil.drawTextAndReturnHeight(
               fontRenderer, TAG_STATUS, positionX + 5, currentY, 0, COLOUR_HEADER);
       currentY += LINE_SEPERATION;
       String draw = getLongStatus();
       for (String line : draw.split("\n")) {
         currentY +=
             MHFCGuiUtil.drawTextAndReturnHeight(
                 fontRenderer,
                 line,
                 positionX + width / 8,
                 currentY,
                 7 * width / 8 - BORDER,
                 COLOUR_TEXT);
         currentY += LINE_SEPERATION;
       }
       break;
     case 1:
       drawAimsFails(positionX, positionY, width, height, currentY, fontRenderer);
       break;
     case 2:
       drawClientDescription(positionX, currentY, width, fontRenderer);
       break;
   }
   String draw = (page + 1) + "/3";
   fontRenderer.drawString(
       draw,
       positionX + width - fontRenderer.getStringWidth(draw) - BORDER,
       positionY + height - fontRenderer.FONT_HEIGHT - BORDER,
       COLOUR_TEXT);
 }
  private void drawText(ForgeDirection direction, float scale, ItemStack content, int number) {
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glScalef(1.0F, 1.0F, -1.0F); // stops the item appearing inside out		
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); // rotates the item so it's not upside down

    translator.rotateTessellator(ForgeDirection.NORTH, direction, false);

    String count = this.itemCountToStacks(content, number);
    int length = fontRenderer.getStringWidth(count);
    float middle = (length / 2 * scale) - (scale / 2);

    switch (direction) {
      case SOUTH:
        {
          GL11.glTranslated(-middle - 0.5, 0.0, -0.5);
          break;
        }

      case EAST:
        {
          GL11.glTranslated(-middle, 0.0, -0.5);

          break;
        }

      case WEST:
        {
          GL11.glTranslated(-middle - 0.5, 0, 0);
          break;
        }

      default:
        {
          GL11.glTranslated(-middle, 0, 0);
        }
    }

    GL11.glScalef(scale, scale, scale); // shrinks the text down to the correct size
    DiscreteRenderHelper.renderTextInWorld(count, 0, 0, 16777215, false);
    GL11.glEnable(GL11.GL_LIGHTING);
  }
 private void drawFluids(int recipe) {
   CentrifugeRecipe r = (CentrifugeRecipe) arecipes.get(recipe);
   ItemStack in = r.input;
   FluidStack fs = RecipesCentrifuge.getRecipes().getFluidResult(in);
   if (fs != null) {
     Fluid f = fs.getFluid();
     IIcon ico = f.getIcon();
     float u = ico.getMinU();
     float v = ico.getMinV();
     float du = ico.getMaxU();
     float dv = ico.getMaxV();
     ReikaTextureHelper.bindTerrainTexture();
     Tessellator v5 = Tessellator.instance;
     v5.startDrawingQuads();
     int x = 147;
     for (int i = 0; i < 4; i++) {
       int y = 1 + i * 16;
       v5.addVertexWithUV(x, y, 0, u, v);
       v5.addVertexWithUV(x, y + 16, 0, u, dv);
       v5.addVertexWithUV(x + 16, y + 16, 0, du, dv);
       v5.addVertexWithUV(x + 16, y, 0, du, v);
     }
     v5.addVertexWithUV(x, 65, 0, u, v);
     v5.addVertexWithUV(x, 68, 0, u, dv);
     v5.addVertexWithUV(x + 16, 68, 0, du, dv);
     v5.addVertexWithUV(x + 16, 65, 0, du, v);
     v5.draw();
     FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
     String s =
         f.getLocalizedName()
             + " ("
             + fs.amount
             + " mB) ("
             + RecipesCentrifuge.getRecipes().getFluidChance(in)
             + "%)";
     int l = fr.getStringWidth(s);
     fr.drawString(s, 166 - l, 70, 0);
   }
 }
Example #23
0
  @Override
  protected void renderComponent(Slider component) {
    translateComponent(component, false);

    // GL settings
    glEnable(GL_BLEND);
    glDisable(GL_CULL_FACE);

    // area & font
    Rectangle area = component.getArea();
    int fontSize = theme.getFontRenderer().FONT_HEIGHT;
    FontRenderer fontRenderer = theme.getFontRenderer();

    // text
    fontRenderer.drawString(
        component.getText(), 0, 0, RenderUtil.toRGBA(component.getForegroundColor()));

    // value
    String content = null;
    switch (component.getValueDisplay()) {
      case DECIMAL:
        content =
            Double.toString(
                (double)
                        (Math.round(component.getValue() / component.getIncrement())
                            * 1000000
                            * (long) (component.getIncrement() * 1000000))
                    / 1000000
                    / 1000000);
        break;
      case INTEGER:
        content = String.format("%,d", Long.valueOf(Math.round(component.getValue())));
        break;
      case PERCENTAGE:
        int percent =
            (int)
                Math.round(
                    (component.getValue() - component.getMinimumValue())
                        / (component.getMaximumValue() - component.getMinimumValue())
                        * 100D);
        content = String.format("%d%%", percent);
      default:
    }
    if (content != null) {
      String suffix = component.getContentSuffix();
      if (suffix != null && !suffix.trim().isEmpty()) content = content.concat(" ").concat(suffix);
      fontRenderer.drawString(
          content,
          component.getWidth() - fontRenderer.getStringWidth(content),
          0,
          RenderUtil.toRGBA(component.getForegroundColor()));
    }
    glDisable(GL_TEXTURE_2D);

    // line
    glColor4f(0.03125f, 0.03125f, 0.03125f, 0.25f);
    glBegin(GL_QUADS);
    {
      glVertex2d(1, fontSize + 4);
      glVertex2d(area.width - 1, fontSize + 4);
      glVertex2d(area.width - 1, area.height - 2);
      glVertex2d(1, area.height - 2);
    }
    glEnd();

    // line shadow
    glLineWidth(1.0f);
    glColor4f(0.125f, 0.125f, 0.125f, 0.5f);
    glBegin(GL_LINE_LOOP);
    {
      glVertex2d(1, fontSize + 4);
      glVertex2d(area.width - 1, fontSize + 4);
      glVertex2d(area.width - 1, area.height - 2);
      glVertex2d(1, area.height - 2);
    }
    glEnd();

    double sliderPercentage =
        (component.getValue() - component.getMinimumValue())
            / (component.getMaximumValue() - component.getMinimumValue());

    // slider
    glColor4f(0.0f + (float) sliderPercentage, 1.0f - (float) sliderPercentage, 0.0f, 0.5f);
    glBegin(GL_QUADS);
    {
      glVertex2d((area.width - 6) * sliderPercentage - 1, fontSize + 1);
      glVertex2d((area.width - 6) * sliderPercentage + 7, fontSize + 1);
      glVertex2d((area.width - 6) * sliderPercentage + 7, area.height + 1);
      glVertex2d((area.width - 6) * sliderPercentage - 1, area.height + 1);
    }
    glEnd();

    // slider shadow
    RenderUtil.boxShadow(
        (area.width - 6) * sliderPercentage - 1,
        fontSize + 1,
        (area.width - 6) * sliderPercentage + 7,
        area.height + 1);

    // GL resets
    glEnable(GL_CULL_FACE);
    glEnable(GL_TEXTURE_2D);
    glDisable(GL_BLEND);

    translateComponent(component, true);
  }
Example #24
0
 @Override
 public void drawCenteredString(FontRenderer fontrenderer, String s, int i, int j, int k) {
   fontrenderer.drawString(s, i - fontrenderer.getStringWidth(s) / 2, j, k);
 }
Example #25
0
 public static int getStringWidth(String s) {
   if (s == null || s.equals("")) return 0;
   return fontRenderer.getStringWidth(EnumChatFormatting.getTextWithoutFormattingCodes(s));
 }
  protected void renderCompletionLevel(
      TileEntity tile,
      String par2Str,
      double par3,
      double par5,
      double par7,
      int par9,
      boolean par10,
      int par11) {

    int j = 0;
    int i = tile.getBlockMetadata();

    if (i == 0) {
      j = 0;
    }

    if (i == 1) {
      j = 90;
    }

    if (i == 2) {
      j = 180;
    }

    if (i == 3) {
      j = 270;
    }

    FontRenderer var12 = this.getFontRenderer();
    float var13 = 1.6F;
    float var14 = 0.0116666668F * var13;
    GL11.glPushMatrix();
    if (i == 0) GL11.glTranslatef((float) par3 + 0.60F, (float) par5 + 1.1F, (float) par7 + 1.41F);
    if (i == 1) GL11.glTranslatef((float) par3 + 1.51F, (float) par5 + 1.1F, (float) par7 + 0.50F);
    if (i == 2) GL11.glTranslatef((float) par3 + 0.60F, (float) par5 + 1.1F, (float) par7 - 0.41F);
    if (i == 3) GL11.glTranslatef((float) par3 - 0.31F, (float) par5 + 1.1F, (float) par7 + 0.51F);
    GL11.glRotatef(j + 180, 0.0F, 1.0F, 0.0F);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    if (!par10) {
      GL11.glScalef(-var14, -var14, var14);
    } else {
      GL11.glScalef(-var14 + 0.012f, -var14 + 0.012f, var14 + 0.012f);
    }
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    Tessellator var15 = Tessellator.instance;
    byte var16 = 0;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    int var17 = var12.getStringWidth(par2Str) / 2;
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, par11);
    var15.startDrawingQuads();
    var15.addVertex((double) (-var17 - 1), (double) (-1 + var16), 0.0D);
    var15.addVertex((double) (-var17 - 1), (double) (8 + var16), 0.0D);
    var15.addVertex((double) (var17 + 1), (double) (8 + var16), 0.0D);
    var15.addVertex((double) (var17 + 1), (double) (-1 + var16), 0.0D);
    var15.draw();
    var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, par11);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
  }
 @SubscribeEvent
 public void onClientRender(TickEvent.RenderTickEvent event) {
   if (event.phase == TickEvent.Phase.END) {
     Minecraft mc = Minecraft.getMinecraft();
     ScaledResolution res = new ScaledResolution(mc);
     int width = res.getScaledWidth();
     int height = res.getScaledHeight();
     FontRenderer fontRenderer = mc.fontRendererObj;
     mc.entityRenderer.setupOverlayRendering();
     if (strobeLinger > 0F) {
       GL11.glPushMatrix();
       {
         GL11.glDisable(GL11.GL_TEXTURE_2D);
         GL11.glEnable(GL11.GL_BLEND);
         GL11.glBegin(GL11.GL_QUADS);
         {
           GL11.glColor4f(1F, 1F, 1F, strobeLinger);
           GL11.glVertex2f(width, 0);
           GL11.glVertex2f(0, 0);
           GL11.glVertex2f(0, height);
           GL11.glVertex2f(width, height);
         }
         GL11.glEnd();
         GL11.glDisable(GL11.GL_BLEND);
         GL11.glEnable(GL11.GL_TEXTURE_2D);
       }
       GL11.glPopMatrix();
       strobeLinger -= (ConfigHandler.flashyMode < 3 ? 0.01F : 0.2F);
     }
     if (!tutorialText.equals("")) {
       if (tutorialTime > System.currentTimeMillis()) {
         String[] str = BetterUtils.getWordWrappedString(70, tutorialText);
         long difference = tutorialTime - System.currentTimeMillis();
         if (difference > 9000) difference = 10000 - difference;
         else if (difference > 1000) difference = 1000;
         GL11.glPushMatrix();
         {
           GL11.glDisable(GL11.GL_TEXTURE_2D);
           GL11.glTranslatef(width / 2 - 100, -50 + (difference / 20), 0F);
           GL11.glEnable(GL11.GL_BLEND);
           GL11.glBegin(GL11.GL_QUADS);
           {
             GL11.glColor4f(0F, 0F, 0F, .75F);
             GL11.glVertex2f(180, 0);
             GL11.glVertex2f(0, 0);
             GL11.glVertex2f(0, 4 + str.length * 5);
             GL11.glVertex2f(180, 4 + str.length * 5);
           }
           GL11.glEnd();
           GL11.glDisable(GL11.GL_BLEND);
           GL11.glEnable(GL11.GL_TEXTURE_2D);
           GL11.glScalef(.5F, .5F, 0F);
           for (int i = 0; i < str.length; i++)
             fontRenderer.drawStringWithShadow(
                 str[i], 180 - fontRenderer.getStringWidth(str[i]) / 2, 5 + i * 10, 0xFFFFFF);
         }
         GL11.glPopMatrix();
       } else {
         tutorialText = "";
         tutorialTime = 0;
       }
     }
     if (FileDownloader.isDownloading) {
       GL11.glPushMatrix();
       {
         GL11.glDisable(GL11.GL_TEXTURE_2D);
         GL11.glTranslatef(width / 2 - 50, height - height / 4 + 26, 0F);
         GL11.glEnable(GL11.GL_BLEND);
         GL11.glBegin(GL11.GL_QUADS);
         {
           GL11.glColor4f(0F, 0F, 0F, .8F);
           GL11.glVertex2f(100, 0);
           GL11.glVertex2f(0, 0);
           GL11.glVertex2f(0, 4);
           GL11.glVertex2f(100, 4);
         }
         GL11.glEnd();
         GL11.glBegin(GL11.GL_QUADS);
         {
           GL11.glColor4f(1F, 1F, 1F, .5F);
           GL11.glVertex2f(FileDownloader.downloadPercent * 100F, 0);
           GL11.glVertex2f(0, 0);
           GL11.glVertex2f(0, 4);
           GL11.glVertex2f(FileDownloader.downloadPercent * 100F, 4);
         }
         GL11.glEnd();
         GL11.glDisable(GL11.GL_BLEND);
         GL11.glEnable(GL11.GL_TEXTURE_2D);
       }
       GL11.glPopMatrix();
       fontRenderer.drawStringWithShadow(
           BetterUtils.getTranslatedString("overlay.downloading")
               + ": "
               + FileDownloader.nowDownloading,
           width / 2
               - fontRenderer.getStringWidth(
                       BetterUtils.getTranslatedString("overlay.downloading")
                           + ": "
                           + FileDownloader.nowDownloading)
                   / 2,
           height - height / 4 + 15,
           0xFFFF33);
     }
     if (!SoundHandler.nowPlaying.equals("")) {
       if (SoundHandler.nowPlaying.startsWith("Error:")) {
         fontRenderer.drawStringWithShadow(
             SoundHandler.nowPlaying,
             width / 2 - fontRenderer.getStringWidth(SoundHandler.nowPlaying) / 2,
             height - height / 4,
             0x990000);
         return;
       } else if (SoundHandler.nowPlaying.startsWith("Info:")) {
         fontRenderer.drawStringWithShadow(
             SoundHandler.nowPlaying,
             width / 2 - fontRenderer.getStringWidth(SoundHandler.nowPlaying) / 2,
             height - height / 4,
             0xFFFF33);
         return;
       }
       float f3 = (float) SoundHandler.nowPlayingInt;
       int l1 = Color.HSBtoRGB(f3 / 50.0F, 0.7F, 0.6F) & 16777215;
       int k1 = (int) (f3 * 255.0F / 20.0F);
       if (k1 > 255) k1 = 255;
       fontRenderer.drawStringWithShadow(
           BetterUtils.getTranslatedString("overlay.nowplaying") + ": " + SoundHandler.nowPlaying,
           width / 2
               - fontRenderer.getStringWidth(
                       BetterUtils.getTranslatedString("overlay.nowplaying")
                           + ": "
                           + SoundHandler.nowPlaying)
                   / 2,
           height - height / 4,
           l1 + (k1 << 24 & -16777216));
     }
   }
 }
  @ForgeSubscribe
  public void renderHealthBar(RenderLivingEvent.Specials.Post event) {
    if (!Debug.shouldRenderEntityHealthBars) return;

    if (event.entity == Minecraft.getMinecraft().thePlayer)
      return; // wont render the player hp in 3rd person
    float interp = timer.renderPartialTicks;
    EntityLivingBase e = event.entity;
    EntityPlayer p = Minecraft.getMinecraft().thePlayer;
    double diffX =
        e.prevPosX + interp * (e.posX - e.prevPosX) - (p.prevPosX + interp * (p.posX - p.prevPosX));
    double diffY =
        e.prevPosY + interp * (e.posY - e.prevPosY) - (p.prevPosY + interp * (p.posY - p.prevPosY));
    double diffZ =
        e.prevPosZ + interp * (e.posZ - e.prevPosZ) - (p.prevPosZ + interp * (p.posZ - p.prevPosZ));
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPushMatrix();
    double height = e.height + 0.5;
    GL11.glTranslated(diffX, diffY + height, diffZ);
    GL11.glRotated(-(p.prevRotationYaw + interp * (p.rotationYaw - p.prevRotationYaw)), 0, 1, 0);
    GL11.glRotated(p.prevRotationPitch + interp * (p.rotationPitch - p.prevRotationPitch), 1, 0, 0);
    Tessellator t = Tessellator.instance;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float currentHealth = e.getDataWatcher().func_111145_d(6);
    float maxHealth = e.func_110138_aP();
    if (event.entity instanceof EntityLivingBase) {

      GL11.glDisable(GL11.GL_DEPTH_TEST);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      float f = 1.6F;
      float f1 = 0.016666668F * f;
      GL11.glScaled(-f1, -f1, f1);
      FontRenderer fr = Minecraft.getMinecraft().fontRenderer;

      float healthLength = fr.getStringWidth(e.getEntityName()) + 1;
      float healthHeight = -9f;

      float sizeOfActiveHealth = healthLength * (currentHealth / maxHealth);
      GL11.glPushMatrix();
      GL11.glTranslated(-healthLength / 2f, -1, 0);
      t.startDrawingQuads();
      t.setColorRGBA(100, 205, 100, 100);
      t.addVertexWithUV(0, 0, 0, 0, 0);
      t.addVertexWithUV(0, -healthHeight, 0, 0, 1);
      t.addVertexWithUV(sizeOfActiveHealth, -healthHeight, 0, 1, 1);
      t.addVertexWithUV(sizeOfActiveHealth, 0, 0, 1, 0);
      t.draw();
      float rest = healthLength - sizeOfActiveHealth;
      GL11.glTranslated(sizeOfActiveHealth, 0, 0);
      t.startDrawingQuads();
      t.setColorRGBA(255, 0, 0, 100);
      t.addVertexWithUV(0, 0, 0, 0, 0);
      t.addVertexWithUV(0, -healthHeight, 0, 0, 1);
      t.addVertexWithUV(rest, -healthHeight, 0, 1, 1);
      t.addVertexWithUV(rest, 0, 0, 1, 0);
      t.draw();

      GL11.glPopMatrix();
      GL11.glEnable(GL11.GL_TEXTURE_2D);
      String text = e.getEntityName() + " [ " + currentHealth + "/" + maxHealth + " ]";
      fr.drawString(text, -fr.getStringWidth(text) / 2, 0, 553648127);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
  }
  @Override
  public void renderPage(
      int x,
      int y,
      FontRenderer fontRenderer,
      GuiSteamcraftBook book,
      RenderItem renderer,
      boolean isFirstPage,
      int mx,
      int my) {
    if (!lastViewing.equals(book.viewing)) {
      abdoName = Minecraft.getMinecraft().thePlayer.worldObj.rand.nextInt(7);
      lastViewing = book.viewing;
    }
    String s;
    int l;
    int yOffset = y + 55;
    if (isFirstPage) {
      yOffset = y + 65;
      s = I18n.format(name);
      l = fontRenderer.getStringWidth(s);
      fontRenderer.drawString(
          "\u00A7l" + "\u00A7n" + s,
          (int) (x + book.bookImageWidth / 2 - (l / 1.6) - 3),
          y + 30,
          0x3F3F3F);
    }

    s = I18n.format(text);
    String stringLeft = s;
    while (stringLeft.indexOf("<br>") != -1) {
      String output = stringLeft.substring(0, stringLeft.indexOf("<br>"));
      if ((Minecraft.getMinecraft().gameSettings.thirdPersonView != 0
              || Minecraft.getMinecraft()
                  .thePlayer
                  .getCommandSenderName()
                  .equals("MasterAbdoTGM50"))
          && Config.easterEggs) {
        output = doLizbeth(output);
      }
      l = fontRenderer.splitStringWidth(output, 110);
      fontRenderer.drawSplitString(output, x + 40, yOffset, 110, 0);
      yOffset += this.getSplitStringHeight(fontRenderer, output, x + 40, yOffset, 110);
      yOffset += 10;
      stringLeft = stringLeft.substring(stringLeft.indexOf("<br>") + 4, stringLeft.length());
    }
    String output = stringLeft;
    if ((Minecraft.getMinecraft().gameSettings.thirdPersonView != 0
            || Minecraft.getMinecraft().thePlayer.getCommandSenderName().equals("MasterAbdoTGM50"))
        && Config.easterEggs) {
      output = doLizbeth(output);
    }
    l = fontRenderer.splitStringWidth(output, 110);
    fontRenderer.drawSplitString(output, x + 40, yOffset, 110, 0);

    int size = item.length;
    int i = 0;
    for (ItemStack stack : item) {
      this.drawItemStack(
          stack,
          (int) (x + book.bookImageWidth / 2 - 12 - (size - 1) * 9 + i * 18),
          isFirstPage ? y + 45 : y + 35,
          "",
          renderer,
          fontRenderer);
      i++;
    }
    for (Tuple3 item : items) {
      int ix = (Integer) item.first;
      int iy = (Integer) item.second;
      if (mx >= ix && mx <= ix + 16 && my >= iy && my <= iy + 16) {
        fontRenderer.setUnicodeFlag(false);
        book.renderToolTip((ItemStack) item.third, mx, my);
        fontRenderer.setUnicodeFlag(true);
      }
    }
    items.clear();
  }
  public static void renderTooltip(
      int x,
      int y,
      List<String> tooltipData,
      Color color,
      Color colorFade,
      FontRenderer fontRenderer) {
    TextureHelper.setActiveTextureToAtlasSprite();
    boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING);
    if (lighting) RenderHelper.disableStandardItemLighting();

    if (!tooltipData.isEmpty()) {
      int esWidth = 0;
      for (String toolTip : tooltipData) {
        int width = fontRenderer.getStringWidth(toolTip);
        if (width > esWidth) esWidth = width;
      }
      int pX = x + 12;
      int pY = y - 12;
      int sumLineHeight = 8;
      if (tooltipData.size() > 1) sumLineHeight += 2 + (tooltipData.size() - 1) * 10;
      float z = 300F;

      drawGradientRect(pX - 3, pY - 4, z, pX + esWidth + 3, pY - 3, color, colorFade);
      drawGradientRect(
          pX - 3,
          pY + sumLineHeight + 3,
          z,
          pX + esWidth + 3,
          pY + sumLineHeight + 4,
          color,
          colorFade);
      drawGradientRect(
          pX - 3, pY - 3, z, pX + esWidth + 3, pY + sumLineHeight + 3, color, colorFade);
      drawGradientRect(pX - 4, pY - 3, z, pX - 3, pY + sumLineHeight + 3, color, colorFade);
      drawGradientRect(
          pX + esWidth + 3, pY - 3, z, pX + esWidth + 4, pY + sumLineHeight + 3, color, colorFade);

      int rgb = color.getRGB();
      int col = (rgb & 0x00FFFFFF) | rgb & 0xFF000000;
      Color colOp = new Color(col);
      drawGradientRect(pX - 3, pY - 3 + 1, z, pX - 3 + 1, pY + sumLineHeight + 3 - 1, color, colOp);
      drawGradientRect(
          pX + esWidth + 2,
          pY - 3 + 1,
          z,
          pX + esWidth + 3,
          pY + sumLineHeight + 3 - 1,
          color,
          colOp);
      drawGradientRect(pX - 3, pY - 3, z, pX + esWidth + 3, pY - 3 + 1, colOp, colOp);
      drawGradientRect(
          pX - 3,
          pY + sumLineHeight + 2,
          z,
          pX + esWidth + 3,
          pY + sumLineHeight + 3,
          color,
          color);

      GL11.glDisable(GL11.GL_DEPTH_TEST);
      for (int i = 0; i < tooltipData.size(); ++i) {
        String var14 = tooltipData.get(i);
        fontRenderer.drawString(var14, pX, pY, Color.WHITE.getRGB());
        if (i == 0) pY += 2;
        pY += 10;
      }
      GL11.glEnable(GL11.GL_DEPTH_TEST);
    }

    if (lighting) RenderHelper.enableStandardItemLighting();
    GL11.glColor4f(1F, 1F, 1F, 1F);
  }