diff options
Diffstat (limited to 'src/main/java/io')
73 files changed, 756 insertions, 2159 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 927b5e76..ce7b21b2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1665,7 +1665,7 @@ public class NEUOverlay extends Gui { buttonXSize, ySize, 1 - leftPressed, leftPressed, 1 - leftPressed, leftPressed ); GlStateManager.bindTexture(0); - Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Prev", fr, + Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Prev", leftSide - 1 + buttonXSize * 300 / 480f + leftPressed, top + ySize / 2f + leftPressed, false, (int) (buttonXSize * 240 / 480f), Color.BLACK.getRGB() @@ -1684,7 +1684,7 @@ public class NEUOverlay extends Gui { buttonXSize, ySize, 1 - rightPressed, rightPressed, 1 - rightPressed, rightPressed ); GlStateManager.bindTexture(0); - Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Next", fr, + Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Next", rightSide + 1 - buttonXSize * 300 / 480f + rightPressed, top + ySize / 2f + rightPressed, false, (int) (buttonXSize * 240 / 480f), Color.BLACK.getRGB() @@ -1699,7 +1699,7 @@ public class NEUOverlay extends Gui { new Color(50, 50, 50).getRGB() ); drawRect(leftSide + buttonXSize + 3, top + 1, rightSide - buttonXSize - 3, top + ySize - 1, fg.getRGB()); - Utils.drawStringCenteredScaledMaxWidth(pageText, fr, (leftSide + rightSide) / 2, + Utils.drawStringCenteredScaledMaxWidth(pageText, (leftSide + rightSide) / 2, top + ySize / 2f, false, strMaxLen, Color.BLACK.getRGB() ); } @@ -1845,8 +1845,6 @@ public class NEUOverlay extends Gui { } GlStateManager.enableDepth(); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - Utils.resetGuiScale(); Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.itemlist.paneGuiScale); @@ -2238,7 +2236,7 @@ public class NEUOverlay extends Gui { textToDisplay = text; } if (textToDisplay != null) { - Utils.drawHoveringText(textToDisplay, mouseX, mouseY, width, height, -1, fr); + Utils.drawHoveringText(textToDisplay, mouseX, mouseY, width, height, -1); textToDisplay = null; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java index 07ec4a59..e1ccdef7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -580,6 +580,7 @@ public class CustomAH extends Gui { } List<String> tooltipToRender = null; + int black = Color.BLACK.getRGB(); if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { resetCurrAucIdTimer = System.currentTimeMillis(); GuiChest auctionView = (GuiChest) Minecraft.getMinecraft().currentScreen; @@ -620,9 +621,7 @@ public class CustomAH extends Gui { endsInStr = EnumChatFormatting.DARK_PURPLE + prettyTime( auctionViewEndsIn + lastGuiScreenSwitch - System.currentTimeMillis()); } - Utils.drawStringCenteredScaledMaxWidth(endsInStr, Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft + 39, guiTop + 20, false, 70, 4210752 - ); + Utils.drawStringCenteredScaledMaxWidth(endsInStr, auctionViewLeft + 39, guiTop + 20, false, 70, 4210752); } Utils.drawItemStack(leftStack, auctionViewLeft + 31, guiTop + 100); @@ -790,9 +789,7 @@ public class CustomAH extends Gui { } } - Utils.drawStringCenteredScaledMaxWidth(containerName, Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft + 39, guiTop + 10, false, 70, 4210752 - ); + Utils.drawStringCenteredScaledMaxWidth(containerName, auctionViewLeft + 39, guiTop + 10, false, 70, 4210752); } else if (isEditingPrice()) { hasPopup = true; resetCurrAucIdTimer = System.currentTimeMillis(); @@ -810,9 +807,7 @@ public class CustomAH extends Gui { this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 96, 99); priceField.drawTextBox(); - Utils.drawStringCenteredScaledMaxWidth("Bid Amount", Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft + 39, guiTop + 10, false, 70, 4210752 - ); + Utils.drawStringCenteredScaledMaxWidth("Bid Amount", auctionViewLeft + 39, guiTop + 10, false, 70, 4210752); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons); @@ -822,22 +817,11 @@ public class CustomAH extends Gui { this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 50, 0, 16, 30, 16); this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 68, 0, 32, 64, 16); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - Utils.drawStringCentered("x2", fr, auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered("+50%", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered("+25%", fr, auctionViewLeft + 16 + 15, guiTop + 50 + 8, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered("+10%", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 50 + 8, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered("Set Amount", fr, auctionViewLeft + 16 + 32, guiTop + 68 + 8, false, - Color.BLACK.getRGB() - ); + Utils.drawStringCentered("x2", auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, black); + Utils.drawStringCentered("+50%", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, black); + Utils.drawStringCentered("+25%", auctionViewLeft + 16 + 15, guiTop + 50 + 8, false, black); + Utils.drawStringCentered("+10%", auctionViewLeft + 16 + 34 + 15, guiTop + 50 + 8, false, black); + Utils.drawStringCentered("Set Amount", auctionViewLeft + 16 + 32, guiTop + 68 + 8, false, black); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GuiEditSign editSign = (GuiEditSign) Minecraft.getMinecraft().currentScreen; @@ -907,7 +891,7 @@ public class CustomAH extends Gui { this.drawTexturedModalRect(guiLeft, y, 0, ySplit, getXSize(), 136 - ySplit); //GUI Name - Utils.drawStringCenteredScaledMaxWidth("Auction House", Minecraft.getMinecraft().fontRendererObj, guiLeft + 42, + Utils.drawStringCenteredScaledMaxWidth("Auction House", guiLeft + 42, guiTop + 10, false, 68, 4210752 ); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -1000,7 +984,7 @@ public class CustomAH extends Gui { if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) { Utils.drawStringCentered(EnumChatFormatting.RED + "NEUAH is DISABLED! Enable in /neu.", - Minecraft.getMinecraft().fontRendererObj, guiLeft + getXSize() / 2, guiTop + getYSize() / 2 - 5, true, 0 + guiLeft + getXSize() / 2, guiTop + getYSize() / 2 - 5, true, 0 ); } @@ -1009,9 +993,7 @@ public class CustomAH extends Gui { for (String line : tooltipToRender) { tooltipGray.add(EnumChatFormatting.GRAY + line); } - Utils.drawHoveringText(tooltipGray, mouseX, mouseY, width, - height, -1, Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltipGray, mouseX, mouseY, width, height, -1); } float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f)); int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (78 + 4)); @@ -1032,9 +1014,7 @@ public class CustomAH extends Gui { } priceFilterField.drawTextBox(); - Utils.drawStringCenteredScaledMaxWidth("Price Filter", Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft + 39, guiTop + 10, false, 70, 4210752 - ); + Utils.drawStringCenteredScaledMaxWidth("Price Filter", auctionViewLeft + 39, guiTop + 10, false, 70, 421052); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons); @@ -1054,16 +1034,9 @@ public class CustomAH extends Gui { this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 0, 32, 64, 16); } - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - Utils.drawStringCentered("<=", fr, auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered(">=", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered("==", fr, auctionViewLeft + 16 + 32, guiTop + 50 + 8, false, - Color.BLACK.getRGB() - ); + Utils.drawStringCentered("<=", auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, black); + Utils.drawStringCentered(">=", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, black); + Utils.drawStringCentered("==", auctionViewLeft + 16 + 32, guiTop + 50 + 8, false, black); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); // Bin average price filter @@ -1079,9 +1052,7 @@ public class CustomAH extends Gui { } binPriceFilterField.drawTextBox(); - Utils.drawStringCenteredScaledMaxWidth("BIN Average Filter", Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft + 39, guiTop + 10 + binPriceFilterYOffset, false, 70, 4210752 - ); + Utils.drawStringCenteredScaledMaxWidth("BIN Average Filter", auctionViewLeft + 39, guiTop + 10 + binPriceFilterYOffset, false, 70, 4210752); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons); @@ -1101,15 +1072,9 @@ public class CustomAH extends Gui { this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50 + binPriceFilterYOffset, 0, 32, 64, 16); } - Utils.drawStringCentered("<=", fr, auctionViewLeft + 16 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered(">=", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, - Color.BLACK.getRGB() - ); - Utils.drawStringCentered("==", fr, auctionViewLeft + 16 + 32, guiTop + 50 + 8 + binPriceFilterYOffset, false, - Color.BLACK.getRGB() - ); + Utils.drawStringCentered("<=", auctionViewLeft + 16 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, black); + Utils.drawStringCentered(">=", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, black); + Utils.drawStringCentered("==", auctionViewLeft + 16 + 32, guiTop + 50 + 8 + binPriceFilterYOffset, false, black); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java index 1802a1a4..405b18fc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java @@ -254,13 +254,11 @@ public class GuiElementColour extends GuiElement { RenderUtils.drawTexturedRect(x + 5 + 32 + selx - 4, y + 5 + 32 + sely - 4, 8, 8, GL11.GL_NEAREST); TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString() + Math.round(hsv[2] * 100) + "", - Minecraft.getMinecraft().fontRendererObj, x + 5 + 64 + 5 + 5 - (Math.round(hsv[2] * 100) == 100 ? 1 : 0), y + 5 + 64 + 5 + 5, true, 13, -1 ); if (opacitySlider) { TextRenderUtils.drawStringCenteredScaledMaxWidth( EnumChatFormatting.GRAY.toString() + Math.round(c.getAlpha() / 255f * 100) + "", - Minecraft.getMinecraft().fontRendererObj, x + 5 + 64 + 5 + valueOffset + 5, y + 5 + 64 + 5 + 5, true, @@ -271,7 +269,6 @@ public class GuiElementColour extends GuiElement { if (chromaSpeed > 0) { TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString() + (int) ChromaColour.getSecondsForSpeed(chromaSpeed) + "s", - Minecraft.getMinecraft().fontRendererObj, x + 5 + 64 + 5 + valueOffset + opacityOffset + 6, y + 5 + 64 + 5 + 5, true, 13, -1 ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java index 45dc58cc..5ab62d2a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java @@ -550,7 +550,6 @@ public class GuiElementTextField { TextRenderUtils.drawStringCenteredScaledMaxWidth( Utils.chromaStringByColourCode(texts[yOffI]), - Minecraft.getMinecraft().fontRendererObj, x + searchBarXSize / 2f, y + searchBarYSize / 2f + yOff, false, @@ -665,12 +664,12 @@ public class GuiElementTextField { y + (searchBarYSize - 8) / 2 + 9 + texY, Color.LIGHT_GRAY.getRGB() ); - TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj, + TextRenderUtils.drawStringScaled(String.valueOf(c), x + xStartOffset + texX, y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale ); if (bold) { - TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj, + TextRenderUtils.drawStringScaled(String.valueOf(c), x + xStartOffset + texX + 1, y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale ); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java index 9edad918..fd0946c9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java @@ -39,8 +39,9 @@ public abstract class GuiOptionEditor { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; RenderUtils.drawFloatingRectDark(x, y, width, height, true); - TextRenderUtils.drawStringCenteredScaledMaxWidth(option.name, - fr, x + width / 6, y + 13, true, width / 3 - 10, 0xc0c0c0 + TextRenderUtils.drawStringCenteredScaledMaxWidth( + option.name, + x + width / 6, y + 13, true, width / 3 - 10, 0xc0c0c0 ); int maxLines = 5; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java index 91515259..a422a8ec 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java @@ -22,7 +22,6 @@ package io.github.moulberry.notenoughupdates.core.config.gui; import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; @@ -76,9 +75,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); - TextRenderUtils.drawStringScaledMaxWidth(option.name, Minecraft.getMinecraft().fontRendererObj, - x + 18, y + 6, false, width - 10, 0xc0c0c0 - ); + TextRenderUtils.drawStringScaledMaxWidth(option.name, x + 18, y + 6, false, width - 10, 0xc0c0c0); } @Override diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java index aef6318c..fb5b58f3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java @@ -59,9 +59,9 @@ public class GuiOptionEditorButton extends GuiOptionEditor { RenderUtils.drawTexturedRect(x + width / 6 - 24, y + height - 7 - 14, 48, 16); if (buttonText != null) { - TextRenderUtils.drawStringCenteredScaledMaxWidth(buttonText, Minecraft.getMinecraft().fontRendererObj, - x + width / 6, y + height - 7 - 6, - false, 44, 0xFF303030 + TextRenderUtils.drawStringCenteredScaledMaxWidth( + buttonText, + x + width / 6, y + height - 7 - 6, false, 44, 0xFF303030 ); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java index ef2a52bb..e080bb28 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java @@ -25,7 +25,6 @@ import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -93,10 +92,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex); RenderUtils.drawTexturedRect(x + width / 6 - 24, y + 45 - 7 - 14, 48, 16); - TextRenderUtils.drawStringCenteredScaledMaxWidth("Add", Minecraft.getMinecraft().fontRendererObj, - x + width / 6, y + 45 - 7 - 6, - false, 44, 0xFF303030 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth("Add", x + width / 6, y + 45 - 7 - 6, false, 44, 0xFF303030); long currentTime = System.currentTimeMillis(); if (trashHoverTime < 0) { @@ -128,7 +124,8 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { if (i++ != dragStartIndex) { for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) { String line = multilines[multilineIndex]; - Utils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringScaledMaxWidth( + line + EnumChatFormatting.RESET, x + 20, y + 50 + yOff + multilineIndex * 10, true, width - 20, 0xffffffff ); } @@ -156,7 +153,6 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { } remaining.removeAll(activeText); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int dropdownWidth = Math.min(width / 2 - 10, 150); int left = dragOffsetX; int top = dragOffsetY; @@ -184,7 +180,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { str = "<NONE>"; } TextRenderUtils.drawStringScaledMaxWidth(str.replaceAll("(\n.*)+", " ..."), - fr, left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0 + left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0 ); dropdownY += 12; } @@ -215,7 +211,6 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { String line = multilines[multilineIndex]; Utils.drawStringScaledMaxWidth( line + EnumChatFormatting.RESET, - Minecraft.getMinecraft().fontRendererObj, dragOffsetX + mouseX + 10, dragOffsetY + mouseY + multilineIndex * 10, true, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java index af6af277..115b502e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java @@ -22,8 +22,6 @@ package io.github.moulberry.notenoughupdates.core.config.gui; import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.input.Mouse; @@ -54,7 +52,6 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { if (!open) { int height = getHeight(); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int dropdownWidth = Math.min(width / 3 - 10, 80); int left = x + width / 6 - dropdownWidth / 2; int top = y + height - 7 - 14; @@ -67,7 +64,6 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { RenderUtils.drawFloatingRectDark(left, top, dropdownWidth, 14, false); TextRenderUtils.drawStringScaled( "\u25BC", - fr, left + dropdownWidth - 10, y + height - 7 - 15, false, @@ -75,9 +71,9 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { 2 ); - TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left + 3, top + 3, false, - dropdownWidth - 16, 0xffa0a0a0 - ); + TextRenderUtils.drawStringScaledMaxWidth( + selectedString, + left + 3, top + 3, false, dropdownWidth - 16, 0xffa0a0a0); } } @@ -91,7 +87,6 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { int height = getHeight(); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int dropdownWidth = Math.min(width / 3 - 10, 80); int left = x + width / 6 - dropdownWidth / 2; int top = y + height - 7 - 14; @@ -117,28 +112,16 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { } TextRenderUtils.drawStringScaledMaxWidth( option, - fr, - left + 3, - top + 3 + dropdownY, - false, - dropdownWidth - 6, - 0xffa0a0a0 + left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0 ); dropdownY += 12; } - TextRenderUtils.drawStringScaled( - "\u25B2", - fr, - left + dropdownWidth - 10, - y + height - 7 - 15, - false, - 0xffa0a0a0, - 2 - ); + TextRenderUtils.drawStringScaled("\u25B2", left + dropdownWidth - 10, y + height - 7 - 15, false, 0xffa0a0a0, 2); - TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left + 3, top + 3, false, - dropdownWidth - 16, 0xffa0a0a0 + TextRenderUtils.drawStringScaledMaxWidth( + selectedString, + left + 3, top + 3, false, dropdownWidth - 16, 0xffa0a0a0 ); GlStateManager.popMatrix(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java index 048e261e..db788b95 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java @@ -54,9 +54,9 @@ public class GuiOptionEditorFSR extends GuiOptionEditor { RenderUtils.drawTexturedRect(x + width / 6 - 24, y + height - 7 - 14, 48, 16); if (buttonText != null) { - TextRenderUtils.drawStringCenteredScaledMaxWidth(buttonText, Minecraft.getMinecraft().fontRendererObj, - x + width / 6, y + height - 7 - 6, - false, 44, 0xFF303030 + TextRenderUtils.drawStringCenteredScaledMaxWidth( + buttonText, + x + width / 6, y + height - 7 - 6, false, 44, 0xFF303030 ); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java index b7d70db8..ffad3bc0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java @@ -59,11 +59,7 @@ public class GuiOptionEditorKeybind extends GuiOptionEditor { String keyName = KeybindHelper.getKeyName(getKeyCode()); String text = editingKeycode ? "> " + keyName + " <" : keyName; - TextRenderUtils.drawStringCenteredScaledMaxWidth(text, - Minecraft.getMinecraft().fontRendererObj, - x + width / 6, y + height - 7 - 6, - false, 40, 0xFF303030 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(text, x + width / 6, y + height - 7 - 6, false, 40, 0xFF303030); Minecraft.getMinecraft().getTextureManager().bindTexture(RESET); GlStateManager.color(1, 1, 1, 1); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java index 1b71e3ce..c7dced22 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java @@ -135,10 +135,9 @@ public class GuiPositionEditor extends GuiScreen { if (position.isCenterY()) y -= elementHeight / 2; Gui.drawRect(x, y, x + elementWidth, y + elementHeight, 0x80404040); - Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff - ); - Utils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Position Editor", scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff); + Utils.drawStringCentered( + "R to Reset - Arrow keys/mouse to move", scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java index b334418c..9f2088ed 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java @@ -106,12 +106,10 @@ public class GuiPositionEditorButForTheDungeonMap extends GuiScreen { // nea is } scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff - ); - Utils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff - ); + Utils.drawStringCentered("Position Editor", scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff); + Utils.drawStringCentered( + "R to Reset - Arrow keys/mouse to move", + scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff); } @Override diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java index 8415cf72..11112782 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java @@ -56,7 +56,6 @@ public class GuiOptionEditorBlocked extends GuiOptionEditor { TextRenderUtils.drawStringScaledMaxWidth( "This option is currently not available.", - mc.fontRendererObj, x + iconWidth,y + getHeight() / 2F - mc.fontRendererObj.FONT_HEIGHT / 2F, true, (int) (width - iconWidth), 0xFFFF4444 ); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java index 1e70db7f..e9bff8f6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java @@ -21,7 +21,6 @@ package io.github.moulberry.notenoughupdates.core.util; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; @@ -92,9 +91,8 @@ public class ArrowPagesUtils { String selectedPage = (currentPage + 1) + "/" + totalPages; - FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj; - Utils.drawStringCenteredScaledMaxWidth(selectedPage, fontRendererObj, - guiLeft + pageStringX, guiTop + pageStringY, false, 28, Color.BLACK.getRGB() + Utils.drawStringCenteredScaledMaxWidth( + selectedPage, guiLeft + pageStringX, guiTop + pageStringY, false, 28, Color.BLACK.getRGB() ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java index cee38cea..336dcb67 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java @@ -67,6 +67,18 @@ public class TextRenderUtils { public static void drawStringScaledMaxWidth( String str, + float x, + float y, + boolean shadow, + int len, + int colour + ) { + drawStringScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour); + } + + @Deprecated + public static void drawStringScaledMaxWidth( + String str, FontRenderer fr, float x, float y, @@ -78,7 +90,7 @@ public class TextRenderUtils { float factor = len / (float) strLen; factor = Math.min(1, factor); - drawStringScaled(str, fr, x, y, shadow, colour, factor); + drawStringScaled(str, x, y, shadow, colour, factor); } public static void drawStringCentered(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) { @@ -94,7 +106,19 @@ public class TextRenderUtils { public static void drawStringScaled( String str, - FontRenderer fr, + float x, + float y, + boolean shadow, + int colour, + float factor + ) { + drawStringScaled(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour, factor); + } + + @Deprecated + public static void drawStringScaled( + String str, + FontRenderer fr, float x, float y, boolean shadow, @@ -108,6 +132,18 @@ public class TextRenderUtils { public static void drawStringCenteredScaledMaxWidth( String str, + float x, + float y, + boolean shadow, + int len, + int colour + ) { + drawStringCenteredScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour); + } + + @Deprecated + public static void drawStringCenteredScaledMaxWidth( + String str, FontRenderer fr, float x, float y, @@ -122,7 +158,7 @@ public class TextRenderUtils { float fontHeight = 8 * factor; - drawStringScaled(str, fr, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor); + drawStringScaled(str, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor); } public static void renderToolTip( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java index 12d8c92d..cacae83b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java @@ -134,17 +134,7 @@ public class GuiCosmetics extends GuiScreen { for (String line : cosmeticsInfoTooltip) { grayTooltip.add(EnumChatFormatting.GRAY + line); } - Utils.drawHoveringText( - grayTooltip, - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); - - } + Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1);} } StringBuilder statusMsg = new StringBuilder("Last Sync: "); @@ -193,9 +183,7 @@ public class GuiCosmetics extends GuiScreen { equipMsg += " - " + (20 - (System.currentTimeMillis() - lastCapeEquip) / 1000) + "s"; } - Utils.drawStringCenteredScaledMaxWidth(equipMsg, Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, guiTop + sizeY + 5 + 10, false, 90, 0 - ); + Utils.drawStringCenteredScaledMaxWidth(equipMsg, guiLeft + sizeX / 2f, guiTop + sizeY + 5 + 10, false, 90, 0); } if (unlockTextField.getFocus() || !unlockTextField.getText().isEmpty()) { @@ -529,7 +517,6 @@ public class GuiCosmetics extends GuiScreen { Utils.drawStringCenteredScaledMaxWidth( "Try it out", - Minecraft.getMinecraft().fontRendererObj, guiLeft + 20 + 91 * displayIndex + 81 / 2f - xOffset, guiTop + 123 + 10, false, @@ -539,7 +526,6 @@ public class GuiCosmetics extends GuiScreen { if (equipable) { Utils.drawStringCenteredScaledMaxWidth( "Equip", - Minecraft.getMinecraft().fontRendererObj, guiLeft + 20 + 91 * displayIndex + 81 / 2f - xOffset, guiTop + 149 + 10, false, @@ -549,7 +535,6 @@ public class GuiCosmetics extends GuiScreen { } else { Utils.drawStringCenteredScaledMaxWidth( "Not Unlocked", - Minecraft.getMinecraft().fontRendererObj, guiLeft + 20 + 91 * displayIndex + 81 / 2f - xOffset, guiTop + 149 + 10, false, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java index 8f44242a..5b476c93 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java @@ -284,7 +284,6 @@ public class DungeonWin { if (Math.abs(xOff) != Math.abs(yOff)) { Utils.drawStringCentered( Utils.cleanColourNotModifiers(line), - Minecraft.getMinecraft().fontRendererObj, sr.getScaledWidth() / 2 + xOff / 2f, textCenterY + yOff / 2f, false, @@ -295,9 +294,7 @@ public class DungeonWin { } } - Utils.drawStringCentered(line, Minecraft.getMinecraft().fontRendererObj, - sr.getScaledWidth() / 2, textCenterY, false, (textAlpha << 24) | 0x00FFFFFF - ); + Utils.drawStringCentered(line, sr.getScaledWidth() / 2, textCenterY, false, (textAlpha << 24) | 0x00FFFFFF); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java index 025e11b2..dfd0405b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java @@ -145,7 +145,6 @@ public class GuiDungeonMapEditor extends GuiScreen { if (text.length() > 0) { Utils.drawStringCenteredScaledMaxWidth( text, - Minecraft.getMinecraft().fontRendererObj, guiLeft + x + 24, guiTop + y + 8, false, @@ -379,64 +378,30 @@ public class GuiDungeonMapEditor extends GuiScreen { Minecraft.getMinecraft().fontRendererObj.drawString("NEU Dungeon Map Editor", guiLeft + 8, guiTop + 6, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Border Size", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 76, guiTop + 30, false, 137, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Rooms Size", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 76, guiTop + 60, false, 137, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Icon Scale", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 76, guiTop + 90, false, 137, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Border Style", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 76, guiTop + 120, false, 137, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("Border Size", guiLeft + 76, guiTop + 30, false, 137, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Rooms Size", guiLeft + 76, guiTop + 60, false, 137, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Icon Scale", guiLeft + 76, guiTop + 90, false, 137, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Border Style", guiLeft + 76, guiTop + 120, false, 137, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Dungeon Map", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 44 + 139, guiTop + 30, false, 60, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Center", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 108 + 139, guiTop + 30, false, 60, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("Dungeon Map", guiLeft + 44 + 139, guiTop + 30, false, 60, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Center", guiLeft + 108 + 139, guiTop + 30, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Rotate", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 44 + 139, guiTop + 59, false, 60, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Icon Style", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 108 + 139, guiTop + 59, false, 60, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("Rotate", guiLeft + 44 + 139, guiTop + 59, false, 60, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Icon Style", guiLeft + 108 + 139, guiTop + 59, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Check Orient", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 44 + 139, guiTop + 88, false, 60, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Check Center", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 108 + 139, guiTop + 88, false, 60, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("Check Orient", guiLeft + 44 + 139, guiTop + 88, false, 60, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Check Center", guiLeft + 108 + 139, guiTop + 88, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Interpolation", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 44 + 139, guiTop + 117, false, 60, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Compatibility", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 108 + 139, guiTop + 117, false, 60, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("Interpolation", guiLeft + 44 + 139, guiTop + 117, false, 60, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Compatibility", guiLeft + 108 + 139, guiTop + 117, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Background", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 44 + 139, guiTop + 146, false, 60, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Border", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 108 + 139, guiTop + 146, false, 60, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("Background", guiLeft + 44 + 139, guiTop + 146, false, 60, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Border", guiLeft + 108 + 139, guiTop + 146, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("BG Blur", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 44 + 139, guiTop + 175, false, 60, 0xFFB4B4B4 - ); - Utils.drawStringCenteredScaledMaxWidth("Chroma Type", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 108 + 139, guiTop + 175, false, 60, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("BG Blur", guiLeft + 44 + 139, guiTop + 175, false, 60, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Chroma Type", guiLeft + 108 + 139, guiTop + 175, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Edit Map Position", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 76, guiTop + 209, false, 200, 0xFFB4B4B4 - ); + Utils.drawStringCenteredScaledMaxWidth("Edit Map Position", guiLeft + 76, guiTop + 209, false, 200, 0xFFB4B4B4); try { drawSlider(DungeonMapConfig.class.getDeclaredField("dmBorderSize"), guiLeft + 76, guiTop + 45); @@ -468,9 +433,7 @@ public class GuiDungeonMapEditor extends GuiScreen { GlStateManager.color(1, 1, 1, 1); Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex); RenderUtils.drawTexturedRect(guiLeft + 52, guiTop + 215, 48, 16); - TextRenderUtils.drawStringCenteredScaledMaxWidth("Edit", fontRendererObj, guiLeft + 76, guiTop + 223, - false, 48, 0xFF303030 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth("Edit", guiLeft + 76, guiTop + 223, false, 48, 0xFF303030); Map<String, Vec4b> decorations = new HashMap<>(); Vec4b vec4b = new Vec4b((byte) 3, (byte) (((50) - 64) * 2), (byte) (((40) - 64) * 2), (byte) ((60) * 16 / 360)); @@ -495,8 +458,7 @@ public class GuiDungeonMapEditor extends GuiScreen { mouseY, width, height, - 200, - Minecraft.getMinecraft().fontRendererObj + 200 ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java index 4b6c73f4..a8df8d1f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java @@ -121,7 +121,6 @@ public class FlipperInfoPane extends InfoPane { } private int renderParagraph(int width, int height, int startY, String text, Color bg) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int paneWidth = (int) (width / 3 * overlay.getWidthMult()); int rightSide = (int) (width * overlay.getInfoPaneOffsetFactor()); @@ -129,7 +128,7 @@ public class FlipperInfoPane extends InfoPane { int yOff = 0; for (String line : text.split("\n")) { - yOff += Utils.renderStringTrimWidth(line, fr, false, leftSide + overlay.getBoxPadding() + 5, + yOff += Utils.renderStringTrimWidth(line, false, leftSide + overlay.getBoxPadding() + 5, startY + overlay.getBoxPadding() + 10 + yOff, width * 1 / 3 - overlay.getBoxPadding() * 2 - 10, Color.WHITE.getRGB(), -1 ); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java index 90bed1fa..37e9e4d7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java @@ -61,7 +61,7 @@ public class TextInfoPane extends ScrollableInfoPane { int yOff = 20; for (String line : text.split("\n")) { - yOff += Utils.renderStringTrimWidth(line, fr, false, leftSide + overlay.getBoxPadding() + 5, + yOff += Utils.renderStringTrimWidth(line, false, leftSide + overlay.getBoxPadding() + 5, yScroll + overlay.getBoxPadding() + 10 + yOff, width * 1 / 3 - overlay.getBoxPadding() * 2 - 10, Color.WHITE.getRGB(), -1 ); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java index 7cc96d42..cf4edb76 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java @@ -123,7 +123,7 @@ public class GuiElementTextField extends GuiElement { } private float getScaleFactor(String str) { - return Math.min(1, (searchBarXSize - 2) / (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(str)); + return Math.min(1, (searchBarXSize - 2) / (float) getStringWidth0(str)); } private boolean isScaling() { @@ -132,12 +132,16 @@ public class GuiElementTextField extends GuiElement { private float getStringWidth(String str) { if (isScaling()) { - return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str) * getScaleFactor(str); + return getStringWidth0(str) * getScaleFactor(str); } else { - return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str); + return getStringWidth0(str); } } + private static int getStringWidth0(String str) { + return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str); + } + public int getCursorPos(int mouseX, int mouseY) { int xComp = mouseX - x; int yComp = mouseY - y; @@ -188,7 +192,7 @@ public class GuiElementTextField extends GuiElement { int linePos = strLenNoColor(trimmed); if (linePos != strLenNoColor(line)) { char after = line.charAt(linePos); - int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed); + int trimmedWidth = getStringWidth0(trimmed); int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after); if (trimmedWidth + charWidth / 2 < xComp - padding) { linePos++; @@ -304,7 +308,7 @@ public class GuiElementTextField extends GuiElement { } else if (split.length > 1) { thisLineBeforeCursor = split[split.length - 1]; lineBefore = split[split.length - 2]; - textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor); + textBeforeCursorWidth = getStringWidth0(thisLineBeforeCursor); } else { return; } @@ -313,7 +317,7 @@ public class GuiElementTextField extends GuiElement { int linePos = strLenNoColor(trimmed); if (linePos != strLenNoColor(lineBefore)) { char after = lineBefore.charAt(linePos); - int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed); + int trimmedWidth = getStringWidth0(trimmed); int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after); if (trimmedWidth + charWidth / 2 < textBeforeCursorWidth) { linePos++; @@ -342,7 +346,7 @@ public class GuiElementTextField extends GuiElement { textBeforeCursorWidth = 0; } else if (split.length > 0) { thisLineBeforeCursor = split[split.length - 1]; - textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor); + textBeforeCursorWidth = getStringWidth0(thisLineBeforeCursor); } else { return; } @@ -355,7 +359,7 @@ public class GuiElementTextField extends GuiElement { int linePos = strLenNoColor(trimmed); if (linePos != strLenNoColor(lineAfter)) { char after = lineAfter.charAt(linePos); - int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed); + int trimmedWidth = getStringWidth0(trimmed); int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after); if (trimmedWidth + charWidth / 2 < textBeforeCursorWidth) { linePos++; @@ -468,15 +472,14 @@ public class GuiElementTextField extends GuiElement { for (int yOffI = 0; yOffI < texts.length; yOffI++) { int yOff = yOffI * extraSize; - if (isScaling() && Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) > searchBarXSize - 10) { - scale = (searchBarXSize - 2) / (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]); + if (isScaling() && getStringWidth0(texts[yOffI]) > searchBarXSize - 10) { + scale = (searchBarXSize - 2) / (float) getStringWidth0(texts[yOffI]); if (scale > 1) scale = 1; - float newLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) * scale; + float newLen = getStringWidth0(texts[yOffI]) * scale; xStartOffset = (int) ((searchBarXSize - newLen) / 2f); Utils.drawStringCenteredScaledMaxWidth( texts[yOffI], - Minecraft.getMinecraft().fontRendererObj, x + searchBarXSize / 2f, y + searchBarYSize / 2f + yOff, false, @@ -506,7 +509,7 @@ public class GuiElementTextField extends GuiElement { if (split.length <= numLinesBeforeCursor || split.length == 0) { textBeforeCursorWidth = 0; } else { - textBeforeCursorWidth = (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length - + textBeforeCursorWidth = (int) (getStringWidth0(split[split.length - 1]) * scale); } drawRect(x + xStartOffset + textBeforeCursorWidth, @@ -557,7 +560,7 @@ public class GuiElementTextField extends GuiElement { continue; } - int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(String.valueOf(c)); + int len = getStringWidth0(String.valueOf(c)); if (bold) len++; if (i >= leftIndex && i < rightIndex) { drawRect(x + xStartOffset + (int) texX, @@ -566,12 +569,12 @@ public class GuiElementTextField extends GuiElement { y + (searchBarYSize - 8) / 2 + 9 + texY, Color.LIGHT_GRAY.getRGB() ); - Utils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringScaled(String.valueOf(c), x + xStartOffset + texX, y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale ); if (bold) { - Utils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringScaled(String.valueOf(c), x + xStartOffset + texX + 1, y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale ); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java index e08e5369..041843ae 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java @@ -370,9 +370,7 @@ public class NEUItemEditor extends GuiScreen { text.add(displayName.get()); text.addAll(Arrays.asList(lore.get().split("\n"))); - Utils.drawHoveringText(text, itemX - 20, itemY + itemSize + 28, width, height, -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(text, itemX - 20, itemY + itemSize + 28, width, height, -1); GlStateManager.disableLighting(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java index 65724c65..03f3a449 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java @@ -709,8 +709,7 @@ public class RenderListener { event.mouseY, event.gui.width, event.gui.height, - -1, - Minecraft.getMinecraft().fontRendererObj + -1 ); } } @@ -970,7 +969,6 @@ public class RenderListener { && NotEnoughUpdates.INSTANCE.config.dungeons.shouldWarningDerpy) { Utils.drawStringScaled( EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "Mayor Derpy active!", - Minecraft.getMinecraft().fontRendererObj, guiLeft + xSize + 4 + 10, guiTop + 85, true, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java index 2c28bcd1..69b0a1b6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java @@ -120,29 +120,24 @@ public class AbiphoneWarning extends GuiElement { int neuLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth("\u00a7lNEU"); Minecraft.getMinecraft().fontRendererObj.drawString( "\u00a7lNEU", - width / 2 + 90 - neuLength - 3, - height / 2 - 45 + 4, - 0xff000000 + width / 2 + 90 - neuLength - 3, height / 2 - 45 + 4, 0xff000000 ); - TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj, + TextRenderUtils.drawStringCenteredScaledMaxWidth( + "Are you SURE?", width / 2, height / 2 - 45 + 10, false, 170, 0xffff4040 ); String sellLine = "\u00a77[ \u00a7r" + contactName + "\u00a77 ]"; - TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj, + TextRenderUtils.drawStringCenteredScaledMaxWidth( + sellLine, width / 2, height / 2 - 45 + 25, false, 170, 0xffffffff ); TextRenderUtils.drawStringCenteredScaledMaxWidth( "Continue removing this contact?", - Minecraft.getMinecraft().fontRendererObj, - width / 2, - height / 2 - 45 + 50, - false, - 170, - 0xffa0a0a0 + width / 2, height / 2 - 45 + 50, false, 170, 0xffa0a0a0 ); RenderUtils.drawFloatingRectDark(width / 2 - 43, height / 2 + 23, 40, 16, false); @@ -150,21 +145,11 @@ public class AbiphoneWarning extends GuiElement { TextRenderUtils.drawStringCenteredScaledMaxWidth( EnumChatFormatting.GREEN + "[Y]es", - Minecraft.getMinecraft().fontRendererObj, - width / 2 - 23, - height / 2 + 31, - true, - 36, - 0xff00ff00 + width / 2 - 23, height / 2 + 31, true, 36, 0xff00ff00 ); TextRenderUtils.drawStringCenteredScaledMaxWidth( EnumChatFormatting.RED + "[N]o", - Minecraft.getMinecraft().fontRendererObj, - width / 2 + 23, - height / 2 + 31, - true, - 36, - 0xffff0000 + width / 2 + 23, height / 2 + 31, true, 36, 0xffff0000 ); GlStateManager.popMatrix(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java index 7282aad7..2b292aec 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java @@ -183,7 +183,7 @@ public class AuctionBINWarning extends GuiElement { 0xff000000 ); - TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj, + TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", width / 2, height / 2 - 45 + 10, false, 170, 0xffff4040 ); @@ -203,19 +203,14 @@ public class AuctionBINWarning extends GuiElement { String sellLine = "\u00a77[ \u00a7r" + sellingName + "\u00a77 ]"; - TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj, + TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, width / 2, height / 2 - 45 + 25, false, 170, 0xffffffff ); TextRenderUtils.drawStringCenteredScaledMaxWidth( (lowestPrice > 0 ? "has a lowest BIN of \u00a76" + lowestPriceStr + "\u00a7r coins" : "\u00a7cWarning: No lowest BIN found!"), - Minecraft.getMinecraft().fontRendererObj, - width / 2, - height / 2 - 45 + 34, - false, - 170, - 0xffa0a0a0 + width / 2, height / 2 - 45 + 34, false, 170, 0xffa0a0a0 ); if (sellingPrice > lowestPrice * sellStackAmount) { @@ -229,22 +224,12 @@ public class AuctionBINWarning extends GuiElement { TextRenderUtils.drawStringCenteredScaledMaxWidth( "Continue selling it for", - Minecraft.getMinecraft().fontRendererObj, - width / 2, - height / 2 - 45 + 50, - false, - 170, - 0xffa0a0a0 + width / 2, height / 2 - 45 + 50, false, 170, 0xffa0a0a0 ); TextRenderUtils.drawStringCenteredScaledMaxWidth( "\u00a76" + sellingPriceStr + "\u00a7r coins?" + (lowestPrice > 0 ? "(\u00a7" + (isALoss ? "c-" : "a+") + (buyPercentage >= 100 ? buyPercentage - 100 : buyPercentage) + "%\u00a7r)" : ""), - Minecraft.getMinecraft().fontRendererObj, - width / 2, - height / 2 - 45 + 59, - false, - 170, - 0xffa0a0a0 + width / 2, height / 2 - 45 + 59, false, 170, 0xffa0a0a0 ); RenderUtils.drawFloatingRectDark(width / 2 - 43, height / 2 + 23, 40, 16, false); @@ -252,21 +237,11 @@ public class AuctionBINWarning extends GuiElement { TextRenderUtils.drawStringCenteredScaledMaxWidth( EnumChatFormatting.GREEN + "[Y]es", - Minecraft.getMinecraft().fontRendererObj, - width / 2 - 23, - height / 2 + 31, - true, - 36, - 0xff00ff00 + width / 2 - 23, height / 2 + 31, true, 36, 0xff00ff00 ); TextRenderUtils.drawStringCenteredScaledMaxWidth( EnumChatFormatting.RED + "[N]o", - Minecraft.getMinecraft().fontRendererObj, - width / 2 + 23, - height / 2 + 31, - true, - 36, - 0xffff0000 + width / 2 + 23, height / 2 + 31, true, 36, 0xffff0000 ); if (sellingTooltip != null) { @@ -277,15 +252,7 @@ public class AuctionBINWarning extends GuiElement { if (mouseX >= width / 2 - sellLineLength / 2 && mouseX <= width / 2 + sellLineLength / 2 && mouseY >= height / 2 - 45 + 20 && mouseY <= height / 2 - 45 + 30) { - Utils.drawHoveringText( - sellingTooltip, - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(sellingTooltip, mouseX, mouseY, width, height, -1); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java index ed05ee79..e840acdf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java @@ -82,9 +82,7 @@ public class AuctionSortModeWarning { RenderUtils.drawFloatingRectDark(centerX - warningLength / 2 - 4, centerY - 6, warningLength + 8, 12, false ); - TextRenderUtils.drawStringCenteredScaledMaxWidth(warningText, Minecraft.getMinecraft().fontRendererObj, - centerX, centerY, true, chest.width / 2, 0xffffffff - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(warningText, centerX, centerY, true, chest.width / 2, 0xffffffff); GlStateManager.popMatrix(); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java index 711d5235..c4b03b84 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java @@ -221,15 +221,7 @@ public class DungeonNpcProfitOverlay { int mouseY = Utils.getMouseY(); if (Utils.isWithinRect(mouseX, mouseY, x, y, 160, 10)) - Utils.drawHoveringText( - chestProfit.lore, - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(chestProfit.lore, mouseX, mouseY, width, height, -1); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java index 695c9851..a5c96e4a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java @@ -277,7 +277,7 @@ public class EnchantingSolvers { GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.disableLighting(); - Utils.drawStringScaled((solveIndex + 1) + "", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringScaled((solveIndex + 1) + "", x + 8.5f - w / 2f, y + 8.5f - 4, true, 0xffc0c0c0, 1f ); return true; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java index 800e25b1..b43b0e78 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java @@ -174,11 +174,7 @@ public class FishingHelper { Utils.drawStringCentered( String.format("%.02fs", seconds), - Minecraft.getMinecraft().fontRendererObj, - 0, - -baseHeight - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT, - false, - color + 0, -baseHeight - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT, false, color ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java index 2cbd3125..9217dcae 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java @@ -152,12 +152,7 @@ public class MiningStuff { if (alpha > 10) { TextRenderUtils.drawStringCenteredScaledMaxWidth( "Titanium has spawned nearby!", - Minecraft.getMinecraft().fontRendererObj, - 0, - 0, - true, - width / 4 - 20, - colour | (colour << 8) | (colour << 16) | (alpha << 24) + 0, 0, true, width / 4 - 20, colour | (colour << 8) | (colour << 16) | (alpha << 24) ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java index 736d5058..8d1c06f3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java @@ -96,7 +96,6 @@ public class SunTzu { int height = Utils.renderStringTrimWidth( EnumChatFormatting.YELLOW + getQuote(), - Minecraft.getMinecraft().fontRendererObj, true, sr.getScaledWidth() / 2 - 100, 5, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java index 2f091304..1e7dc319 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java @@ -25,7 +25,6 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -208,7 +207,6 @@ public class EntityViewer extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { drawDefaultBackground(); - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; this.guiLeft = (width - this.xSize) / 2; this.guiTop = (height - this.ySize) / 2; @@ -216,7 +214,7 @@ public class EntityViewer extends GuiScreen { Minecraft.getMinecraft().getTextureManager().bindTexture(BACKGROUND); drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize); - Utils.drawStringScaledMaxWidth(label, fontRenderer, guiLeft + 10, guiTop + 10, false, 100, 0xFF00FF); + Utils.drawStringScaledMaxWidth(label, guiLeft + 10, guiTop + 10, false, 100, 0xFF00FF); renderEntity(entity, guiLeft + 90, guiTop + 75, mouseX, mouseY); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index 530dcfd1..562eb1e0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -204,24 +204,8 @@ public class AccessoryBagOverlay { private static Set<Integer> pagesVisited = new HashSet<>(); public static void renderVisitOverlay(int x, int y) { - Utils.drawStringCenteredScaledMaxWidth( - "Please visit all", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 78, - true, - 70, - -1 - ); - Utils.drawStringCenteredScaledMaxWidth( - "pages of the bag", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 86, - true, - 70, - -1 - ); + Utils.drawStringCenteredScaledMaxWidth("Please visit all", x + 40, y + 78, true, 70, -1); + Utils.drawStringCenteredScaledMaxWidth("pages of the bag", x + 40, y + 86, true, 70, -1); } private static TreeMap<Integer, Integer> talismanCountRarity = null; @@ -237,15 +221,7 @@ public class AccessoryBagOverlay { } } - Utils.drawStringCenteredScaledMaxWidth( - "# By Rarity", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "# By Rarity"); int yIndex = 0; for (Map.Entry<Integer, Integer> entry : talismanCountRarity.descendingMap().entrySet()) { @@ -271,15 +247,7 @@ public class AccessoryBagOverlay { } } - Utils.drawStringCenteredScaledMaxWidth( - "Total Stats", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Total Stats"); int yIndex = 0; for (int i = 0; i < PlayerStats.defaultStatNames.length; i++) { String statName = PlayerStats.defaultStatNames[i]; @@ -319,15 +287,7 @@ public class AccessoryBagOverlay { } } - Utils.drawStringCenteredScaledMaxWidth( - "Reforge Stats", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Reforge Stats"); int yIndex = 0; for (int i = 0; i < PlayerStats.defaultStatNames.length; i++) { String statName = PlayerStats.defaultStatNames[i]; @@ -363,28 +323,12 @@ public class AccessoryBagOverlay { if (duplicates == null) { JsonObject misc = Constants.MISC; if (misc == null) { - Utils.drawStringCenteredScaledMaxWidth( - "Duplicates: ERROR", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Duplicates: ERROR"); return; } JsonElement talisman_upgrades_element = misc.get("talisman_upgrades"); if (talisman_upgrades_element == null) { - Utils.drawStringCenteredScaledMaxWidth( - "Duplicates: ERROR", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Duplicates: ERROR"); return; } JsonObject talisman_upgrades = talisman_upgrades_element.getAsJsonObject(); @@ -419,25 +363,9 @@ public class AccessoryBagOverlay { } } if (duplicates.isEmpty()) { - Utils.drawStringCenteredScaledMaxWidth( - "No Duplicates", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "No Duplicates"); } else { - Utils.drawStringCenteredScaledMaxWidth( - "Duplicates: " + duplicates.size(), - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Duplicates: " + duplicates.size()); int yIndex = 0; for (ItemStack duplicate : duplicates) { @@ -451,9 +379,12 @@ public class AccessoryBagOverlay { } if (duplicates.size() > 11) { - Utils.drawStringCenteredScaledMaxWidth("+" + (duplicates.size() - 10) + " More", - Minecraft.getMinecraft().fontRendererObj, x + 40, y + 16 + 121, false, 70, - new Color(80, 80, 80).getRGB() + Utils.drawStringCenteredScaledMaxWidth( + "+" + (duplicates.size() - 10) + " More", + x + 40, y + 16 + 121, + false, + 70, + gray() ); } } @@ -465,28 +396,12 @@ public class AccessoryBagOverlay { if (missing == null) { JsonObject misc = Constants.MISC; if (misc == null) { - Utils.drawStringCenteredScaledMaxWidth( - "Duplicates: ERROR", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Duplicates: ERROR"); return; } JsonElement talisman_upgrades_element = misc.get("talisman_upgrades"); if (talisman_upgrades_element == null) { - Utils.drawStringCenteredScaledMaxWidth( - "Duplicates: ERROR", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Duplicates: ERROR"); return; } JsonObject talisman_upgrades = talisman_upgrades_element.getAsJsonObject(); @@ -554,25 +469,9 @@ public class AccessoryBagOverlay { } } if (missing.isEmpty()) { - Utils.drawStringCenteredScaledMaxWidth( - "No Missing", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "No Missing"); } else { - Utils.drawStringCenteredScaledMaxWidth( - "Missing: " + missing.size(), - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + drawString(x, y, "Missing: " + missing.size()); int yIndex = 0; long currentTime = System.currentTimeMillis(); @@ -610,10 +509,7 @@ public class AccessoryBagOverlay { } if (missing.size() > 11) { - Utils.drawStringCenteredScaledMaxWidth("Show All", - Minecraft.getMinecraft().fontRendererObj, x + 40, y + 16 + 121, false, 70, - new Color(80, 80, 80).getRGB() - ); + Utils.drawStringCenteredScaledMaxWidth("Show All", x + 40, y + 16 + 121, false, 70, gray()); final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); final int scaledWidth = scaledresolution.getScaledWidth(); @@ -675,7 +571,7 @@ public class AccessoryBagOverlay { mouseX * scaledresolution.getScaleFactor() / 2, mouseY * scaledresolution.getScaleFactor() / 2, scaledWidth * scaledresolution.getScaleFactor() / 2, - scaledHeight * scaledresolution.getScaleFactor() / 2, -1, Minecraft.getMinecraft().fontRendererObj + scaledHeight * scaledresolution.getScaleFactor() / 2, -1 ); GlStateManager.popMatrix(); } @@ -683,6 +579,10 @@ public class AccessoryBagOverlay { } } + private static void drawString(int x, int y, String abc) { + Utils.drawStringCenteredScaledMaxWidth(abc, x + 40, y + 12, false, 70, gray()); + } + private static boolean forceCC = false; private static boolean forceAS = false; private static boolean useGodPot = true; @@ -690,15 +590,7 @@ public class AccessoryBagOverlay { private static int mainWeapon = 1; public static void renderOptimizerOverlay(int x, int y) { - Utils.drawStringCenteredScaledMaxWidth( - "Optimizer", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 12, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + Utils.drawStringCenteredScaledMaxWidth("Optimizer", x + 40, y + 12, false, 70, gray()); int light = new Color(220, 220, 220).getRGB(); int dark = new Color(170, 170, 170).getRGB(); @@ -724,116 +616,50 @@ public class AccessoryBagOverlay { dark ); + Utils.drawStringCenteredScaledMaxWidth("Force 100% CC", x + 40, y + 27, false, 70, gray()); Utils.drawStringCenteredScaledMaxWidth( - "Force 100% CC", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 27, - false, - 70, - new Color(80, 80, 80).getRGB() - ); - Utils.drawStringCenteredScaledMaxWidth((forceCC ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", - Minecraft.getMinecraft().fontRendererObj, x + 20, y + 37, - true, 30, new Color(80, 80, 80).getRGB() + (forceCC ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", x + 20, y + 37, true, 30, gray() ); Utils.drawStringCenteredScaledMaxWidth( (forceCC ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", - Minecraft.getMinecraft().fontRendererObj, - x + 60, - y + 37, - true, - 30, - new Color(80, 80, 80).getRGB() + x + 60, y + 37, true, 30, gray() ); - Utils.drawStringCenteredScaledMaxWidth( - "Force 100% ATKSPEED", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 47, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + Utils.drawStringCenteredScaledMaxWidth("Force 100% ATKSPEED", x + 40, y + 47, false, 70, gray()); Utils.drawStringCenteredScaledMaxWidth( (forceAS ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", - Minecraft.getMinecraft().fontRendererObj, - x + 20, - y + 57, - true, - 30, - new Color(80, 80, 80).getRGB() + x + 20, y + 57, true, 30, gray() ); Utils.drawStringCenteredScaledMaxWidth( (forceAS ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", - Minecraft.getMinecraft().fontRendererObj, - x + 60, - y + 57, - true, - 30, - new Color(80, 80, 80).getRGB() + x + 60, y + 57, true, 30, gray() ); - Utils.drawStringCenteredScaledMaxWidth( - "Use God Potion", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 67, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + Utils.drawStringCenteredScaledMaxWidth("Use God Potion", x + 40, y + 67, false, 70, gray()); Utils.drawStringCenteredScaledMaxWidth( (useGodPot ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", - Minecraft.getMinecraft().fontRendererObj, - x + 20, - y + 77, - true, - 30, - new Color(80, 80, 80).getRGB() + x + 20, y + 77, true, 30, gray() ); Utils.drawStringCenteredScaledMaxWidth( (useGodPot ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", - Minecraft.getMinecraft().fontRendererObj, - x + 60, - y + 77, - true, - 30, - new Color(80, 80, 80).getRGB() + x + 60, y + 77, true, 30, gray() ); - Utils.drawStringCenteredScaledMaxWidth( - "Use God Potion", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 87, - false, - 70, - new Color(80, 80, 80).getRGB() - ); + Utils.drawStringCenteredScaledMaxWidth("Use God Potion", x + 40, y + 87, false, 70, gray()); Utils.drawStringCenteredScaledMaxWidth((allowShaded ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", - Minecraft.getMinecraft().fontRendererObj, x + 20, y + 97, - true, 30, new Color(80, 80, 80).getRGB() + x + 20, y + 97, true, 30, gray() ); Utils.drawStringCenteredScaledMaxWidth((allowShaded ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", - Minecraft.getMinecraft().fontRendererObj, x + 60, y + 97, - true, 30, new Color(80, 80, 80).getRGB() + x + 60, y + 97, + true, 30, gray() ); - Utils.drawStringCenteredScaledMaxWidth( - "Main Weapon", - Minecraft.getMinecraft().fontRendererObj, - x + 40, - y + 107, - false, - 70, - new Color(80, 80, 80).getRGB() - ); - Utils.drawStringCenteredScaled("1 2 3 4 5 6 7 8 9", - Minecraft.getMinecraft().fontRendererObj, x + 40, y + 117, - true, 70, new Color(80, 80, 80).getRGB() - ); + Utils.drawStringCenteredScaledMaxWidth("Main Weapon", x + 40, y + 107, false, 70, gray()); + Utils.drawStringCenteredScaled("1 2 3 4 5 6 7 8 9", x + 40, y + 117, true, 70, gray()); + } + + private static int gray() { + return new Color(80, 80, 80).getRGB(); } private static Comparator<String> getItemComparator() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java index baea367c..3bd90db8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java @@ -822,7 +822,7 @@ public class CalendarOverlay { int startingWidth = fr.getStringWidth(starting); fr.drawString(starting, Math.max(guiLeft + 23, width / 2f - startingWidth / 2f), y + 7, -1, false); } else { - Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Event Starting Now!", fr, width / 2, y + 11, false, -1); + Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Event Starting Now!", width / 2, y + 11, false, -1); } int displayWidth = fr.getStringWidth(event.display); @@ -981,7 +981,7 @@ public class CalendarOverlay { GL11.glDisable(GL11.GL_SCISSOR_TEST); } else { if (guiLeft + xSize - 8 - untilLen > (width + displayWidth) / 2) { - Utils.drawStringCentered(nextEvent.display, fr, width / 2f, guiTop + 10, false, -1); + Utils.drawStringCentered(nextEvent.display, width / 2f, guiTop + 10, false, -1); } else { fr.drawString(nextEvent.display, guiLeft + 8 + nextSLen, guiTop + 6, -1, false); } @@ -1026,7 +1026,7 @@ public class CalendarOverlay { if (tooltipToDisplay != null) { drawTimerForeground = true; GlStateManager.translate(0, 0, 100); - Utils.drawHoveringText(tooltipToDisplay, mouseX, Math.max(17, mouseY), width, height, -1, fr); + Utils.drawHoveringText(tooltipToDisplay, mouseX, Math.max(17, mouseY), width, height, -1); GlStateManager.translate(0, 0, -100); } } @@ -1121,20 +1121,20 @@ public class CalendarOverlay { if (mayorStack != null) { String mayor = mayorStack.getDisplayName(); float verticalHeight = Utils.getVerticalHeight(mayor); - Utils.drawStringVertical(mayor, fr, guiLeft + 8, guiTop + 96 - verticalHeight / 2, + Utils.drawStringVertical(mayor, guiLeft + 8, guiTop + 96 - verticalHeight / 2, false, -1 ); } String calendar = EnumChatFormatting.GREEN + "Calendar"; float calendarHeight = Utils.getVerticalHeight(calendar); - Utils.drawStringVertical(calendar, fr, guiLeft + xSize - 12, guiTop + 60 - calendarHeight / 2, + Utils.drawStringVertical(calendar, guiLeft + xSize - 12, guiTop + 60 - calendarHeight / 2, false, -1 ); String rewards = EnumChatFormatting.GOLD + "Rewards"; float rewardsHeight = Utils.getVerticalHeight(rewards); - Utils.drawStringVertical(rewards, fr, guiLeft + xSize - 12, guiTop + 132 - rewardsHeight / 2, + Utils.drawStringVertical(rewards, guiLeft + xSize - 12, guiTop + 132 - rewardsHeight / 2, false, -1 ); @@ -1349,7 +1349,7 @@ public class CalendarOverlay { tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "In order to show crop types for Jacob's Farming"); tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "contest, visit the full SkyBlock calendar and go all"); tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "the way to the end of the SkyBlock year"); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); tooltipToDisplay = null; } } @@ -1415,7 +1415,7 @@ public class CalendarOverlay { } GlStateManager.translate(0, 0, -20); } else if (tooltipToDisplay != null) { - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } GlStateManager.translate(0, 0, -10); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 6f190ada..6d219999 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -36,6 +36,7 @@ import io.github.moulberry.notenoughupdates.util.ItemUtils; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiContainer; @@ -146,7 +147,8 @@ public class GuiCustomEnchant extends Gui { if (costs.size() >= 1) { if (useMaxLevelForCost) { - int cost = (maxLevel != null && maxLevel.has(this.enchId) ? maxLevel.get(this.enchId).getAsInt() : costs.size()); + int cost = + (maxLevel != null && maxLevel.has(this.enchId) ? maxLevel.get(this.enchId).getAsInt() : costs.size()); this.xpCost = costs.get(cost - 1).getAsInt(); } else if (level - 1 < costs.size()) { this.xpCost = costs.get(level - 1).getAsInt(); @@ -600,16 +602,15 @@ public class GuiCustomEnchant extends Gui { 0, X_SIZE / 512f, 0, Y_SIZE / 512f, GL11.GL_NEAREST ); - Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); - Minecraft.getMinecraft().fontRendererObj.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false); + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); + fr.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false); //Page Text if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) { String pageStr = "Page: " + currentPage + "/" + expectedMaxPage; - int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr); - Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040 - ); + int pageStrLen = fr.getStringWidth(pageStr); + Utils.drawStringCentered(pageStr, guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040); //Page Arrows Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); @@ -727,12 +728,8 @@ public class GuiCustomEnchant extends Gui { //Can't be enchanted text if (currentState == EnchantState.INVALID_ITEM) { GlStateManager.disableDepth(); - Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555 - ); - Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555 - ); + Utils.drawStringCentered("This item can't", guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555); + Utils.drawStringCentered("be enchanted", guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555); GlStateManager.enableDepth(); } @@ -755,52 +752,24 @@ public class GuiCustomEnchant extends Gui { //Text if no enchants appear if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) { if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromApplicable) { - Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555 - ); - Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555 - ); + Utils.drawStringCentered("Can't find that", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchant, perhaps", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("it is on", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555); + Utils.drawStringCentered("another page?", guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555); } else if (applicable.isEmpty() && !searchRemovedFromApplicable) { - Utils.drawStringCentered("No applicable", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555 - ); + Utils.drawStringCentered("No applicable", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchants on", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("this page...", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555); } if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromRemovable) { - Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555 - ); - Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555 - ); + Utils.drawStringCentered("Can't find that", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchant, perhaps", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("it is on", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555); + Utils.drawStringCentered("another page?", guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555); } else if (removable.isEmpty() && !searchRemovedFromRemovable) { - Utils.drawStringCentered("No removable", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555 - ); + Utils.drawStringCentered("No removable", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchants on", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("this page...", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555); } } //Available enchants (left) @@ -836,50 +805,14 @@ public class GuiCustomEnchant extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString( - ench.enchantName, - guiLeft + 8 + 16 + 2 + textOffset, - top + 4 + textOffset, - 0xffffffdd, - true - ); + fr.drawString(ench.enchantName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); @@ -916,53 +849,26 @@ public class GuiCustomEnchant extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString( levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4, - colour, - false - ); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString(ench.enchantName, - guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true - ); + fr.drawString(ench.enchantName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); //Player Inventory Items - Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory - .getDisplayName() - .getUnformattedText(), + fr.drawString( + Minecraft.getMinecraft().thePlayer.inventory.getDisplayName().getUnformattedText(), guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040 ); int inventoryStartIndex = cc.getLowerChestInventory().getSizeInventory(); @@ -1003,7 +909,7 @@ public class GuiCustomEnchant extends Gui { searchField.setPrependText("\u00a77Search..."); } else { if (searchField.getFocus()) { - int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(searchField.getTextDisplay()) + 10; + int len = fr.getStringWidth(searchField.getTextDisplay()) + 10; searchField.setSize(Math.max(90, len), 14); } else { searchField.setSize(90, 14); @@ -1041,36 +947,12 @@ public class GuiCustomEnchant extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false); //Enchant name String name = WordUtils.capitalizeFully(ItemUtils @@ -1085,14 +967,7 @@ public class GuiCustomEnchant extends Gui { } else if (name.equalsIgnoreCase("Luck of the Sea")) { name = "Luck of Sea"; } - Utils.drawStringCentered( - name, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2, - top + 8, - true, - 0xffffffdd - ); + Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd); if (isChangingEnchLevel) { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); @@ -1105,42 +980,12 @@ public class GuiCustomEnchant extends Gui { //Enchant level levelStr = "" + enchanterCurrentEnch.level; if (enchanterCurrentEnch.xpCost < 0) levelStr = "?"; - levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4, - 0xea82ff, - false - ); + levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4, 0xea82ff, false); //Confirm button @@ -1160,18 +1005,14 @@ public class GuiCustomEnchant extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040 - ); + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040); } else { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040 - ); + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040); if (playerXpLevel < enchanterCurrentEnch.xpCost) { Gui.drawRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, guiLeft + X_SIZE / 2 - 1, top + 18 + 14, 0x80000000); @@ -1185,18 +1026,14 @@ public class GuiCustomEnchant extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040 - ); + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040); } else { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040 - ); + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040); } if (mouseY > top + 18 && mouseY <= top + 18 + 16) { @@ -1269,42 +1106,12 @@ public class GuiCustomEnchant extends Gui { ); levelStr = "" + ench.level; - levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 - 1, - top + 16 * yIndex + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 + 1, - top + 16 * yIndex + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 16 * yIndex + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 16 * yIndex + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 16 * yIndex + 4, - 0xea82ff, - false - ); + levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 16 * yIndex + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 16 * yIndex + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4, 0xea82ff, false); } GlStateManager.enableDepth(); } @@ -1380,9 +1187,7 @@ public class GuiCustomEnchant extends Gui { Utils.drawItemStack(stackOnMouse, mouseX - 8, mouseY - 8); } } else if (tooltipToDisplay != null) { - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } GlStateManager.translate(0, 0, -300); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index 5053ae70..41208681 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -31,7 +31,6 @@ import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; @@ -132,7 +131,6 @@ public class GuiEnchantColour extends GuiScreen { Utils.drawStringCentered( "Add Ench Colour", - fontRendererObj, guiLeft + xSize / 2 + 1, guiTop + ySize - 20, false, @@ -156,7 +154,7 @@ public class GuiEnchantColour extends GuiScreen { if (colourCode.length() > 1) colourCode = String.valueOf(colourCode.toLowerCase().charAt(0)); if (comparator.length() > 1) comparator = String.valueOf(comparator.toLowerCase().charAt(0)); - Utils.drawStringCentered(comparator, fontRendererObj, guiLeft + 96, guiTop + 33 + 25 * yIndex, false, 4210752); + Utils.drawStringCentered(comparator, guiLeft + 96, guiTop + 33 + 25 * yIndex, false, 4210752); if (guiElementTextFields.size() <= yIndex) { guiElementTextFields.add(new GuiElementTextField[3]); @@ -226,7 +224,6 @@ public class GuiEnchantColour extends GuiScreen { yIndex++; } renderSideBar(mouseX, mouseY, partialTicks); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; List<String> tooltipToDisplay = null; GlStateManager.color(1, 1, 1, 1); Minecraft.getMinecraft().getTextureManager().bindTexture(help); @@ -275,13 +272,13 @@ public class GuiEnchantColour extends GuiScreen { if (mouseY >= guiTopSidebar - 34 && mouseY <= guiTopSidebar - 18 && maxedBookFound == 1) { tooltipToDisplay = maxedBook.getTooltip(Minecraft.getMinecraft().thePlayer, false); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); tooltipToDisplay = null; renderingTooltip = true; } if (mouseY >= guiTopSidebar - 52 && mouseY <= guiTopSidebar - 34 && maxedAttBookFound == 1 && !renderingTooltip) { tooltipToDisplay = maxedAttBook.getTooltip(Minecraft.getMinecraft().thePlayer, false); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); tooltipToDisplay = null; renderingTooltip = true; } @@ -326,7 +323,7 @@ public class GuiEnchantColour extends GuiScreen { EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + "I" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + " = " + EnumChatFormatting.ITALIC + "Italic" ); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); tooltipToDisplay = null; } } @@ -390,7 +387,6 @@ public class GuiEnchantColour extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "Load preset", - fontRendererObj, guiLeft + xSize + 4 + 44, guiTopSidebar + 8, false, @@ -399,7 +395,6 @@ public class GuiEnchantColour extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "from Clipboard", - fontRendererObj, guiLeft + xSize + 4 + 44, guiTopSidebar + 16, false, @@ -408,7 +403,6 @@ public class GuiEnchantColour extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "Save preset", - fontRendererObj, guiLeft + xSize + 4 + 44, guiTopSidebar + 8 + 24, false, @@ -417,7 +411,6 @@ public class GuiEnchantColour extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "to Clipboard", - fontRendererObj, guiLeft + xSize + 4 + 44, guiTopSidebar + 16 + 24, false, @@ -426,7 +419,6 @@ public class GuiEnchantColour extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "Reset Config", - fontRendererObj, guiLeft + xSize + 4 + 44, guiTopSidebar + 12 + 24 * 2, false, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java index d97227cf..147bf567 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java @@ -411,7 +411,6 @@ public class GuiInvButtonEditor extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "Load preset", - fontRendererObj, guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0), guiTop + 8, false, @@ -420,7 +419,6 @@ public class GuiInvButtonEditor extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "from Clipboard", - fontRendererObj, guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0), guiTop + 16, false, @@ -429,7 +427,6 @@ public class GuiInvButtonEditor extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "Save preset", - fontRendererObj, guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0), guiTop + 8 + 24, false, @@ -438,7 +435,6 @@ public class GuiInvButtonEditor extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "to Clipboard", - fontRendererObj, guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0), guiTop + 16 + 24, false, @@ -459,7 +455,6 @@ public class GuiInvButtonEditor extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "\u00a7nPresets", - fontRendererObj, guiLeft + xSize + 22 + 40, guiTop + 10, false, @@ -471,7 +466,6 @@ public class GuiInvButtonEditor extends GuiScreen { for (String presetName : presets.keySet()) { Utils.drawStringCenteredScaledMaxWidth( presetName, - fontRendererObj, guiLeft + xSize + 22 + 40, guiTop + 25 + 10 * (index++), false, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java index 129699da..eac58a1a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java @@ -355,7 +355,7 @@ public class GuiItemCustomize extends GuiScreen { } if (tooltipToDisplay != null) { - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fontRendererObj); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } super.drawScreen(mouseX, mouseY, partialTicks); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java index e81834d3..3627a94e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java @@ -29,7 +29,6 @@ import io.github.moulberry.notenoughupdates.recipes.RecipeSlot; import io.github.moulberry.notenoughupdates.recipes.RecipeType; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -127,7 +126,6 @@ public class GuiItemRecipe extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { drawDefaultBackground(); - FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj; GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -150,7 +148,6 @@ public class GuiItemRecipe extends GuiScreen { Utils.drawStringScaledMaxWidth( currentRecipe.getTitle(), - fontRendererObj, guiLeft + TITLE_X, guiTop + TITLE_Y, false, @@ -165,12 +162,7 @@ public class GuiItemRecipe extends GuiScreen { if (slot.getItemStack() == null) continue; Utils.drawHoveringText( slot.getItemStack().getTooltip(Minecraft.getMinecraft().thePlayer, false), - mouseX, - mouseY, - width, - height, - -1, - fontRendererObj + mouseX, mouseY, width, height, -1 ); } } @@ -195,7 +187,7 @@ public class GuiItemRecipe extends GuiScreen { "" + EnumChatFormatting.RESET + EnumChatFormatting.GREEN + type.getLabel(), "" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + craftingRecipes.get(type).size() + " Recipes" ), - mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj + mouseX, mouseY, width, height, -1 ); return; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java index 35c80579..ba3f95df 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java @@ -104,7 +104,6 @@ public class GuiNavigation extends GuiScreen { ); Utils.drawStringF( json.get("displayname").getAsString(), - Minecraft.getMinecraft().fontRendererObj, baseX + TEXT_OFFSET_X, baseY + LIST_OFFSET_Y / 2F - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2F, false, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java index eb6aa956..c03a72a6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java @@ -139,20 +139,16 @@ public class GuiPriceGraph extends GuiScreen { if (itemName != null && itemStack != null) { Utils.drawItemStack(itemStack, guiLeft + 16, guiTop + 11); - Utils.drawStringScaledMax(itemName, Minecraft.getMinecraft().fontRendererObj, guiLeft + 35, guiTop + 13, false, + Utils.drawStringScaledMax(itemName, guiLeft + 35, guiTop + 13, false, 0xffffff, 1.77f, 208 ); } if (!loaded) - Utils.drawStringCentered("Loading...", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 166, guiTop + 116, false, 0xffffff00 - ); + Utils.drawStringCentered("Loading...", guiLeft + 166, guiTop + 116, false, 0xffffff00); else if ( itemData == null || itemData.get() == null || itemData.get().size() <= 1) - Utils.drawStringCentered("No data found.", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 166, guiTop + 116, false, 0xffff0000 - ); + Utils.drawStringCentered("No data found.", guiLeft + 166, guiTop + 116, false, 0xffff0000); else { int graphColor = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.ahGraph.graphColor); int graphColor2 = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.ahGraph.graphColor2); @@ -226,9 +222,7 @@ public class GuiPriceGraph extends GuiScreen { if (num != prevNum) { int xPos = (int) map(time, firstTime, lastTime, guiLeft + 17, guiLeft + 315); if (Math.abs(prevXPos - xPos) > 30) { - Utils.drawStringCentered(String.valueOf(num), Minecraft.getMinecraft().fontRendererObj, - xPos, guiTop + 206, false, 0x8b8b8b - ); + Utils.drawStringCentered(String.valueOf(num), xPos, guiTop + 206, false, 0x8b8b8b); prevXPos = xPos; } prevNum = num; @@ -237,10 +231,9 @@ public class GuiPriceGraph extends GuiScreen { for (int i = 0; i <= 6; i++) { long price = (long) map(i, 0, 6, highestValue, lowestValue); String formattedPrice = formatPrice(price); - Utils.drawStringF(formattedPrice, Minecraft.getMinecraft().fontRendererObj, guiLeft + 320, + Utils.drawStringF(formattedPrice, guiLeft + 320, (float) map(i, 0, 6, guiTop + 35, guiTop + 198) - - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2f, - false, 0x8b8b8b + - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2f, false, 0x8b8b8b ); } if (customSelecting) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java index 8ee68457..648345bf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java @@ -25,7 +25,6 @@ import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -40,6 +39,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; + @NEUAutoSubscribe public class InventoryStorageSelector { private static final InventoryStorageSelector INSTANCE = new InventoryStorageSelector(); @@ -266,7 +266,6 @@ public class InventoryStorageSelector { int width = scaledResolution.getScaledWidth(); int height = scaledResolution.getScaledHeight(); - FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj; int centerX = width / 2; int offset = 91 + 10 + 12; @@ -439,32 +438,18 @@ public class InventoryStorageSelector { Utils.drawItemStack(held, centerX - 8, startY - 8); GlStateManager.translate(0, 0, 100); - Utils.drawStringCentered(pageTitle, fontRendererObj, centerX, height - 76, true, 0xffff0000); + Utils.drawStringCentered(pageTitle, centerX, height - 76, true, 0xffff0000); int keyCode = NotEnoughUpdates.INSTANCE.config.storageGUI.backpackScrollKey; if (KeybindHelper.isKeyValid(keyCode) && !KeybindHelper.isKeyDown(keyCode)) { String keyName = KeybindHelper.getKeyName(keyCode); - Utils.drawStringCentered( - "[" + keyName + "] Scroll Backpacks", - fontRendererObj, - centerX, - startY - 10, - true, - 0xff32CD32 - ); + Utils.drawStringCentered("[" + keyName + "] Scroll Backpacks", centerX, startY - 10, true, 0xff32CD32); } GlStateManager.translate(0, 0, -200); } else if (page == null) { - Utils.drawStringCentered( - "Run /storage to enable this feature!", - fontRendererObj, - centerX, - height - 80, - true, - 0xffff0000 - ); + Utils.drawStringCentered("Run /storage to enable this feature!", centerX, height - 80, true, 0xffff0000); } else { - Utils.drawStringCentered("Right-click to load items", fontRendererObj, centerX, height - 80, true, 0xffff0000); + Utils.drawStringCentered("Right-click to load items", centerX, height - 80, true, 0xffff0000); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java index 288c3926..c2908807 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java @@ -95,11 +95,10 @@ public class KatSitterOverlay { ) : currentWidth); GlStateManager.disableLighting(); GlStateManager.color(1F, 1F, 1F, 1F); - Utils.drawStringScaled(currentText, font, left, ((AccessorGuiContainer) gui).getGuiTop() + 25, false, 0xFFD700, 1F); + Utils.drawStringScaled(currentText, left, ((AccessorGuiContainer) gui).getGuiTop() + 25, false, 0xFFD700, 1F); if (upgradedLevel != null) Utils.drawStringScaled( upgradedText, - font, left, ((AccessorGuiContainer) gui).getGuiTop() + 45, false, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java index ac96f527..30907836 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java @@ -74,14 +74,7 @@ public class NEUOverlayPlacements extends GuiScreen { drawRect((width - 176) / 2, (height - 166) / 2, (width + 176) / 2, (height + 166) / 2, new Color(100, 100, 100, 200).getRGB() ); - Utils.drawStringCentered( - GOLD + "Inventory", - Minecraft.getMinecraft().fontRendererObj, - width / 2f, - height / 2f, - false, - 0 - ); + Utils.drawStringCentered(GOLD + "Inventory", width / 2f, height / 2f, false, 0); MBGuiGroupFloating mainGroup = NotEnoughUpdates.INSTANCE.overlay.guiGroup; mainGroup.render(0, 0); @@ -145,7 +138,8 @@ public class NEUOverlayPlacements extends GuiScreen { } if (anchorPoint.inventoryRelative) { - Utils.drawStringCentered(GOLD + "Inv-Relative", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered( + GOLD + "Inv-Relative", position.x + element.getWidth() * 0.5f, position.y + element.getHeight() * 0.5f, false, 0 ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java index 4f01e551..31331ab3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java @@ -32,8 +32,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.text.DecimalFormat; import java.math.BigDecimal; +import java.text.DecimalFormat; import java.util.Objects; @NEUAutoSubscribe @@ -62,14 +62,7 @@ public class SignCalculator { int calculationMode = NotEnoughUpdates.INSTANCE.config.misc.calculationMode; if ((calculationMode == 1 && !source.startsWith("!"))) return; - Utils.drawStringCentered( - getRenderedString(), - Minecraft.getMinecraft().fontRendererObj, - guiEditSign.width / 2F, - 58, - false, - 0x808080FF - ); + Utils.drawStringCentered(getRenderedString(), guiEditSign.width / 2F, 58, false, 0x808080FF); } @SubscribeEvent diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 5dd8bd9c..ff1d8687 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -862,11 +862,11 @@ public class StorageOverlay extends GuiElement { Gui.drawRect(storageX, storageY, storageX + 162, storageY + h, 0x80000000); if (storageId < 9) { - Utils.drawStringCenteredScaledMaxWidth("Locked Page", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Locked Page", storageX + 81, storageY + h / 2, true, 150, 0xd94c00 ); } else { - Utils.drawStringCenteredScaledMaxWidth("Empty Backpack Slot", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Empty Backpack Slot", storageX + 81, storageY + h / 2, true, 150, 0xd94c00 ); } @@ -889,7 +889,7 @@ public class StorageOverlay extends GuiElement { Gui.drawRect(storageX, storageY, storageX + 162, storageY + h, 0x80000000); - Utils.drawStringCenteredScaledMaxWidth("Click to load items", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Click to load items", storageX + 81, storageY + h / 2, true, 150, 0xffdf00 ); } else { @@ -1233,35 +1233,35 @@ public class StorageOverlay extends GuiElement { if (StorageManager.getInstance().desiredStoragePage == storageId && StorageManager.getInstance().onStorageMenu) { - Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", storageX + 81 - 1, storageY + storageH / 2 - 5, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", storageX + 81 + 1, storageY + storageH / 2 - 5, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", storageX + 81, storageY + storageH / 2 - 5 - 1, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", storageX + 81, storageY + storageH / 2 - 5 + 1, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", storageX + 81, storageY + storageH / 2 - 5, false, 150, 0xffdf00 ); - Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", storageX + 81 - 1, storageY + storageH / 2 + 5, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", storageX + 81 + 1, storageY + storageH / 2 + 5, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", storageX + 81, storageY + storageH / 2 + 5 - 1, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", storageX + 81, storageY + storageH / 2 + 5 + 1, false, 150, 0x111111 ); - Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", storageX + 81, storageY + storageH / 2 + 5, false, 150, 0xffdf00 ); } @@ -1685,26 +1685,10 @@ public class StorageOverlay extends GuiElement { } GlStateManager.translate(0, 0, -100); } else { - Utils.drawHoveringText( - tooltipToDisplay, - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } } else if (tooltipToDisplay != null) { - Utils.drawHoveringText( - tooltipToDisplay, - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } else { allowTypingInSearchBar = true; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java index 16b5015b..6d565bb3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java @@ -107,7 +107,6 @@ public class TradeWindow { for (int yOff = -2; yOff <= 2; yOff++) { if (Math.abs(xOff) != Math.abs(yOff)) { Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(str), - Minecraft.getMinecraft().fontRendererObj, x + xOff / 2f, y + yOff / 2f, false, len, new Color(20, 20, 20, 100 / Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB() ); @@ -115,11 +114,7 @@ public class TradeWindow { } } - Utils.drawStringCenteredScaledMaxWidth(str, - Minecraft.getMinecraft().fontRendererObj, - x, y, false, len, - new Color(64, 64, 64, 255).getRGB() - ); + Utils.drawStringCenteredScaledMaxWidth(str, x, y, false, len, new Color(64, 64, 64, 255).getRGB()); } private static long getPrice(String internalName) { @@ -567,14 +562,12 @@ public class TradeWindow { Utils.drawTexturedRect(guiLeft, guiTop, xSize, ySize, 0, 176 / 256f, 0, 204 / 256f, GL11.GL_NEAREST); Utils.drawStringF(new ChatComponentTranslation("container.inventory").getUnformattedText(), - Minecraft.getMinecraft().fontRendererObj, guiLeft + 8, guiTop + 111, false, 4210752 - ); - Utils.drawStringF("You", Minecraft.getMinecraft().fontRendererObj, guiLeft + 8, - guiTop + 5, false, 4210752 + guiLeft + 8, guiTop + 111, false, 4210752 ); + Utils.drawStringF("You", guiLeft + 8, guiTop + 5, false, 421752); String[] split = containerName.split(" "); if (split.length >= 1) { - Utils.drawStringF(split[split.length - 1], Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringF(split[split.length - 1], guiLeft + 167 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length - 1]), guiTop + 5, false, 4210752 ); @@ -692,31 +685,19 @@ public class TradeWindow { Utils.drawStringCentered( EnumChatFormatting.DARK_RED + "Check " + EnumChatFormatting.BOLD + (char) (9311 + num), - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 56, - guiTop + 99, + guiLeft + 56, guiTop + 99, false, 4210752 ); } else if (confirmDisplay.equals(EnumChatFormatting.AQUA + "Gift!")) { - Utils.drawStringCentered( - EnumChatFormatting.GREEN + "Accept", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 56, - guiTop + 99, - true, - 4210752 - ); + Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accept", guiLeft + 56, guiTop + 99, true, 4210752); } else if (confirmDisplay.equals(EnumChatFormatting.GREEN + "Deal accepted!")) { - Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accepted", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 56, guiTop + 99, true, 4210752 - ); + Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accepted", guiLeft + 56, guiTop + 99, true, 4210752); } else if (lastTradeMillis > 0) { long delta = System.currentTimeMillis() - lastTradeMillis; if (delta > 2000) { Utils.drawStringCentered( EnumChatFormatting.GREEN + "Accept", - Minecraft.getMinecraft().fontRendererObj, guiLeft + 56, guiTop + 99, true, @@ -725,7 +706,6 @@ public class TradeWindow { } else { Utils.drawStringCentered( EnumChatFormatting.YELLOW + "Trade " + EnumChatFormatting.BOLD + (char) (9312 + (2000 - delta) / 1000), - Minecraft.getMinecraft().fontRendererObj, guiLeft + 56, guiTop + 99, true, @@ -735,7 +715,6 @@ public class TradeWindow { } else { Utils.drawStringCentered( EnumChatFormatting.YELLOW + "Trade " + EnumChatFormatting.BOLD + (char) (9314), - Minecraft.getMinecraft().fontRendererObj, guiLeft + 56, guiTop + 99, true, @@ -764,32 +743,11 @@ public class TradeWindow { ); if (confirmDisplay.equals(EnumChatFormatting.YELLOW + "Pending their confirm")) { - Utils.drawStringCentered( - EnumChatFormatting.YELLOW + "Pending", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 120, - guiTop + 99, - true, - 4210752 - ); + Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Pending", guiLeft + 120, guiTop + 99, true, 4210752); } else if (confirmDisplay.equals(EnumChatFormatting.YELLOW + "Deal timer...")) { - Utils.drawStringCentered( - EnumChatFormatting.YELLOW + "Pending", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 120, - guiTop + 99, - true, - 4210752 - ); + Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Pending", guiLeft + 120, guiTop + 99, true, 4210752); } else if (confirmDisplay.equals(EnumChatFormatting.GREEN + "Other player confirmed!")) { - Utils.drawStringCentered( - EnumChatFormatting.GREEN + "Accepted", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 120, - guiTop + 99, - true, - 4210752 - ); + Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accepted", guiLeft + 120, guiTop + 99, true, 4210752); } } @@ -1041,8 +999,7 @@ public class TradeWindow { mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), - tooltipLen, - Minecraft.getMinecraft().fontRendererObj + tooltipLen ); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java index 4dbe7f94..deef7bdc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java @@ -37,6 +37,7 @@ import io.github.moulberry.notenoughupdates.util.ItemUtils; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiContainer; @@ -539,7 +540,8 @@ public class GuiCustomHex extends Gui { if (enchanterCurrentEnch == null) { enchanterCurrentEnch = enchantment; } else if (updateLevel) { - if (removingEnchantPlayerLevel < 0 && enchantment.level > enchanterCurrentEnch.level && !aboveMaxLevelFromEt) { + if (removingEnchantPlayerLevel < 0 && enchantment.level > enchanterCurrentEnch.level && + !aboveMaxLevelFromEt) { enchanterCurrentEnch = enchantment; } else if (removingEnchantPlayerLevel >= 0 && enchantment.level < enchanterCurrentEnch.level) { enchanterCurrentEnch = enchantment; @@ -1286,14 +1288,15 @@ public class GuiCustomHex extends Gui { renderBaseTexture(); - Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); - Minecraft.getMinecraft().fontRendererObj.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false); + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); + fr.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false); //Page Text if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) { String pageStr = "Page: " + currentPage + "/" + expectedMaxPage; - int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr); - Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj, + int pageStrLen = fr.getStringWidth(pageStr); + Utils.drawStringCentered(pageStr, guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040 ); @@ -1318,10 +1321,10 @@ public class GuiCustomHex extends Gui { //Can't be enchanted text if (currentState == EnchantState.INVALID_ITEM) { GlStateManager.disableDepth(); - Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("This item can't", guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555 ); - Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("be enchanted", guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555 ); GlStateManager.enableDepth(); @@ -1332,52 +1335,24 @@ public class GuiCustomHex extends Gui { //Text if no enchants appear if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) { if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromApplicable) { - Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555 - ); - Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555 - ); + Utils.drawStringCentered("Can't find that", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchant, perhaps", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("it is on", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555); + Utils.drawStringCentered("another page?", guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555); } else if (applicable.isEmpty() && !searchRemovedFromApplicable) { - Utils.drawStringCentered("No applicable", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555 - ); + Utils.drawStringCentered("No applicable", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchants on", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("this page...", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555); } if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromRemovable) { - Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555 - ); - Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555 - ); + Utils.drawStringCentered("Can't find that", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchant, perhaps", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("it is on", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555); + Utils.drawStringCentered("another page?", guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555); } else if (removable.isEmpty() && !searchRemovedFromRemovable) { - Utils.drawStringCentered("No removable", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555 - ); - Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555 - ); - Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj, - guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555 - ); + Utils.drawStringCentered("No removable", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555); + Utils.drawStringCentered("enchants on", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555); + Utils.drawStringCentered("this page...", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555); } } //Available enchants (left) @@ -1413,50 +1388,14 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString( - ench.enchantName, - guiLeft + 8 + 16 + 2 + textOffset, - top + 4 + textOffset, - 0xffffffdd, - true - ); + fr.drawString(ench.enchantName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); @@ -1493,51 +1432,19 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString(ench.enchantName, - guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true - ); + fr.drawString(ench.enchantName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); //Player Inventory Items - Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory + fr.drawString(Minecraft.getMinecraft().thePlayer.inventory .getDisplayName() .getUnformattedText(), guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040 @@ -1580,7 +1487,7 @@ public class GuiCustomHex extends Gui { searchField.setPrependText("\u00a77Search..."); } else { if (searchField.getFocus()) { - int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(searchField.getTextDisplay()) + 10; + int len = fr.getStringWidth(searchField.getTextDisplay()) + 10; searchField.setSize(Math.max(90, len), 14); } else { searchField.setSize(90, 14); @@ -1618,78 +1525,24 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false); String priceStr = "" + numberFormat.format(enchanterCurrentEnch.price) + " Coins"; if (enchanterCurrentEnch.price < 0) priceStr = ""; - int priceWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(priceStr); + int priceWidth = fr.getStringWidth(priceStr); int priceTop = guiTop + 16; int x = 180; int color = 0x2d2102; - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2 - 1, - priceTop + 4, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2 + 1, - priceTop + 4, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2, - priceTop + 4 - 1, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2, - priceTop + 4 + 1, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2, - priceTop + 4, - 0xfcba03, - false - ); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2 - 1, priceTop + 4, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2 + 1, priceTop + 4, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 - 1, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 + 1, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4, 0xfcba03, false); //Enchant name String name = WordUtils.capitalizeFully(ItemUtils @@ -1706,14 +1559,7 @@ public class GuiCustomHex extends Gui { } else if (name.equalsIgnoreCase("Turbo Mushrooms")) { name = "Turbo-Mush"; } - Utils.drawStringCentered( - name, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2, - top + 8, - true, - 0xffffffdd - ); + Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd); if (isChangingEnchLevel) { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); @@ -1726,42 +1572,12 @@ public class GuiCustomHex extends Gui { //Enchant level levelStr = "" + enchanterCurrentEnch.level; if (enchanterCurrentEnch.xpCost < 0) levelStr = "?"; - levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4, - 0xea82ff, - false - ); + levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4, 0xea82ff, false); //Confirm button @@ -1781,7 +1597,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040 ); } else { @@ -1790,7 +1606,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040 ); @@ -1806,7 +1622,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040 ); } else { @@ -1815,7 +1631,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040 ); } @@ -1890,42 +1706,12 @@ public class GuiCustomHex extends Gui { ); levelStr = "" + ench.level; - levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 - 1, - top + 16 * yIndex + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 + 1, - top + 16 * yIndex + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 16 * yIndex + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 16 * yIndex + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 16 * yIndex + 4, - 0xea82ff, - false - ); + levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 16 * yIndex + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 16 * yIndex + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4, 0xea82ff, false); } GlStateManager.enableDepth(); } @@ -2034,14 +1820,15 @@ public class GuiCustomHex extends Gui { renderBaseTexture(); - Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); - Minecraft.getMinecraft().fontRendererObj.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false); + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); + fr.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false); //Page Text /*if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) { String pageStr = "Page: " + currentPage + "/" + expectedMaxPage; int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr); - Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered(pageStr, guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040 ); @@ -2066,10 +1853,10 @@ public class GuiCustomHex extends Gui { //Can't be enchanted text /*if (currentState == EnchantState.INVALID_ITEM) { GlStateManager.disableDepth(); - Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("This item can't", guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555 ); - Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("be enchanted", guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555 ); GlStateManager.enableDepth(); @@ -2081,50 +1868,50 @@ public class GuiCustomHex extends Gui { if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT || currentState == EnchantState.HAS_ITEM_IN_BOOKS || currentState == EnchantState.ADDING_BOOK) { if (applicableItem.isEmpty() && removableItem.isEmpty() && searchRemovedFromApplicable) { - Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Can't find that", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555 ); - Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("enchant, perhaps", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555 ); - Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("it is on", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555 ); - Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("another page?", guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555 ); } else if (applicableItem.isEmpty() && !searchRemovedFromApplicable) { - Utils.drawStringCentered("No applicable", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("No applicable", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555 ); - Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("enchants on", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555 ); - Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("this page...", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555 ); } if (applicableItem.isEmpty() && removableItem.isEmpty() && searchRemovedFromRemovable) { - Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Can't find that", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555 ); - Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("enchant, perhaps", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555 ); - Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("it is on", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555 ); - Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("another page?", guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555 ); } else if (removableItem.isEmpty() && !searchRemovedFromRemovable) { - Utils.drawStringCentered("No removable", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("No removable", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555 ); - Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("enchants on", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555 ); - Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("this page...", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555 ); } @@ -2162,50 +1949,14 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString( - item.itemName, - guiLeft + 8 + 16 + 2 + textOffset, - top + 4 + textOffset, - 0xffffffdd, - true - ); + fr.drawString(item.itemName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); @@ -2241,51 +1992,19 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; }*/ - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString(item.itemName, - guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true - ); + fr.drawString(item.itemName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); //Player Inventory Items - Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory + fr.drawString(Minecraft.getMinecraft().thePlayer.inventory .getDisplayName() .getUnformattedText(), guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040 @@ -2328,7 +2047,7 @@ public class GuiCustomHex extends Gui { searchField.setPrependText("\u00a77Search..."); } else { if (searchField.getFocus()) { - int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(searchField.getTextDisplay()) + 10; + int len = fr.getStringWidth(searchField.getTextDisplay()) + 10; searchField.setSize(Math.max(90, len), 14); } else { searchField.setSize(90, 14); @@ -2359,57 +2078,20 @@ public class GuiCustomHex extends Gui { String priceStr = "" + numberFormat.format(enchanterCurrentItem.getPrice()) + " Coins"; if (enchanterCurrentItem.price < 0) priceStr = ""; - int priceWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(priceStr); + int priceWidth = fr.getStringWidth(priceStr); int priceTop = guiTop + 10; int x = 180; int color = 0x2d2102; - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2 - 1, - priceTop + 4, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2 + 1, - priceTop + 4, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2, - priceTop + 4 - 1, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2, - priceTop + 4 + 1, - color, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - priceStr, - guiLeft + x - priceWidth / 2, - priceTop + 4, - 0xfcba03, - false - ); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2 - 1, priceTop + 4, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2 + 1, priceTop + 4, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 - 1, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 + 1, color, false); + fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4, 0xfcba03, false); //Enchant name String name = WordUtils.capitalizeFully(enchanterCurrentItem.itemId.replace("_", " ")); name = fixName(name); - Utils.drawStringCentered( - name, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2, - top + 8, - true, - 0xffffffdd - ); + Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd); //Confirm button String confirmText = "Apply"; @@ -2428,7 +2110,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040 ); } else { @@ -2437,7 +2119,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040 ); @@ -2453,7 +2135,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040 ); } else { @@ -2462,7 +2144,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040 ); } @@ -2574,7 +2256,8 @@ public class GuiCustomHex extends Gui { renderBaseTexture(); - Minecraft.getMinecraft().fontRendererObj.drawString("The Hex", guiLeft + 7, guiTop + 7, 0x404040, false); + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("The Hex", guiLeft + 7, guiTop + 7, 0x404040, false); //Minecraft.getMinecraft().fontRendererObj.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false); tooltipToDisplay = renderSettings(mouseX, mouseY, tooltipToDisplay); @@ -2587,10 +2270,10 @@ public class GuiCustomHex extends Gui { //Can't be enchanted text if (currentState == EnchantState.INVALID_ITEM_HEX) { GlStateManager.disableDepth(); - Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("This item can't", guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555 ); - Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("be enchanted", guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555 ); GlStateManager.enableDepth(); @@ -2631,50 +2314,14 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString( - item.itemName, - guiLeft + 8 + 16 + 2 + textOffset, - top + 4 + textOffset, - 0xffffffdd, - true - ); + fr.drawString(item.itemName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); @@ -2710,53 +2357,20 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString(item.itemName, - guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true - ); + fr.drawString(item.itemName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); //Player Inventory Items - Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory - .getDisplayName() - .getUnformattedText(), + fr.drawString( + Minecraft.getMinecraft().thePlayer.inventory.getDisplayName().getUnformattedText(), guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040 ); int inventoryStartIndex = cc.getLowerChestInventory().getSizeInventory(); @@ -2918,14 +2532,15 @@ public class GuiCustomHex extends Gui { renderBaseTexture(); - Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); - Minecraft.getMinecraft().fontRendererObj.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false); + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false); + fr.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false); //Page Text if (currentState == EnchantState.ADDING_GEMSTONE || currentState == EnchantState.APPLYING_GEMSTONE) { String pageStr = "Page: " + currentPage + "/" + expectedMaxPage; - int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr); - Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj, + int pageStrLen = fr.getStringWidth(pageStr); + Utils.drawStringCentered(pageStr, guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040 ); @@ -2960,7 +2575,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040 ); } else { @@ -2969,7 +2584,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040 ); } @@ -2983,7 +2598,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040 ); } else { @@ -2992,7 +2607,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040 ); } @@ -3040,50 +2655,14 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 16 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString( - item.itemName, - guiLeft + 8 + 16 + 2 + textOffset, - top + 4 + textOffset, - 0xffffffdd, - true - ); + fr.drawString(item.itemName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); @@ -3119,51 +2698,19 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - guiLeft + 256 - levelWidth / 2, - top + 4, - colour, - false - ); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false); - Minecraft.getMinecraft().fontRendererObj.drawString(item.itemName, - guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true - ); + fr.drawString(item.itemName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true); } GlScissorStack.pop(scaledResolution); //Player Inventory Items - Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory + fr.drawString(Minecraft.getMinecraft().thePlayer.inventory .getDisplayName() .getUnformattedText(), guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040 @@ -3286,36 +2833,12 @@ public class GuiCustomHex extends Gui { colour = 0xff5555; } - int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 8 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false); + int levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false); //Enchant name String name = WordUtils.capitalizeFully(enchanterCurrentItem.itemName); @@ -3330,14 +2853,7 @@ public class GuiCustomHex extends Gui { } else if (name.equalsIgnoreCase("Turbo Mushrooms")) { name = "Turbo-Mush"; } - Utils.drawStringCentered( - name, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2, - top + 8, - true, - 0xffffffdd - ); + Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd); if (isChangingEnchLevel) { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); @@ -3349,42 +2865,12 @@ public class GuiCustomHex extends Gui { //Enchant level levelStr = ""; - levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 - 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2 + 1, - top + 4, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4 - 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4 + 1, - 0x2d2102, - false - ); - Minecraft.getMinecraft().fontRendererObj.drawString( - levelStr, - left + 96 + 8 - levelWidth / 2, - top + 4, - 0xea82ff, - false - ); + levelWidth = fr.getStringWidth(levelStr); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false); + fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4, 0xea82ff, false); } if (!isChangingEnchLevel && itemHoverX >= 0 && itemHoverY >= 0) { @@ -3604,7 +3090,8 @@ public class GuiCustomHex extends Gui { Gui.drawRect(guiLeft + 295 + 18, guiTop + 147, guiLeft + 295 + 16 + 18, guiTop + 147 + 16, 0x80ffffff); tooltipToDisplay = createTooltip("Max Level", (NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel ? 0 : 1), - "Enabled", "Disabled"); + "Enabled", "Disabled" + ); tooltipToDisplay.add(1, EnumChatFormatting.GRAY + "Show max level of enchant"); tooltipToDisplay.add(2, EnumChatFormatting.GRAY + "from either hex or enchantment table"); tooltipToDisplay.add(3, EnumChatFormatting.GRAY + "max level"); @@ -3700,18 +3187,14 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040 - ); + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040); } else { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14, 0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST ); - Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj, - guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040 - ); + Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040); } } @@ -3735,9 +3218,7 @@ public class GuiCustomHex extends Gui { Utils.drawItemStack(stackOnMouse, mouseX - 8, mouseY - 8); } } else if (tooltipToDisplay != null) { - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } } @@ -4380,7 +3861,8 @@ public class GuiCustomHex extends Gui { break; } case 1: { - NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel = !NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel; + NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel = + !NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel; break; } case 2: { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java index 84678c0c..a3549d51 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java @@ -68,9 +68,7 @@ public class MinionHelperOverlayHover { OverviewLine mouseObject = overlay.getObjectOverMouse(renderMap); if (mouseObject != null) { - Utils.drawHoveringText(getTooltip(mouseObject), mouseX, mouseY, - scaledWidth, scaledHeight, -1, Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(getTooltip(mouseObject), mouseX, mouseY, scaledWidth, scaledHeight, -1); } renderButtons(); @@ -90,7 +88,6 @@ public class MinionHelperOverlayHover { int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; - int x = guiLeft + xSize + 4 + 149 - 3; int y = guiTop + 109 - 3; if (mouseX > x && mouseX < x + 16 && @@ -122,9 +119,7 @@ public class MinionHelperOverlayHover { list.add(""); list.add("§eClick to toggle!"); - Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1); } private void renderBuyPriceButton(int scaledWidth, int scaledHeight, int mouseX, int mouseY) { @@ -145,9 +140,7 @@ public class MinionHelperOverlayHover { list.add(""); list.add("§eClick to toggle!"); - Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1); } private List<String> getTooltip(OverviewLine overviewLine) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java index fe1f0af4..677e5822 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java @@ -34,7 +34,6 @@ import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -289,15 +288,9 @@ public class NEUConfigEditor extends GuiElement { RenderUtils.drawFloatingRectDark(x + 5, y + 5, xSize - 10, 20, false); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; TextRenderUtils.drawStringCenteredScaledMaxWidth( "NotEnoughUpdates by " + EnumChatFormatting.DARK_PURPLE + "Moulberry", - fr, - x + xSize / 2, - y + 15, - false, - 200, - 0xa0a0a0 + x + xSize / 2, y + 15, false, 200, 0xa0a0a0 ); RenderUtils.drawFloatingRectDark(x + 4, y + 49 - 20, @@ -334,9 +327,7 @@ public class NEUConfigEditor extends GuiElement { } else { catName = EnumChatFormatting.GRAY + catName; } - TextRenderUtils.drawStringCenteredScaledMaxWidth(catName, - fr, x + 75, y + 70 + catY, false, 100, -1 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(catName, x + 75, y + 70 + catY, false, 100, -1); catY += 15; if (catY > 0) { catBarSize = @@ -366,9 +357,7 @@ public class NEUConfigEditor extends GuiElement { GlScissorStack.pop(scaledResolution); - TextRenderUtils.drawStringCenteredScaledMaxWidth("Categories", - fr, x + 75, y + 44, false, 120, 0xa368ef - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth("Categories", x + 75, y + 44, false, 120, 0xa368ef); RenderUtils.drawFloatingRectDark(x + 149, y + 29, xSize - 154, ySize - 34, false); @@ -405,8 +394,9 @@ public class NEUConfigEditor extends GuiElement { if (getSelectedCategory() != null && currentConfigEditing.containsKey(getSelectedCategory())) { ConfigProcessor.ProcessedCategory cat = currentConfigEditing.get(getSelectedCategory()); - TextRenderUtils.drawStringScaledMaxWidth(cat.desc, - fr, innerLeft + 5, y + 40, true, innerRight - innerLeft - rightStuffLen - 10, 0xb0b0b0 + TextRenderUtils.drawStringScaledMaxWidth( + cat.desc, + innerLeft + 5, y + 40, true, innerRight - innerLeft - rightStuffLen - 10, 0xb0b0b0 ); } @@ -552,7 +542,9 @@ public class NEUConfigEditor extends GuiElement { GlScissorStack.clear(); if (tooltipToDisplay != null) { - TextRenderUtils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + TextRenderUtils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, + Minecraft.getMinecraft().fontRendererObj + ); } GlStateManager.translate(0, 0, -2); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index fcea79dd..942eee8b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -274,15 +274,7 @@ public class AuctionSearchOverlay { } if (tooltipToDisplay != null) { - Utils.drawHoveringText( - tooltipToDisplay, - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java index 66dacda3..dab9156e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java @@ -225,15 +225,7 @@ public class BazaarSearchOverlay { } if (tooltipToDisplay != null) { - Utils.drawHoveringText( - tooltipToDisplay, - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java index db81bfa4..a812ff52 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java @@ -34,7 +34,6 @@ import io.github.moulberry.notenoughupdates.util.ItemUtils; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.gui.inventory.GuiInventory; @@ -108,7 +107,9 @@ public class EquipmentOverlay { case 2: return ARMOR_DISPLAY_DARK; case 3: - return NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3 && isPetRendering ? ARMOR_DISPLAY_TRANSPARENT_PET : ARMOR_DISPLAY_TRANSPARENT; + return NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3 && isPetRendering + ? ARMOR_DISPLAY_TRANSPARENT_PET + : ARMOR_DISPLAY_TRANSPARENT; case 4: return ARMOR_DISPLAY_FSR; } @@ -142,7 +143,6 @@ public class EquipmentOverlay { public static final int PET_OVERLAY_OFFSET_Y = ARMOR_OVERLAY_HEIGHT - 14 /* overlaying pixels */; //</editor-fold> - public boolean shouldRenderPets; public boolean shouldRenderArmorHud; @@ -229,12 +229,7 @@ public class EquipmentOverlay { )) { Utils.drawHoveringText( tooltipToDisplay, - mouseX - calculateTooltipXOffset(tooltipToDisplay, Minecraft.getMinecraft().fontRendererObj), - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj + mouseX - calculateTooltipXOffset(tooltipToDisplay), mouseY, width, height, -1 ); } @@ -263,7 +258,8 @@ public class EquipmentOverlay { slot4 = getWardrobeSlot(37); } - if ((screen instanceof GuiChest || screen instanceof GuiInventory) && NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay){ + if ((screen instanceof GuiChest || screen instanceof GuiInventory) && + NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay) { petStack = getRepoPetStack(); } if ((!(screen instanceof GuiInventory) && !(screen instanceof GuiInvButtonEditor)) @@ -321,12 +317,8 @@ public class EquipmentOverlay { tooltipToDisplay = petInfo.getTooltip(Minecraft.getMinecraft().thePlayer, false); Utils.drawHoveringText( tooltipToDisplay, - mouseX - calculateTooltipXOffset(tooltipToDisplay, Minecraft.getMinecraft().fontRendererObj), - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj + mouseX - calculateTooltipXOffset(tooltipToDisplay), + mouseY, width, height, -1 ); } } @@ -413,14 +405,13 @@ public class EquipmentOverlay { * Calculates the width of the longest String in the tooltip, which can be used to offset the entire tooltip to the left more precisely * * @param tooltipToDisplay tooltip - * @param fr FontRenderer object * @return offset to apply */ - private int calculateTooltipXOffset(List<String> tooltipToDisplay, FontRenderer fr) { + private int calculateTooltipXOffset(List<String> tooltipToDisplay) { int offset = 0; if (tooltipToDisplay != null) { for (String line : tooltipToDisplay) { - int lineWidth = fr.getStringWidth(line); + int lineWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line); if (lineWidth > offset) { offset = lineWidth; } @@ -430,7 +421,8 @@ public class EquipmentOverlay { } public void renderPreviewArmorHud() { - if (!NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud || !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return; + if (!NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud || + !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return; GuiInvButtonEditor container = (GuiInvButtonEditor) Minecraft.getMinecraft().currentScreen; int overlayLeft = container.getGuiLeft() - ARMOR_OVERLAY_OVERHAND_WIDTH; @@ -443,7 +435,8 @@ public class EquipmentOverlay { } public void renderPreviewPetInvHud() { - if (!NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay || !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return; + if (!NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay || + !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return; GuiInvButtonEditor container = (GuiInvButtonEditor) Minecraft.getMinecraft().currentScreen; int overlayLeft = container.getGuiLeft() - ARMOR_OVERLAY_OVERHAND_WIDTH; int overlayTop = container.getGuiTop() + PET_OVERLAY_OFFSET_Y; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java index 2a30f6f1..22f6eb96 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java @@ -92,14 +92,7 @@ public class RancherBootOverlay { selectedIndex == i ? 0xff0000ff : 0xff808080 ); Utils.drawItemStack(new ItemStack(Items.carrot), iconsLeft + i * 25 + 2, topY + 25 + 2); - Utils.drawStringCentered( - "" + currentSpeeds.get(i), - Minecraft.getMinecraft().fontRendererObj, - iconsLeft + i * 25 + 10, - topY + 52, - true, - 0xffffffff - ); + Utils.drawStringCentered("" + currentSpeeds.get(i), iconsLeft + i * 25 + 10, topY + 52, true, 0xffffffff); //Minecraft.getMinecraft().fontRendererObj.drawString("\u2710", iconsLeft+i*25+15, topY+40, 0xffffff, false); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index 5939e122..266722e5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -317,19 +317,13 @@ public class BasicPage extends GuiProfileViewerPage { int offset = (fontWidth >= 117 ? 63 + (fontWidth - 117) : 63); if (networth > 0) { if (fontWidth >= 117) { - fr.drawString(EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD + GuiProfileViewer.numberFormat.format(networth), guiLeft + 8, guiTop + 38 - fr.FONT_HEIGHT / 2f, 0, true); - } else { Utils.drawStringCentered( EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD + GuiProfileViewer.numberFormat.format(networth), - fr, - guiLeft + 68, - guiTop + 38, - true, - 0 + guiLeft + 68, guiTop + 38, true, 0 ); } if (NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE") != null && @@ -400,11 +394,7 @@ public class BasicPage extends GuiProfileViewerPage { } else { Utils.drawStringCentered( EnumChatFormatting.GREEN + "Net Worth: " + stateStr, - fr, - guiLeft + 63, - guiTop + 38, - true, - 0 + guiLeft + 63, guiTop + 38, true, 0 ); } } @@ -440,7 +430,7 @@ public class BasicPage extends GuiProfileViewerPage { statusStr += EnumChatFormatting.GRAY + " - " + EnumChatFormatting.GREEN + locationStr; } - Utils.drawStringCentered(statusStr, fr, guiLeft + 63, guiTop + 160, true, 0); + Utils.drawStringCentered(statusStr, guiLeft + 63, guiTop + 160, true, 0); } if (entityPlayer == null) { @@ -600,14 +590,14 @@ public class BasicPage extends GuiProfileViewerPage { GlStateManager.scale(1.5f, 1.5f, 1); Utils.drawItemStack(skull, 0, 0); GlStateManager.popMatrix(); - Utils.drawStringCenteredScaled(skyblockLevelColour.toString() + (int) skyblockLevel, fr, + Utils.drawStringCenteredScaled(skyblockLevelColour.toString() + (int) skyblockLevel, sbLevelX + 9, sbLevelY - 12, true, 1.5f ); float progress = (float) (skyblockLevel - (long) skyblockLevel); getInstance().renderBar(sbLevelX - 30, sbLevelY + 30, 80, progress); - Utils.drawStringScaled(EnumChatFormatting.YELLOW.toString() + (int) (progress * 100) + "/100", fr, + Utils.drawStringScaled(EnumChatFormatting.YELLOW.toString() + (int) (progress * 100) + "/100", sbLevelX - 30, sbLevelY + 20, true, 0, 0.9f ); @@ -723,11 +713,7 @@ public class BasicPage extends GuiProfileViewerPage { } else { Utils.drawStringCentered( EnumChatFormatting.RED + "Skills API not enabled!", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 322, - guiTop + 101, - true, - 0 + guiLeft + 322, guiTop + 101, true, 0 ); } @@ -808,11 +794,7 @@ public class BasicPage extends GuiProfileViewerPage { "Senither Weight: " + EnumChatFormatting.GOLD + GuiProfileViewer.numberFormat.format(roundToNearestInt(senitherWeight.getTotalWeight().getRaw())), - fr, - guiLeft + 63, - guiTop + 18, - true, - 0 + guiLeft + 63, guiTop + 18, true, 0 ); int textWidth = fr.getStringWidth( @@ -873,14 +855,9 @@ public class BasicPage extends GuiProfileViewerPage { Utils.drawStringCentered( EnumChatFormatting.GREEN + - "Lily Weight: " + - EnumChatFormatting.GOLD + + "Lily Weight: " + EnumChatFormatting.GOLD + GuiProfileViewer.numberFormat.format(roundToNearestInt(lilyWeight.getTotalWeight().getRaw())), - fr, - guiLeft + 63, - guiTop + 28, - true, - 0 + guiLeft + 63, guiTop + 28, true, 0 ); int fontWidth = fr.getStringWidth( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java index ab80afab..cc5fc92f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java @@ -126,15 +126,7 @@ public class BingoPage extends GuiProfileViewerPage { y = communityGoal ? y - 1 : y; if (mouseX >= x && mouseX < x + 24) { if (mouseY >= y && mouseY <= y + 24) { - Utils.drawHoveringText( - getTooltip(bingoGoal, completed, communityGoal), - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(getTooltip(bingoGoal, completed, communityGoal), mouseX, mouseY, width, height, -1); } } col++; @@ -161,15 +153,8 @@ public class BingoPage extends GuiProfileViewerPage { EnumChatFormatting.WHITE + 20; } - Utils.drawStringF(totalPointsString, Minecraft.getMinecraft().fontRendererObj, guiLeft + 22, guiTop + 19, true, 0); - Utils.drawStringF( - personalGoalsString, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 22, - guiTop + 31, - true, - 0 - ); + Utils.drawStringF(totalPointsString, guiLeft + 22, guiTop + 19, true, 0); + Utils.drawStringF(personalGoalsString, guiLeft + 22, guiTop + 31, true, 0); GlStateManager.enableLighting(); } @@ -299,14 +284,7 @@ public class BingoPage extends GuiProfileViewerPage { private void showMissingDataMessage(int guiLeft, int guiTop) { String message = EnumChatFormatting.RED + "No Bingo data for current event!"; - Utils.drawStringCentered( - message, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 431 / 2f, - guiTop + 101, - true, - 0 - ); + Utils.drawStringCentered(message, guiLeft + 431 / 2f, guiTop + 101, true, 0); } private List<String> jsonArrayToStringList(JsonArray completedGoals) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java index 45d9370b..03be7cf1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java @@ -36,9 +36,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.io.IOException; -import java.math.BigDecimal; import java.math.BigInteger; -import java.math.RoundingMode; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Iterator; @@ -96,11 +94,7 @@ public class CollectionsPage extends GuiProfileViewerPage { if (collectionInfo == null) { Utils.drawStringCentered( EnumChatFormatting.RED + "Collection API not enabled!", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 134, - guiTop + 101, - true, - 0 + guiLeft + 134, guiTop + 101, true, 0 ); return; } @@ -195,11 +189,7 @@ public class CollectionsPage extends GuiProfileViewerPage { Utils.drawStringCentered( selectedCollectionCategory.getDisplayName() + " Collections", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 134, - guiTop + 14, - true, - 4210752 + guiLeft + 134, guiTop + 14, true, 4210752 ); if (collections != null) { @@ -292,35 +282,16 @@ public class CollectionsPage extends GuiProfileViewerPage { GlStateManager.color(1, 1, 1, 1); if (tier >= 0) { - Utils.drawStringCentered( - tierString, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + x + 10, - guiTop + y - 4, - true, - tierStringColour - ); + Utils.drawStringCentered(tierString, guiLeft + x + 10, guiTop + y - 4, true, tierStringColour); } Utils.drawStringCentered( - StringUtils.shortNumberFormat(amount) + "", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + x + 10, - guiTop + y + 26, - true, - color.getRGB() - ); + StringUtils.shortNumberFormat(amount) + "", guiLeft + x + 10, guiTop + y + 26, true, color.getRGB()); } } Utils.drawStringCentered( - selectedCollectionCategory.getDisplayName() + " Minions", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 326, - guiTop + 14, - true, - 4210752 - ); + selectedCollectionCategory.getDisplayName() + " Minions", guiLeft + 326, guiTop + 14, true, 4210752); if (minions != null) { for (int i = page * 20, j = 0; i < Math.min((page + 1) * 20, minions.size()); i++, j++) { @@ -409,14 +380,7 @@ public class CollectionsPage extends GuiProfileViewerPage { GlStateManager.color(1, 1, 1, 1); if (tier >= 0) { - Utils.drawStringCentered( - tierString, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + x + 10, - guiTop + y - 4, - true, - tierStringColour - ); + Utils.drawStringCentered(tierString, guiLeft + x + 10, guiTop + y - 4, true, tierStringColour); } } } @@ -426,15 +390,7 @@ public class CollectionsPage extends GuiProfileViewerPage { for (String line : tooltipToDisplay) { grayTooltip.add(EnumChatFormatting.GRAY + line); } - Utils.drawHoveringText( - grayTooltip, - mouseX, - mouseY, - getInstance().width, - getInstance().height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(grayTooltip, mouseX, mouseY, getInstance().width, getInstance().height, -1); tooltipToDisplay = null; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java index 6460003a..454ad989 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java @@ -109,11 +109,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage { if (profileInfo == null || !profileInfo.has("nether_island_player_data")) { Utils.drawStringCentered( EnumChatFormatting.RED + "No data found for the Crimson Isles", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 431 / 2f, - guiTop + 101, - true, - 0 + guiLeft + 431 / 2f, guiTop + 101, true, 0 ); return; } @@ -137,14 +133,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage { } public void drawKuudraStats(JsonObject data, int guiLeft, int guiTop, int mouseX, int mouseY) { - Utils.drawStringCentered( - EnumChatFormatting.RED + "Kuudra Stats", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + (431 * 0.18f), - guiTop + 14, - true, - 0 - ); + Utils.drawStringCentered(EnumChatFormatting.RED + "Kuudra Stats", guiLeft + (431 * 0.18f), guiTop + 14, true, 0); JsonObject kuudraCompletedTiers = data.getAsJsonObject("kuudra_completed_tiers"); @@ -213,14 +202,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage { } public void drawDojoStats(JsonObject data, int guiLeft, int guiTop) { - Utils.drawStringCentered( - EnumChatFormatting.YELLOW + "Dojo Stats", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + (431 * 0.49f), - guiTop + 14, - true, - 0 - ); + Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Dojo Stats", guiLeft + (431 * 0.49f), guiTop + 14, true, 0); JsonObject dojoStats = data.getAsJsonObject("dojo"); int[] dojoScores = {0, 0, 0, 0, 0, 0, 0}; @@ -298,11 +280,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage { public void drawLastMatriarchAttempt(JsonObject data, int guiLeft, int guiTop) { Utils.drawStringCentered( EnumChatFormatting.GOLD + "Last Matriarch Attempt", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + (431 * 0.82f), - guiTop + 104, - true, - 0 + guiLeft + (431 * 0.82f), guiTop + 104, true, 0 ); JsonObject lastMatriarchAttempt = data.getAsJsonObject("matriarch"); @@ -351,11 +329,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage { public void drawFactionReputation(JsonObject data, int guiLeft, int guiTop) { Utils.drawStringCentered( EnumChatFormatting.DARK_PURPLE + "Faction Reputation", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + (431 * 0.82f), - guiTop + 14, - true, - 0 + guiLeft + (431 * 0.82f), guiTop + 14, true, 0 ); String selectedFaction = data.has("selected_faction") ? data.get("selected_faction").getAsString() : "N/A"; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index c379c7eb..a5229acb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -329,7 +329,6 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 3, 100, 20, 0, 100 / 200f, 0, 20 / 185f, GL11.GL_NEAREST); Utils.drawStringCenteredScaledMaxWidth( profileId, - Minecraft.getMinecraft().fontRendererObj, guiLeft + 50, guiTop + sizeY + 3 + 10, true, @@ -394,7 +393,6 @@ public class GuiProfileViewer extends GuiScreen { ); Utils.drawStringCenteredScaledMaxWidth( "Open in SkyCrypt", - Minecraft.getMinecraft().fontRendererObj, guiLeft + 50 + 100 + 6, guiTop + sizeY + 3 + 10, true, @@ -437,7 +435,6 @@ public class GuiProfileViewer extends GuiScreen { String otherProfileId = profile.getProfileNames().get(yIndex); Utils.drawStringCenteredScaledMaxWidth( otherProfileId, - Minecraft.getMinecraft().fontRendererObj, guiLeft + 50, guiTop + sizeY + 23 + dropdownOptionSize / 2f + dropdownOptionSize * yIndex, true, @@ -529,14 +526,7 @@ public class GuiProfileViewer extends GuiScreen { } } - Utils.drawStringCentered( - str, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 101, - true, - 0 - ); + Utils.drawStringCentered(str, guiLeft + sizeX / 2f, guiTop + 101, true, 0); //This is just here to inform the player what to do //like typing /api new or telling them to go find a psychotherapist @@ -545,37 +535,21 @@ public class GuiProfileViewer extends GuiScreen { if (timeDiff > 20000) { Utils.drawStringCentered( EnumChatFormatting.YELLOW + "Its taking a while...", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 111, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 111, true, 0 ); Utils.drawStringCentered( EnumChatFormatting.YELLOW + "Try \"/api new\".", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 121, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 121, true, 0 ); if (timeDiff > 60000) { Utils.drawStringCentered( EnumChatFormatting.YELLOW + "Might be hypixel's fault.", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 131, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 131, true, 0 ); if (timeDiff > 180000) { Utils.drawStringCentered( EnumChatFormatting.YELLOW + "Wow you're still here?", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 141, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 141, true, 0 ); if (timeDiff > 360000) { long second = (timeDiff / 1000) % 60; @@ -585,58 +559,32 @@ public class GuiProfileViewer extends GuiScreen { String time = String.format("%02d:%02d:%02d", hour, minute, second); Utils.drawStringCentered( EnumChatFormatting.YELLOW + "You've wasted your time here for: " + time, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 151, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 151, true, 0 ); Utils.drawStringCentered( EnumChatFormatting.YELLOW + "" + EnumChatFormatting.BOLD + "What are you doing with your life?", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 161, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 161, true, 0 ); if (timeDiff > 600000) { Utils.drawStringCentered( EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "Maniac", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 171, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 171, true, 0 ); if (timeDiff > 1200000) { Utils.drawStringCentered( EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You're a menace to society", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 181, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 181, true, 0 ); if (timeDiff > 1800000) { Utils.drawStringCentered( - EnumChatFormatting.RED + - "" + - EnumChatFormatting.BOLD + + EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You don't know what's gonna happen to you", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 191, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 191, true, 0 ); if (timeDiff > 3000000) { Utils.drawStringCentered( EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You really want this?", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 91, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 91, true, 0 ); if (timeDiff > 3300000) { Utils.drawStringCentered( @@ -644,11 +592,7 @@ public class GuiProfileViewer extends GuiScreen { "" + EnumChatFormatting.BOLD + "OW LORD FORGIVE ME FOR THIS", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 71, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 71, true, 0 ); if (timeDiff > 3600000) { throw new Error("Go do something productive") { @@ -672,21 +616,13 @@ public class GuiProfileViewer extends GuiScreen { case INVALID_NAME: Utils.drawStringCentered( EnumChatFormatting.RED + "Invalid name or API is down!", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 101, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 101, true, 0 ); break; case NO_SKYBLOCK: Utils.drawStringCentered( EnumChatFormatting.RED + "No SkyBlock data found!", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + sizeX / 2f, - guiTop + 101, - true, - 0 + guiLeft + sizeX / 2f, guiTop + 101, true, 0 ); break; } @@ -727,7 +663,7 @@ public class GuiProfileViewer extends GuiScreen { for (String line : tooltipToDisplay) { grayTooltip.add(EnumChatFormatting.GRAY + line); } - Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); + Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1); tooltipToDisplay = null; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java index 164f5d78..29f84a5b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java @@ -350,21 +350,10 @@ public class InventoriesPage extends GuiProfileViewerPage { strToRender = "Inventory API not enabled"; Utils.drawStringCentered( EnumChatFormatting.RED + "Or has no backpacks!", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 317, - guiTop + 112, - true, - 0 + guiLeft + 317, guiTop + 112, true, 0 ); } - Utils.drawStringCentered( - EnumChatFormatting.RED + strToRender, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 317, - guiTop + 101, - true, - 0 - ); + Utils.drawStringCentered(EnumChatFormatting.RED + strToRender, guiLeft + 317, guiTop + 101, true, 0); return; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java index c8ec09d3..a9dade6a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java @@ -1453,15 +1453,7 @@ public class MiningPage extends GuiProfileViewerPage { GlStateManager.enableLighting(); if (mouseX >= xPosition && mouseX < xPosition + 16) { if (mouseY >= yPosition && mouseY <= yPosition + 16) { - Utils.drawHoveringText( - tooltip, - mouseX, - mouseY, - getInstance().width, - getInstance().height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltip, mouseX, mouseY, getInstance().width, getInstance().height, -1); } } } @@ -1519,15 +1511,7 @@ public class MiningPage extends GuiProfileViewerPage { GlStateManager.enableLighting(); if (mouseX >= xPosition && mouseX < xPosition + 16) { if (mouseY >= yPosition && mouseY <= yPosition + 16) { - Utils.drawHoveringText( - tooltip, - mouseX, - mouseY, - getInstance().width, - getInstance().height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(tooltip, mouseX,mouseY, getInstance().width, getInstance().height, -1); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java index 098c252e..a56662e7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java @@ -148,14 +148,7 @@ public class PetsPage extends GuiProfileViewerPage { Minecraft.getMinecraft().getTextureManager().bindTexture(pv_pets); Utils.drawTexturedRect(guiLeft, guiTop, getInstance().sizeX, getInstance().sizeY, GL11.GL_NEAREST); - Utils.drawStringCentered( - EnumChatFormatting.DARK_PURPLE + "Pets", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 100, - guiTop + 14, - true, - 4210752 - ); + Utils.drawStringCentered(EnumChatFormatting.DARK_PURPLE + "Pets", guiLeft + 100, guiTop + 14, true, 4210752); GlStateManager.color(1, 1, 1, 1); JsonElement activePetElement = petsInfo.get("active_pet"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java index 7da6c627..81b99948 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java @@ -219,18 +219,14 @@ public class BestiaryPage extends GuiProfileViewerPage { GlStateManager.color(1, 1, 1, 1); // if (tier >= 0) { - // Utils.drawStringCentered(tierString, Minecraft.getMinecraft().fontRendererObj, + // Utils.drawStringCentered(tierString, // guiLeft + x + 10, guiTop + y - 4, true, // tierStringColour // ); // } Utils.drawStringCentered( (int) Math.floor(levelNum) + "", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + x + 10, - guiTop + y + 26, - true, - color.getRGB() + guiLeft + x + 10, guiTop + y + 26, true, color.getRGB() ); } } @@ -241,7 +237,7 @@ public class BestiaryPage extends GuiProfileViewerPage { for (String line : tooltipToDisplay) { grayTooltip.add(EnumChatFormatting.GRAY + line); } - Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); + Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1); tooltipToDisplay = null; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java index 1db53267..d6746e1d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java @@ -142,14 +142,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { JsonObject profileInformation = GuiProfileViewer.getProfile().getProfileInformation(GuiProfileViewer.getProfileId()); if (profileInformation == null || !profileInformation.has("trophy_fish")) { - Utils.drawStringCentered( - EnumChatFormatting.RED + "No data found", - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 431 / 2f, - guiTop + 101, - true, - 0 - ); + Utils.drawStringCentered(EnumChatFormatting.RED + "No data found", guiLeft + 431 / 2f, guiTop + 101, true, 0); return; } JsonObject trophyObject = profileInformation.get("trophy_fish").getAsJsonObject(); @@ -180,11 +173,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { Utils.drawStringF( EnumChatFormatting.AQUA + "Thunder Kills: §f" + thunderKills, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 36, - guiTop + 112, - true, - 0 + guiLeft + 36, guiTop + 112, true, 0 ); ItemStack lord_jawbus_sc = NotEnoughUpdates.INSTANCE.manager.jsonToStack( @@ -198,11 +187,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { Utils.drawStringF( EnumChatFormatting.AQUA + "Lord Jawbus Kills: §f" + jawbusKills, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 36, - guiTop + 124, - true, - 0 + guiLeft + 36, guiTop + 124, true, 0 ); ItemStack fishing_rod = NotEnoughUpdates.INSTANCE.manager.jsonToStack( @@ -210,14 +195,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { ); Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(fishing_rod, guiLeft + 20, guiTop + 21); - Utils.drawStringF( - EnumChatFormatting.AQUA + "Total Caught: §f" + totalCount, - Minecraft.getMinecraft().fontRendererObj, - guiLeft + 38, - guiTop + 25, - true, - 0 - ); + Utils.drawStringF(EnumChatFormatting.AQUA + "Total Caught: §f" + totalCount, guiLeft + 38, guiTop + 25, true, 0); ArrayList<TrophyFish> arrayList = new ArrayList<>(trophyFishList.values()); arrayList.sort((c1, c2) -> Integer.compare(c2.getTotal(), c1.getTotal())); @@ -250,12 +228,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { if (mouseY >= y && mouseY <= y + 24) { Utils.drawHoveringText( getTooltip(value.getName(), value.getTrophyFishRarityIntegerMap()), - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj + mouseX, mouseY, width, height, -1 ); } } @@ -273,15 +246,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(itemStack, x, y); if (mouseX >= x && mouseX < x + 24) { if (mouseY >= y && mouseY <= y + 24) { - Utils.drawHoveringText( - getTooltip(difference, null), - mouseX, - mouseY, - width, - height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(getTooltip(difference, null), mouseX, mouseY, width, height, -1); GlStateManager.color(1, 1, 1, 1); } } @@ -302,7 +267,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { y = guiTop + 50 + i; Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(itemStack, x, y); - Utils.drawStringF(armorHelmets.get(itemStack).getLeft(), Minecraft.getMinecraft().fontRendererObj, x + 20, y + 4, true, 0); + Utils.drawStringF(armorHelmets.get(itemStack).getLeft(), x + 20, y + 4, true, 0); int hasValue = trophiesPerTier[integer - 1]; int neededValue = integer == 1 ? 15 : 18; @@ -311,12 +276,12 @@ public class TrophyFishPage extends GuiProfileViewerPage { try { JsonElement jsonElement = rewards.get(integer - 1); if (!jsonElement.isJsonNull()) { - Utils.drawStringF(check, Minecraft.getMinecraft().fontRendererObj, x + 100, y + 2, true, 0); + Utils.drawStringF(check, x + 100, y + 2, true, 0); } else { - Utils.drawStringF(neededText, Minecraft.getMinecraft().fontRendererObj, x + 100, y + 4, true, 0); + Utils.drawStringF(neededText, x + 100, y + 4, true, 0); } } catch (IndexOutOfBoundsException exception) { - Utils.drawStringF(neededText, Minecraft.getMinecraft().fontRendererObj, x + 100, y + 4, true, 0); + Utils.drawStringF(neededText, x + 100, y + 4, true, 0); } i += 10; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java index bd45f3e1..4be3b051 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java @@ -141,8 +141,7 @@ public class CraftingOverlay { Utils.drawHoveringText( recipeIngredient.getItemStack().getTooltip(Minecraft.getMinecraft().thePlayer, false), mouseX, mouseY, - Utils.peekGuiScale().getScaledWidth(), Utils.peekGuiScale().getScaledHeight(), -1, - Minecraft.getMinecraft().fontRendererObj + Utils.peekGuiScale().getScaledWidth(), Utils.peekGuiScale().getScaledHeight(), -1 ); } }); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java index a642187b..8e4623e3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java @@ -24,8 +24,6 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe; import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -115,11 +113,9 @@ public class CraftingRecipe implements NeuRecipe { @Override public void drawExtraInfo(GuiItemRecipe gui, int mouseX, int mouseY) { - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - String craftingText = getCraftText(); if (craftingText != null) - Utils.drawStringCenteredScaledMaxWidth(craftingText, fontRenderer, + Utils.drawStringCenteredScaledMaxWidth(craftingText, gui.guiLeft + EXTRA_STRING_X, gui.guiTop + EXTRA_STRING_Y, false, 75, 0x404040 ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java index 439ac56b..15b3c832 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java @@ -350,14 +350,7 @@ public class EssenceUpgrades implements NeuRecipe { Minecraft.getMinecraft().getTextureManager().bindTexture(BACKGROUND); GlStateManager.color(1, 1, 1, 1); drawButton(x, y, i + 1 == selectedTier); - Utils.drawStringCentered( - String.valueOf(i + 1), - Minecraft.getMinecraft().fontRendererObj, - x + 8, - y + 9, - false, - 0x2d4ffc - ); + Utils.drawStringCentered(String.valueOf(i + 1), x + 8, y + 9, false, 0x2d4ffc); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java index 73b4f32d..ff6a175d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java @@ -31,7 +31,6 @@ import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.HotmInformation; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -148,11 +147,9 @@ public class ForgeRecipe implements NeuRecipe { @Override public void drawExtraInfo(GuiItemRecipe gui, int mouseX, int mouseY) { - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; if (timeInSeconds > 0) Utils.drawStringCenteredScaledMaxWidth( formatDuration(timeInSeconds), - fontRenderer, gui.guiLeft + EXTRA_INFO_X, gui.guiTop + EXTRA_INFO_Y, false, @@ -180,11 +177,7 @@ public class ForgeRecipe implements NeuRecipe { Utils.drawHoveringText( Collections.singletonList( EnumChatFormatting.YELLOW + formatDuration(reducedTime) + " with Quick Forge (Level " + level + ")"), - mouseX, mouseY, - gui.width, gui.height, - 500, - Minecraft.getMinecraft().fontRendererObj - ); + mouseX, mouseY, gui.width, gui.height, 500); } public int getReducedTime(int quickForgeUpgradeLevel) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java index 61749593..0e580cb8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java @@ -31,7 +31,6 @@ import io.github.moulberry.notenoughupdates.profileviewer.Panorama; import io.github.moulberry.notenoughupdates.util.ItemUtils; import io.github.moulberry.notenoughupdates.util.JsonUtils; import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -276,15 +275,7 @@ public class MobLootRecipe implements NeuRecipe { if (combatXp > 0) stuff.add("§r§bCombat Experience: " + combatXp); stuff.addAll(extra); - Utils.drawHoveringText( - stuff, - mouseX, - mouseY, - gui.width, - gui.height, - -1, - Minecraft.getMinecraft().fontRendererObj - ); + Utils.drawHoveringText(stuff, mouseX, mouseY, gui.width, gui.height, -1); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java index 9bb79604..4938c383 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java @@ -27,9 +27,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.entity.EntityLivingBase; @@ -135,10 +133,8 @@ public class VillagerTradeRecipe implements NeuRecipe { @Override public void drawExtraInfo(GuiItemRecipe gui, int mouseX, int mouseY) { if (hasVariableCost()) { - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; Utils.drawStringCenteredScaledMaxWidth( - minCost + " - " + maxCost, fontRenderer, - gui.guiLeft + 50, gui.guiTop + 90, false, 75, 0xff00ff + minCost + " - " + maxCost, gui.guiLeft + 50, gui.guiTop + 90, false, 75, 0xff00ff ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java b/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java index d373ef2c..99a39d0a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java @@ -83,10 +83,7 @@ public class NotificationHandler { int xLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth("[X] Close"); Minecraft.getMinecraft().fontRendererObj.drawString( "[X] Close", - midX + width / 2f - 3 - xLen, - topY + 3, - 0xFFFF5555, - false + midX + width / 2f - 3 - xLen, topY + 3, 0xFFFF5555, false ); if (notificationDisplayMillis > 0) { @@ -99,24 +96,10 @@ public class NotificationHandler { ); } - Utils.drawStringCentered( - notificationLines.get(0), - Minecraft.getMinecraft().fontRendererObj, - midX, - topY + 4 + 5, - false, - -1 - ); + Utils.drawStringCentered(notificationLines.get(0), midX, topY + 4 + 5, false, -1); for (int i = 1; i < notificationLines.size(); i++) { String line = notificationLines.get(i); - Utils.drawStringCentered( - line, - Minecraft.getMinecraft().fontRendererObj, - midX, - topY + 4 + 5 + 2 + i * 10, - false, - -1 - ); + Utils.drawStringCentered(line, midX, topY + 4 + 5 + 2 + i * 10, false, -1); } Utils.pushGuiScale(-1); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 38debbbc..49caa2b6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -293,9 +293,9 @@ public class Utils { while (matcher.find()) { matcher.appendReplacement( sb, - Utils.chromaString(matcher.group(1)) - .replace("\\", "\\\\") - .replace("$", "\\$") + chromaString(matcher.group(1)) + .replace("\\", "\\\\") + .replace("$", "\\$") ); } matcher.appendTail(sb); @@ -628,10 +628,10 @@ public class Utils { Minecraft.getMinecraft().getTextureManager().bindTexture(GuiProfileViewer.pv_elements); - Utils.drawTexturedRect(x, y, pressed ? 32 : 28, 28, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); + drawTexturedRect(x, y, pressed ? 32 : 28, 28, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); GlStateManager.enableDepth(); - Utils.drawItemStack(itemStack, x + 8, y + 7); + drawItemStack(itemStack, x + 8, y + 7); } public static void drawTexturedRect(float x, float y, float width, float height, int filter) { @@ -676,7 +676,7 @@ public class Utils { public static int checkItemTypePet(List<String> lore) { for (int i = lore.size() - 1; i >= 0; i--) { - String line = Utils.cleanColour(lore.get(i)); + String line = cleanColour(lore.get(i)); for (int i1 = 0; i1 < rarityArr.length; i1++) { if (line.equals(rarityArr[i1])) { return i1; @@ -1016,6 +1016,11 @@ public class Utils { return render; } + public static void drawStringF(String str, float x, float y, boolean shadow, int colour) { + drawStringF(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour); + } + + @Deprecated public static void drawStringF(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) { fr.drawString(str, x, y, colour, shadow); } @@ -1039,6 +1044,11 @@ public class Utils { return height; } + public static void drawStringVertical(String str, float x, float y, boolean shadow, int colour) { + drawStringVertical(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour); + } + + @Deprecated public static void drawStringVertical(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) { String format = FontRenderer.getFormatFromString(str); str = cleanColour(str); @@ -1066,9 +1076,8 @@ public class Utils { for (int xOff = -2; xOff <= 2; xOff++) { for (int yOff = -2; yOff <= 2; yOff++) { if (Math.abs(xOff) != Math.abs(yOff)) { - Utils.drawStringCenteredScaledMaxWidth( - Utils.cleanColourNotModifiers(str), - Minecraft.getMinecraft().fontRendererObj, + drawStringCenteredScaledMaxWidth( + cleanColourNotModifiers(str), x + xOff / 2f * factor, y + 4 + yOff / 2f * factor, false, @@ -1080,9 +1089,7 @@ public class Utils { } GlStateManager.color(1, 1, 1, 1); - Utils.drawStringCenteredScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, - x, y + 4, false, maxLength, 4210752 - ); + drawStringCenteredScaledMaxWidth(str, x, y + 4, false, maxLength, 421075); } public static void renderAlignedString(String first, String second, float x, float y, int length) { @@ -1093,7 +1100,7 @@ public class Utils { for (int xOff = -2; xOff <= 2; xOff++) { for (int yOff = -2; yOff <= 2; yOff++) { if (Math.abs(xOff) != Math.abs(yOff)) { - fontRendererObj.drawString(Utils.cleanColourNotModifiers(first), + fontRendererObj.drawString(cleanColourNotModifiers(first), x + xOff / 2f, y + yOff / 2f, new Color(0, 0, 0, 200 / Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false ); @@ -1107,7 +1114,7 @@ public class Utils { for (int xOff = -2; xOff <= 2; xOff++) { for (int yOff = -2; yOff <= 2; yOff++) { if (Math.abs(xOff) != Math.abs(yOff)) { - fontRendererObj.drawString(Utils.cleanColourNotModifiers(second), + fontRendererObj.drawString(cleanColourNotModifiers(second), x + length - secondLen + xOff / 2f, y + yOff / 2f, new Color(0, 0, 0, 200 / Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false ); @@ -1122,6 +1129,18 @@ public class Utils { public static void drawStringScaledMaxWidth( String str, + float x, + float y, + boolean shadow, + int len, + int colour + ) { + drawStringScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour); + } + + @Deprecated + public static void drawStringScaledMaxWidth( + String str, FontRenderer fr, float x, float y, @@ -1133,9 +1152,14 @@ public class Utils { float factor = len / (float) strLen; factor = Math.min(1, factor); - drawStringScaled(str, fr, x, y, shadow, colour, factor); + drawStringScaled(str, x, y, shadow, colour, factor); + } + + public static void drawStringCentered(String str, float x, float y, boolean shadow, int colour) { + drawStringCentered(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour); } + @Deprecated public static void drawStringCentered(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) { int strLen = fr.getStringWidth(str); @@ -1149,6 +1173,18 @@ public class Utils { public static void drawStringScaled( String str, + float x, + float y, + boolean shadow, + int colour, + float factor + ) { + drawStringScaled(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour, factor); + } + + @Deprecated + public static void drawStringScaled( + String str, FontRenderer fr, float x, float y, @@ -1170,11 +1206,24 @@ public class Utils { int colour, float factor ) { - drawStringScaled(str, fr, x - fr.getStringWidth(str) * factor, y, shadow, colour, factor); + drawStringScaled(str, x - fr.getStringWidth(str) * factor, y, shadow, colour, factor); } public static void drawStringScaledMax( String str, + float x, + float y, + boolean shadow, + int colour, + float factor, + int len + ) { + drawStringScaledMax(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour, factor, len); + } + + @Deprecated + public static void drawStringScaledMax( + String str, FontRenderer fr, float x, float y, @@ -1194,6 +1243,18 @@ public class Utils { public static void drawStringCenteredScaledMaxWidth( String str, + float x, + float y, + boolean shadow, + int len, + int colour + ) { + drawStringCenteredScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour); + } + + @Deprecated + public static void drawStringCenteredScaledMaxWidth( + String str, FontRenderer fr, float x, float y, @@ -1208,7 +1269,7 @@ public class Utils { float fontHeight = 8 * factor; - drawStringScaled(str, fr, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor); + drawStringScaled(str, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor); } public static Matrix4f createProjectionMatrix(int width, int height) { @@ -1226,22 +1287,36 @@ public class Utils { public static void drawStringCenteredScaled( String str, - FontRenderer fr, - float x, - float y, + float x, float y, boolean shadow, int len, int colour ) { - int strLen = fr.getStringWidth(str); + int strLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(str); float factor = len / (float) strLen; float fontHeight = 8 * factor; - drawStringScaled(str, fr, x - len / 2, y - fontHeight / 2, shadow, colour, factor); + drawStringScaled( + str, + x - len / 2, y - fontHeight / 2, + shadow, + colour, + factor + ); } public static void drawStringCenteredScaled( String str, + float x, float y, + boolean shadow, + float factor + ) { + drawStringCenteredScaled(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, factor); + } + + @Deprecated + public static void drawStringCenteredScaled( + String str, FontRenderer fr, float x, float y, @@ -1253,7 +1328,7 @@ public class Utils { float x2 = x - strLen / 2f; float y2 = y - fr.FONT_HEIGHT / 2f; - drawStringScaled(str, fr, x2, y2, shadow, 0, factor); + drawStringScaled(str, x2, y2, shadow, 0, factor); } public static void drawStringCenteredYScaled( @@ -1269,7 +1344,7 @@ public class Utils { float factor = len / (float) strLen; float fontHeight = 8 * factor; - drawStringScaled(str, fr, x, y - fontHeight / 2, shadow, colour, factor); + drawStringScaled(str, x, y - fontHeight / 2, shadow, colour, factor); } public static void drawStringCenteredYScaledMaxWidth( @@ -1286,12 +1361,11 @@ public class Utils { factor = Math.min(1, factor); float fontHeight = 8 * factor; - drawStringScaled(str, fr, x, y - fontHeight / 2, shadow, colour, factor); + drawStringScaled(str, x, y - fontHeight / 2, shadow, colour, factor); } public static int renderStringTrimWidth( String str, - FontRenderer fr, boolean shadow, int x, int y, @@ -1299,12 +1373,11 @@ public class Utils { int colour, int maxLines ) { - return renderStringTrimWidth(str, fr, shadow, x, y, len, colour, maxLines, 1); + return renderStringTrimWidth(str, shadow, x, y, len, colour, maxLines, 1); } public static int renderStringTrimWidth( String str, - FontRenderer fr, boolean shadow, int x, int y, @@ -1331,20 +1404,20 @@ public class Utils { int lines = 0; while ((lines++ < maxLines) || maxLines < 0) { if (trimmed.length() == str.length()) { - drawStringScaled(trimmed, fr, x, y + yOff, shadow, colour, scale); + drawStringScaled(trimmed, x, y + yOff, shadow, colour, scale); break; } else if (trimmed.isEmpty()) { yOff -= 12 * scale; break; } else { if (firstLine) { - drawStringScaled(trimmed, fr, x, y + yOff, shadow, colour, scale); + drawStringScaled(trimmed, x, y + yOff, shadow, colour, scale); firstLine = false; } else { if (trimmed.startsWith(" ")) { trimmed = trimmed.substring(1); } - drawStringScaled(colourCodes + trimmed, fr, x, y + yOff, shadow, colour, scale); + drawStringScaled(colourCodes + trimmed, x, y + yOff, shadow, colour, scale); } excess = str.substring(trimmedCharacters); @@ -1436,6 +1509,26 @@ public class Utils { final int mouseY, final int screenWidth, final int screenHeight, + final int maxTextWidth + ) { + drawHoveringText( + textLines, + mouseX, + mouseY, + screenWidth, + screenHeight, + maxTextWidth, + Minecraft.getMinecraft().fontRendererObj + ); + } + + @Deprecated + public static void drawHoveringText( + List<String> textLines, + final int mouseX, + final int mouseY, + final int screenWidth, + final int screenHeight, final int maxTextWidth, FontRenderer font ) { @@ -1582,6 +1675,28 @@ public class Utils { final int screenWidth, final int screenHeight, final int maxTextWidth, + boolean coloured + ) { + drawHoveringText( + textLines, + mouseX, + mouseY, + screenWidth, + screenHeight, + maxTextWidth, + Minecraft.getMinecraft().fontRendererObj, + coloured + ); + } + + @Deprecated + public static void drawHoveringText( + List<String> textLines, + final int mouseX, + final int mouseY, + final int screenWidth, + final int screenHeight, + final int maxTextWidth, FontRenderer font, boolean coloured ) { @@ -2144,7 +2259,7 @@ public class Utils { runtime.exec("xdg-open " + url); return true; } catch (IOException e) { - Utils.playSound(new ResourceLocation("game.player.hurt"), true); + playSound(new ResourceLocation("game.player.hurt"), true); return false; } } |