From af846d805939692eab57282851da106c125877d3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 30 Sep 2022 02:30:30 +0200 Subject: useless change (#321) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../miscfeatures/AuctionSortModeWarning.java | 82 ++++++++++------------ 1 file changed, 39 insertions(+), 43 deletions(-) (limited to 'src/main/java') 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 8ac0151a..ed05ee79 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java @@ -45,50 +45,46 @@ public class AuctionSortModeWarning { } public void onPostGuiRender() { - if (isAuctionBrowser()) { - GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - - ItemStack stack = chest.inventorySlots.getSlot(50).getStack(); - - if (stack != null) { - List tooltip = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - - String selectedSort = null; - for (String line : tooltip) { - if (line.startsWith("\u00a75\u00a7o\u00a7b\u25B6 ")) { - selectedSort = Utils.cleanColour(line.substring("\u00a75\u00a7o\u00a7b\u25B6 ".length())); - } - } - - if (selectedSort != null) { - if (!selectedSort.trim().equals("Lowest Price")) { - GlStateManager.disableLighting(); - GlStateManager.pushMatrix(); - GlStateManager.translate(0, 0, 500); - - String selectedColour = "\u00a7e"; - - if (selectedSort.trim().equals("Highest Price")) { - selectedColour = "\u00a7c"; - } - - String warningText = "\u00a7aSort: " + selectedColour + selectedSort; - int warningLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(warningText); - - int centerX = - ((AccessorGuiContainer) chest).getGuiLeft() + ((AccessorGuiContainer) chest).getXSize() / 2 + 9; - int centerY = ((AccessorGuiContainer) chest).getGuiTop() + 26; - - 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 - ); - GlStateManager.popMatrix(); - } - } + if (!isAuctionBrowser()) return; + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + + ItemStack stack = chest.inventorySlots.getSlot(50).getStack(); + + if (stack == null) return; + List tooltip = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + + String selectedSort = null; + for (String line : tooltip) { + if (line.startsWith("\u00a75\u00a7o\u00a7b\u25B6 ")) { + selectedSort = Utils.cleanColour(line.substring("\u00a75\u00a7o\u00a7b\u25B6 ".length())); } } + + if (selectedSort == null) return; + if (selectedSort.trim().equals("Lowest Price")) return; + GlStateManager.disableLighting(); + GlStateManager.pushMatrix(); + GlStateManager.translate(0, 0, 500); + + String selectedColour = "\u00a7e"; + + if (selectedSort.trim().equals("Highest Price")) { + selectedColour = "\u00a7c"; + } + + String warningText = "\u00a7aSort: " + selectedColour + selectedSort; + int warningLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(warningText); + + int centerX = + ((AccessorGuiContainer) chest).getGuiLeft() + ((AccessorGuiContainer) chest).getXSize() / 2 + 9; + int centerY = ((AccessorGuiContainer) chest).getGuiTop() + 26; + + 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 + ); + GlStateManager.popMatrix(); } } -- cgit