From 12fa7d745b5d8863eca55684f253e327d259a9b9 Mon Sep 17 00:00:00 2001 From: Oliver Howe Date: Sun, 21 Mar 2021 16:04:54 -0600 Subject: Inital commit for price filtering --- .../moulberry/notenoughupdates/NEUOverlay.java | 3 +- .../notenoughupdates/auction/CustomAH.java | 1128 ++++++++++++-------- .../notenoughupdates/options/NEUConfig.java | 8 + .../notenoughupdates/util/HypixelApi.java | 2 +- 4 files changed, 697 insertions(+), 444 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 689a98f1..952d8f59 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; @@ -1320,7 +1321,7 @@ public class NEUOverlay extends Gui { public float getWidthMult() { float scaleFMult = 1; if(Utils.peekGuiScale().getScaleFactor()==4) scaleFMult *= 0.9f; - if(manager.auctionManager.customAH.isRenderOverAuctionView()) scaleFMult *= 0.8f; + if(manager.auctionManager.customAH.isRenderOverAuctionView() || Minecraft.getMinecraft().currentScreen instanceof CustomAHGui) scaleFMult *= 0.8f; return (float)Math.max(0.5, Math.min(1.5, NotEnoughUpdates.INSTANCE.config.itemlist.paneWidthMult))*scaleFMult; } 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 fc55a4b8..3f52ebf8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -46,6 +46,12 @@ import static io.github.moulberry.notenoughupdates.util.GuiTextures.*; public class CustomAH extends Gui { + private enum PriceFilter { + Greater, + Less, + Equal + } + private static final ResourceLocation creativeTabSearch = new ResourceLocation("textures/gui/container/creative_inventory/tab_item_search.png"); private static final ResourceLocation creativeInventoryTabs = @@ -69,6 +75,10 @@ public class CustomAH extends Gui { private GuiTextField searchField = null; private GuiTextField priceField = null; + private GuiTextField priceFilterField = null; + private GuiTextField binPriceFilterField = null; + + private final int binPriceFilterYOffset = 86; private boolean renderOverAuctionView = false; private long lastRenderDisable = 0; @@ -80,6 +90,8 @@ public class CustomAH extends Gui { private long lastMouseEvent; public long lastOpen; public long lastGuiScreenSwitch; + private PriceFilter currentPriceFilterType = PriceFilter.Greater; + private PriceFilter currentBinPriceFilterType = PriceFilter.Greater; private final int splits = 2; @@ -132,12 +144,12 @@ public class CustomAH extends Gui { private static final int SORT_MODE_LOW = 1; private static final int SORT_MODE_SOON = 2; - private static final String[] rarities = { "COMMON", "UNCOMMON", "RARE", "EPIC", - "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME" }; - private static final String[] rarityColours = { ""+EnumChatFormatting.WHITE, - ""+EnumChatFormatting.GREEN, ""+EnumChatFormatting.BLUE, ""+EnumChatFormatting.DARK_PURPLE, - ""+EnumChatFormatting.GOLD, ""+EnumChatFormatting.LIGHT_PURPLE, ""+EnumChatFormatting.RED, - ""+EnumChatFormatting.RED, ""+EnumChatFormatting.DARK_RED }; + private static final String[] rarities = {"COMMON", "UNCOMMON", "RARE", "EPIC", + "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME"}; + private static final String[] rarityColours = {"" + EnumChatFormatting.WHITE, + "" + EnumChatFormatting.GREEN, "" + EnumChatFormatting.BLUE, "" + EnumChatFormatting.DARK_PURPLE, + "" + EnumChatFormatting.GOLD, "" + EnumChatFormatting.LIGHT_PURPLE, "" + EnumChatFormatting.RED, + "" + EnumChatFormatting.RED, "" + EnumChatFormatting.DARK_RED}; private static final int BIN_FILTER_ALL = 0; private static final int BIN_FILTER_BIN = 1; @@ -164,20 +176,20 @@ public class CustomAH extends Gui { private int enchFilter = ENCH_FILTER_ALL; private static ItemStack DUNGEON_SORT = Utils.createItemStack(Item.getItemFromBlock(Blocks.deadbush), - EnumChatFormatting.GREEN+"Dungeon Sorting"); + EnumChatFormatting.GREEN + "Dungeon Sorting"); private static ItemStack CONTROL_SORT = Utils.createItemStack(Item.getItemFromBlock(Blocks.hopper), - EnumChatFormatting.GREEN+"Sort"); + EnumChatFormatting.GREEN + "Sort"); private static ItemStack CONTROL_TIER = Utils.createItemStack(Items.ender_eye, - EnumChatFormatting.GREEN+"Item Tier"); + EnumChatFormatting.GREEN + "Item Tier"); private static ItemStack CONTROL_MYAUC = Utils.createItemStack(Items.gold_ingot, - EnumChatFormatting.GREEN+"My Auctions"); + EnumChatFormatting.GREEN + "My Auctions"); private static ItemStack CONTROL_BIN = Utils.createItemStack(Item.getItemFromBlock(Blocks.golden_rail), - EnumChatFormatting.GREEN+"BIN Filter"); + EnumChatFormatting.GREEN + "BIN Filter"); private static ItemStack CONTROL_ENCH = Utils.createItemStack(Items.enchanted_book, - EnumChatFormatting.GREEN+"Enchant Filter"); + EnumChatFormatting.GREEN + "Enchant Filter"); private static ItemStack CONTROL_STATS = Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), - EnumChatFormatting.GREEN+"Stats for nerds"); - private ItemStack[] controls = {DUNGEON_SORT,CONTROL_SORT,CONTROL_TIER,null,CONTROL_MYAUC,null,CONTROL_BIN,CONTROL_ENCH,CONTROL_STATS}; + EnumChatFormatting.GREEN + "Stats for nerds"); + private ItemStack[] controls = {DUNGEON_SORT, CONTROL_SORT, CONTROL_TIER, null, CONTROL_MYAUC, null, CONTROL_BIN, CONTROL_ENCH, CONTROL_STATS}; private NEUManager manager; @@ -186,8 +198,8 @@ public class CustomAH extends Gui { } public void clearSearch() { - if(searchField == null || priceField == null) init(); - if(System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false); + if (searchField == null || priceField == null) init(); + if (System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false); //sortMode = SORT_MODE_HIGH; rarityFilter = -1; @@ -207,10 +219,10 @@ public class CustomAH extends Gui { } public void tick() { - if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) return; - if(Minecraft.getMinecraft().currentScreen instanceof CustomAHGui || renderOverAuctionView) { - if(shouldUpdateSearch) updateSearch(); - if(shouldSortItems) { + if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) return; + if (Minecraft.getMinecraft().currentScreen instanceof CustomAHGui || renderOverAuctionView) { + if (shouldUpdateSearch) updateSearch(); + if (shouldSortItems) { sortItems(); shouldSortItems = false; } @@ -231,11 +243,11 @@ public class CustomAH extends Gui { } public String[] getTotalCategories() { - String[] categories = new String[1+subcategories.length]; + String[] categories = new String[1 + subcategories.length]; categories[0] = categoryMatch; - for(int i=0; i tooltip = new ArrayList<>(); - for(String line : auc.getStack().getTooltip(Minecraft.getMinecraft().thePlayer, false)) { - tooltip.add(EnumChatFormatting.GRAY+line); + for (String line : auc.getStack().getTooltip(Minecraft.getMinecraft().thePlayer, false)) { + tooltip.add(EnumChatFormatting.GRAY + line); } long timeUntilEnd = auc.end - System.currentTimeMillis(); - String endsIn = EnumChatFormatting.YELLOW+prettyTime(timeUntilEnd); + String endsIn = EnumChatFormatting.YELLOW + prettyTime(timeUntilEnd); NumberFormat format = NumberFormat.getInstance(Locale.US); - tooltip.add(EnumChatFormatting.DARK_GRAY+""+EnumChatFormatting.STRIKETHROUGH+"-----------------"); - tooltip.add(EnumChatFormatting.GRAY+"Seller: [CLICK TO SEE]"); + tooltip.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.STRIKETHROUGH + "-----------------"); + tooltip.add(EnumChatFormatting.GRAY + "Seller: [CLICK TO SEE]"); - if(auc.bin) { - tooltip.add(EnumChatFormatting.GRAY+"Buy it now: "+ - EnumChatFormatting.GOLD+format.format(auc.starting_bid)); + if (auc.bin) { + tooltip.add(EnumChatFormatting.GRAY + "Buy it now: " + + EnumChatFormatting.GOLD + format.format(auc.starting_bid)); } else { - if(auc.bid_count > 0) { - tooltip.add(EnumChatFormatting.GRAY+"Bids: "+EnumChatFormatting.GREEN+auc.bid_count+" bids"); + if (auc.bid_count > 0) { + tooltip.add(EnumChatFormatting.GRAY + "Bids: " + EnumChatFormatting.GREEN + auc.bid_count + " bids"); tooltip.add(""); - tooltip.add(EnumChatFormatting.GRAY+"Top bid: "+ - EnumChatFormatting.GOLD+format.format(auc.highest_bid_amount)); - tooltip.add(EnumChatFormatting.GRAY+"Bidder: [CLICK TO SEE]"); + tooltip.add(EnumChatFormatting.GRAY + "Top bid: " + + EnumChatFormatting.GOLD + format.format(auc.highest_bid_amount)); + tooltip.add(EnumChatFormatting.GRAY + "Bidder: [CLICK TO SEE]"); } else { - tooltip.add(EnumChatFormatting.GRAY+"Starting bid: "+ - EnumChatFormatting.GOLD+format.format(auc.starting_bid)); + tooltip.add(EnumChatFormatting.GRAY + "Starting bid: " + + EnumChatFormatting.GOLD + format.format(auc.starting_bid)); } } - if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoAucItem) { + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoAucItem) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(auc.getStack()); - if(internalname != null) { - if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { + if (internalname != null) { + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { tooltip.add(""); - tooltip.add(EnumChatFormatting.GRAY+"[SHIFT for Price Info]"); + tooltip.add(EnumChatFormatting.GRAY + "[SHIFT for Price Info]"); } else { ItemPriceInformation.addToTooltip(tooltip, internalname, auc.getStack()); } @@ -354,9 +385,9 @@ public class CustomAH extends Gui { } tooltip.add(""); - tooltip.add(EnumChatFormatting.GRAY+"Ends in: "+endsIn); + tooltip.add(EnumChatFormatting.GRAY + "Ends in: " + endsIn); tooltip.add(""); - tooltip.add(EnumChatFormatting.YELLOW+"Click to inspect!"); + tooltip.add(EnumChatFormatting.YELLOW + "Click to inspect!"); return tooltip; } @@ -372,12 +403,12 @@ public class CustomAH extends Gui { private void drawCategorySide(int i) { boolean clicked = i == clickedSubCategory; - int x = guiLeft-28; - int y = guiTop+17+28*(i+1); - float uMin = 28/256f; - float uMax = 56/256f; - float vMin = 0+(clicked?32/256f:0); - float vMax = 32/256f+(clicked?32/256f:0); + int x = guiLeft - 28; + int y = guiTop + 17 + 28 * (i + 1); + float uMin = 28 / 256f; + float uMax = 56 / 256f; + float vMin = 0 + (clicked ? 32 / 256f : 0); + float vMax = 32 / 256f + (clicked ? 32 / 256f : 0); float catWidth = 32; float catHeight = 28; @@ -392,13 +423,13 @@ public class CustomAH extends Gui { WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer - .pos(x, y+catHeight, 0.0D) + .pos(x, y + catHeight, 0.0D) .tex(uMax, vMin).endVertex(); worldrenderer - .pos(x+catWidth, y+catHeight, 0.0D) + .pos(x + catWidth, y + catHeight, 0.0D) .tex(uMax, vMax).endVertex(); worldrenderer - .pos(x+catWidth, y, 0.0D) + .pos(x + catWidth, y, 0.0D) .tex(uMin, vMax).endVertex(); worldrenderer .pos(x, y, 0.0D) @@ -409,27 +440,28 @@ public class CustomAH extends Gui { } private HashMap timeParseMap = new HashMap<>(); + public long prettyTimeToMillis(String endsInStr) { - if(timeParseMap.isEmpty()) { + if (timeParseMap.isEmpty()) { Pattern dayPattern = Pattern.compile("([0-9]+)d"); Pattern hourPattern = Pattern.compile("([0-9]+)h"); Pattern minutePattern = Pattern.compile("([0-9]+)m"); Pattern secondPattern = Pattern.compile("([0-9]+)s"); - timeParseMap.put(dayPattern, 24*60*60*1000L); - timeParseMap.put(hourPattern, 60*60*1000L); - timeParseMap.put(minutePattern, 60*1000L); + timeParseMap.put(dayPattern, 24 * 60 * 60 * 1000L); + timeParseMap.put(hourPattern, 60 * 60 * 1000L); + timeParseMap.put(minutePattern, 60 * 1000L); timeParseMap.put(secondPattern, 1000L); } - if(endsInStr != null) { + if (endsInStr != null) { long timeUntilEnd = 0; String timeStr = Utils.cleanColour(endsInStr); - for(Map.Entry timeEntry : timeParseMap.entrySet()) { + for (Map.Entry timeEntry : timeParseMap.entrySet()) { Matcher matcher = timeEntry.getKey().matcher(timeStr); - if(matcher.find()) { + if (matcher.find()) { String days = matcher.group(1); timeUntilEnd += Long.parseLong(days) * timeEntry.getValue(); } @@ -442,10 +474,10 @@ public class CustomAH extends Gui { } public String findStrStart(ItemStack stack, String toFind) { - if(stack.hasTagCompound()) { + if (stack.hasTagCompound()) { //ยง7Ends in: - for(String line : manager.getLoreFromNBT(stack.getTagCompound())) { - if(line.trim().startsWith(toFind)) { + for (String line : manager.getLoreFromNBT(stack.getTagCompound())) { + if (line.trim().startsWith(toFind)) { return line.substring(toFind.length()); } } @@ -455,47 +487,49 @@ public class CustomAH extends Gui { } public String findEndsInStr(ItemStack stack) { - return findStrStart(stack, EnumChatFormatting.GRAY+"Ends in: "); + return findStrStart(stack, EnumChatFormatting.GRAY + "Ends in: "); } public void drawScreen(int mouseX, int mouseY) { - if(System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false); + if (System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false); ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledResolution.getScaledWidth(); int height = scaledResolution.getScaledHeight(); - if(searchField == null || priceField == null) init(); + boolean hasPopup = false; + + if (searchField == null || priceField == null || priceFilterField == null) init(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - guiLeft = (width - getXSize())/2; - guiTop = (height - getYSize())/2; + guiLeft = (width - getXSize()) / 2; + guiTop = (height - getYSize()) / 2; this.searchField.xPosition = guiLeft + 82; this.searchField.yPosition = guiTop + 6; - if(!isEditingPrice()) priceField.setText("IAUSHDIUAH"); + if (!isEditingPrice()) priceField.setText("IAUSHDIUAH"); - if((Minecraft.getMinecraft().currentScreen instanceof GuiChest || + if ((Minecraft.getMinecraft().currentScreen instanceof GuiChest || Minecraft.getMinecraft().currentScreen instanceof GuiEditSign) && currentAucId == null) { Minecraft.getMinecraft().displayGuiScreen(null); } List tooltipToRender = null; - if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { resetCurrAucIdTimer = System.currentTimeMillis(); GuiChest auctionView = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest container = (ContainerChest) auctionView.inventorySlots; String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText(); - float slideAmount = 1-Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch)/200f)); - int auctionViewLeft = guiLeft+getXSize()+4 - (int)(slideAmount*(78+4)); - - if(containerName.trim().equals("Auction View") || containerName.trim().equals("BIN Auction View")) { + float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f)); + int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (78 + 4)); + if (containerName.trim().equals("Auction View") || containerName.trim().equals("BIN Auction View")) { + hasPopup = true; Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view); this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 78, 172); - if(auctionViewLeft+31 > guiLeft+getXSize()) { + if (auctionViewLeft + 31 > guiLeft + getXSize()) { try { ItemStack topStack = auctionView.inventorySlots.getSlot(13).getStack(); ItemStack leftStack = auctionView.inventorySlots.getSlot(29).getStack(); @@ -504,31 +538,31 @@ public class CustomAH extends Gui { boolean isBin = isGuiFiller(leftStack) || isGuiFiller(leftStack); - if(isBin) { + if (isBin) { leftStack = middleStack; middleStack = null; } String endsInStr = findEndsInStr(topStack); - if(endsInStr != null) { + if (endsInStr != null) { long auctionViewEndsIn = prettyTimeToMillis(endsInStr); - if(auctionViewEndsIn > 0) { - if(System.currentTimeMillis() - currAucIdSetTimer > 1000) { + if (auctionViewEndsIn > 0) { + if (System.currentTimeMillis() - currAucIdSetTimer > 1000) { APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(currentAucId); - if(auc != null) { + if (auc != null) { auc.end = auctionViewEndsIn + lastGuiScreenSwitch; } } - endsInStr = EnumChatFormatting.DARK_PURPLE+prettyTime( + endsInStr = EnumChatFormatting.DARK_PURPLE + prettyTime( auctionViewEndsIn + lastGuiScreenSwitch - System.currentTimeMillis()); } Utils.drawStringCenteredScaledMaxWidth(endsInStr, Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft+39, guiTop+20, false, 70, 4210752); + auctionViewLeft + 39, guiTop + 20, false, 70, 4210752); } - Utils.drawItemStack(leftStack, auctionViewLeft+31, guiTop+100); + Utils.drawItemStack(leftStack, auctionViewLeft + 31, guiTop + 100); - if(!isGuiFiller(leftStack)) { + if (!isGuiFiller(leftStack)) { NBTTagCompound tag = leftStack.getTagCompound(); NBTTagCompound display = tag.getCompoundTag("display"); if (display.hasKey("Lore", 9)) { @@ -536,43 +570,44 @@ public class CustomAH extends Gui { String line2 = list.getStringTagAt(1); line2 = Utils.cleanColour(line2); StringBuilder priceNumbers = new StringBuilder(); - for(int i=0; i= 48 && (int)c <= 57) { + if ((int) c >= 48 && (int) c <= 57) { priceNumbers.append(c); } } - if(priceNumbers.length() > 0) { + if (priceNumbers.length() > 0) { startingBid = Integer.parseInt(priceNumbers.toString()); } } } - Utils.drawItemStack(topStack, auctionViewLeft+31, guiTop+35); + Utils.drawItemStack(topStack, auctionViewLeft + 31, guiTop + 35); - if(!isGuiFiller(middleStack)) { + if (!isGuiFiller(middleStack)) { Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons); - boolean hover = mouseX > auctionViewLeft+31 && mouseX guiTop+126 && mouseY < guiTop+126+16; - this.drawTexturedModalRect(auctionViewLeft+31, guiTop+126, hover?16:0, 0, 16, 16); + boolean hover = mouseX > auctionViewLeft + 31 && mouseX < auctionViewLeft + 31 + 16 && + mouseY > guiTop + 126 && mouseY < guiTop + 126 + 16; + this.drawTexturedModalRect(auctionViewLeft + 31, guiTop + 126, hover ? 16 : 0, 0, 16, 16); } else { middleStack = null; } - if(mouseX > auctionViewLeft+31 && mouseX guiTop+35 && mouseY < guiTop+35+16) { - if(topStack != null) { + if (mouseX > auctionViewLeft + 31 && mouseX < auctionViewLeft + 31 + 16) { + if (mouseY > guiTop + 35 && mouseY < guiTop + 35 + 16) { + if (topStack != null) { tooltipToRender = topStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); tooltipToRender.add(""); - tooltipToRender.add(EnumChatFormatting.YELLOW+"Click to copy seller name!"); + tooltipToRender.add(EnumChatFormatting.YELLOW + "Click to copy seller name!"); } - } else if(mouseY > guiTop+100 && mouseY < guiTop+100+16) { - if(leftStack != null) tooltipToRender = leftStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - } else if(mouseY > guiTop+61 && mouseY < guiTop+61+16) { + } else if (mouseY > guiTop + 100 && mouseY < guiTop + 100 + 16) { + if (leftStack != null) + tooltipToRender = leftStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + } else if (mouseY > guiTop + 61 && mouseY < guiTop + 61 + 16) { tooltipToRender = new ArrayList<>(); APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(currentAucId); - if(auc != null) { - tooltipToRender.add(EnumChatFormatting.WHITE+"Price Info"); + if (auc != null) { + tooltipToRender.add(EnumChatFormatting.WHITE + "Price Info"); String internalname = manager.getInternalNameForItem(auc.getStack()); JsonObject auctionInfo = manager.auctionManager.getItemAuctionInfo(internalname); @@ -587,141 +622,145 @@ public class CustomAH extends Gui { APIManager.CraftInfo craftCost = manager.auctionManager.getCraftCost(internalname); - if(lowestBin > 0) { - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); + if (lowestBin > 0) { + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Lowest BIN: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(lowestBin) + " coins"); } - if(hasBazaarPrice) { - int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat(); - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins"); - int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat(); - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins"); - int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat(); - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins"); - int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat(); - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins"); + if (hasBazaarPrice) { + int bazaarBuyPrice = (int) bazaarInfo.get("avg_buy").getAsFloat(); + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Buy: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarBuyPrice) + " coins"); + int bazaarSellPrice = (int) bazaarInfo.get("avg_sell").getAsFloat(); + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Sell: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarSellPrice) + " coins"); + int bazaarInstantBuyPrice = (int) bazaarInfo.get("curr_buy").getAsFloat(); + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Buy: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarInstantBuyPrice) + " coins"); + int bazaarInstantSellPrice = (int) bazaarInfo.get("curr_sell").getAsFloat(); + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Sell: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarInstantSellPrice) + " coins"); } - if(hasAuctionPrice) { - int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins"); - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("sales").getAsFloat())+" sales/day"); - if(auctionInfo.has("clean_price")) { - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins"); - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day"); + if (hasAuctionPrice) { + int auctionPrice = (int) (auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(auctionPrice) + " coins"); + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(auctionInfo.get("sales").getAsFloat()) + " sales/day"); + if (auctionInfo.has("clean_price")) { + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price (Clean): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format((int) auctionInfo.get("clean_price").getAsFloat()) + " coins"); + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales (Clean): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(auctionInfo.get("clean_sales").getAsFloat()) + " sales/day"); } } - if(craftCost.fromRecipe) { - tooltipToRender.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins"); + if (craftCost.fromRecipe) { + tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format((int) craftCost.craftCost) + " coins"); } tooltipToRender.add(""); } - if(rightStack != null) tooltipToRender.addAll(rightStack.getTooltip(Minecraft.getMinecraft().thePlayer, false)); - } else if(mouseY > guiTop+126 && mouseY < guiTop+126+16) { - if(middleStack != null) tooltipToRender = middleStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + if (rightStack != null) + tooltipToRender.addAll(rightStack.getTooltip(Minecraft.getMinecraft().thePlayer, false)); + } else if (mouseY > guiTop + 126 && mouseY < guiTop + 126 + 16) { + if (middleStack != null) + tooltipToRender = middleStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); } } - } catch(NullPointerException e) { //i cant be bothered + } catch (NullPointerException e) { //i cant be bothered } } - } else if(containerName.trim().equals("Confirm Bid") || containerName.trim().equals("Confirm Purchase")) { + } else if (containerName.trim().equals("Confirm Bid") || containerName.trim().equals("Confirm Purchase")) { Minecraft.getMinecraft().getTextureManager().bindTexture(auction_accept); this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 78, 172); - if(auctionViewLeft+31 > guiLeft+getXSize()) { + if (auctionViewLeft + 31 > guiLeft + getXSize()) { try { ItemStack leftStack = auctionView.inventorySlots.getSlot(11).getStack(); ItemStack middleStack = auctionView.inventorySlots.getSlot(13).getStack(); ItemStack rightStack = auctionView.inventorySlots.getSlot(15).getStack(); - Utils.drawItemStack(middleStack, auctionViewLeft+31, guiTop+78); + Utils.drawItemStack(middleStack, auctionViewLeft + 31, guiTop + 78); boolean topHovered = false; boolean bottomHovered = false; - if(mouseX > auctionViewLeft+31 && mouseX guiTop+31 && mouseY < guiTop+31+16) { - if(leftStack != null) { + if (mouseX > auctionViewLeft + 31 && mouseX < auctionViewLeft + 31 + 16) { + if (mouseY > guiTop + 31 && mouseY < guiTop + 31 + 16) { + if (leftStack != null) { topHovered = true; tooltipToRender = leftStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); } - } else if(mouseY > guiTop+125 && mouseY < guiTop+125+16) { - if(rightStack != null) { + } else if (mouseY > guiTop + 125 && mouseY < guiTop + 125 + 16) { + if (rightStack != null) { bottomHovered = true; tooltipToRender = rightStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); } - } else if(mouseY > guiTop+78 && mouseY < guiTop+78+16) { - if(middleStack != null) tooltipToRender = middleStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + } else if (mouseY > guiTop + 78 && mouseY < guiTop + 78 + 16) { + if (middleStack != null) + tooltipToRender = middleStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); } } GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons); - this.drawTexturedModalRect(auctionViewLeft+31, guiTop+31, topHovered?16:0, 48, 16, 16); - this.drawTexturedModalRect(auctionViewLeft+31, guiTop+125, bottomHovered?16:0, 64, 16, 16); - } catch(NullPointerException blah) { //i cant be bothered + this.drawTexturedModalRect(auctionViewLeft + 31, guiTop + 31, topHovered ? 16 : 0, 48, 16, 16); + this.drawTexturedModalRect(auctionViewLeft + 31, guiTop + 125, bottomHovered ? 16 : 0, 64, 16, 16); + } catch (NullPointerException blah) { //i cant be bothered } } } Utils.drawStringCenteredScaledMaxWidth(containerName, Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft+39, guiTop+10, false, 70, 4210752); - } else if(isEditingPrice()) { + auctionViewLeft + 39, guiTop + 10, false, 70, 4210752); + } else if (isEditingPrice()) { + hasPopup = true; resetCurrAucIdTimer = System.currentTimeMillis(); - float slideAmount = 1-Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch)/200f)); - int auctionViewLeft = guiLeft+getXSize()+4 - (int)(slideAmount*(96+4)); + float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f)); + int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (96 + 4)); - if(priceField.getText().equals("IAUSHDIUAH")) priceField.setText(""+startingBid); + if (priceField.getText().equals("IAUSHDIUAH")) priceField.setText("" + startingBid); searchField.setFocused(false); priceField.setFocused(true); - priceField.xPosition = auctionViewLeft+18; - priceField.yPosition = guiTop+18; + priceField.xPosition = auctionViewLeft + 18; + priceField.yPosition = guiTop + 18; Minecraft.getMinecraft().getTextureManager().bindTexture(auction_price); this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 96, 99); priceField.drawTextBox(); Utils.drawStringCenteredScaledMaxWidth("Bid Amount", Minecraft.getMinecraft().fontRendererObj, - auctionViewLeft+39, guiTop+10, false, 70, 4210752); + auctionViewLeft + 39, guiTop + 10, false, 70, 4210752); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons); - this.drawTexturedModalRect(auctionViewLeft+16, guiTop+32, 0, 16, 30, 16); - this.drawTexturedModalRect(auctionViewLeft+16+34, guiTop+32, 0, 16, 30, 16); - this.drawTexturedModalRect(auctionViewLeft+16, guiTop+50, 0, 16, 30, 16); - this.drawTexturedModalRect(auctionViewLeft+16+34, guiTop+50, 0, 16, 30, 16); - this.drawTexturedModalRect(auctionViewLeft+16, guiTop+68, 0, 32, 64, 16); + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32, 0, 16, 30, 16); + this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32, 0, 16, 30, 16); + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 0, 16, 30, 16); + 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, + 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, + 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, + 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, + 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, + Utils.drawStringCentered("Set Amount", fr, auctionViewLeft + 16 + 32, guiTop + 68 + 8, false, Color.BLACK.getRGB()); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GuiEditSign editSign = (GuiEditSign) Minecraft.getMinecraft().currentScreen; - TileEntitySign tes = (TileEntitySign)Utils.getField(GuiEditSign.class, editSign, + TileEntitySign tes = (TileEntitySign) Utils.getField(GuiEditSign.class, editSign, "tileSign", "field_146848_f"); tes.lineBeingEdited = 0; tes.signText[0] = new ChatComponentText(priceField.getText()); } else { - if(System.currentTimeMillis() - resetCurrAucIdTimer > 500 && - System.currentTimeMillis() - currAucIdSetTimer > 500) { + if (System.currentTimeMillis() - resetCurrAucIdTimer > 500 && + System.currentTimeMillis() - currAucIdSetTimer > 500) { currentAucId = null; currAucIdSetTimer = System.currentTimeMillis(); } @@ -729,40 +768,40 @@ public class CustomAH extends Gui { Minecraft.getMinecraft().getTextureManager().bindTexture(creativeInventoryTabs); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - if(mouseY > guiTop-28 && mouseY < guiTop+4) { - if(mouseX > guiLeft && mouseX < guiLeft+168) { - int offset = mouseX-guiLeft; - int hoveredCat = offset/28; - if(hoveredCat >= 0 && hoveredCat < mainCategories.length) { + if (mouseY > guiTop - 28 && mouseY < guiTop + 4) { + if (mouseX > guiLeft && mouseX < guiLeft + 168) { + int offset = mouseX - guiLeft; + int hoveredCat = offset / 28; + if (hoveredCat >= 0 && hoveredCat < mainCategories.length) { tooltipToRender = Utils.createList(mainCategories[hoveredCat].displayName); } } } - if(clickedMainCategory == -1) { - this.drawTexturedModalRect(guiLeft, guiTop-28, 0, 0, 168, 32); + if (clickedMainCategory == -1) { + this.drawTexturedModalRect(guiLeft, guiTop - 28, 0, 0, 168, 32); } else { - int selStart = clickedMainCategory*28; - this.drawTexturedModalRect(guiLeft, guiTop-28, 0, 0, selStart, 32); - this.drawTexturedModalRect(guiLeft+selStart+28, guiTop-28, selStart+28, 0, - 168-selStart-28, 32); + int selStart = clickedMainCategory * 28; + this.drawTexturedModalRect(guiLeft, guiTop - 28, 0, 0, selStart, 32); + this.drawTexturedModalRect(guiLeft + selStart + 28, guiTop - 28, selStart + 28, 0, + 168 - selStart - 28, 32); - if(clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) { + if (clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) { Category mainCategory = mainCategories[clickedMainCategory]; - if(mouseX > guiLeft-28 && mouseX < guiLeft) { - int offset = mouseY-(guiTop+17); - if(offset > 0) { - int hovered = offset/28-1; - if(hovered < 0) { + if (mouseX > guiLeft - 28 && mouseX < guiLeft) { + int offset = mouseY - (guiTop + 17); + if (offset > 0) { + int hovered = offset / 28 - 1; + if (hovered < 0) { tooltipToRender = Utils.createList(mainCategory.displayName); - } else if(hovered < mainCategory.subcategories.length) { + } else if (hovered < mainCategory.subcategories.length) { tooltipToRender = Utils.createList(mainCategory.subcategories[hovered].displayName); } } } - for(int i=-1; i= 0 && clickedMainCategory < mainCategories.length) { + if (clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) { Category mainCategory = mainCategories[clickedMainCategory]; - if(clickedSubCategory >= -1 && clickedSubCategory < mainCategory.subcategories.length) { + if (clickedSubCategory >= -1 && clickedSubCategory < mainCategory.subcategories.length) { drawCategorySide(clickedSubCategory); } } } //Category icons - for(int i=0; i= 0 && clickedMainCategory < mainCategories.length) { + if (clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) { Category mainCategory = mainCategories[clickedMainCategory]; - Utils.drawItemStack(mainCategory.displayItem, guiLeft-19, guiTop+23); - for(int i=0; i guiLeft+9+18*i && mouseX < guiLeft+9+18*i+16) { - if(mouseY > guiTop+112+18*splits && mouseY < guiTop+112+18*splits+16) { + for (int i = 0; i < controls.length; i++) { + Utils.drawItemStack(controls[i], guiLeft + 9 + 18 * i, guiTop + 112 + 18 * splits); + if (mouseX > guiLeft + 9 + 18 * i && mouseX < guiLeft + 9 + 18 * i + 16) { + if (mouseY > guiTop + 112 + 18 * splits && mouseY < guiTop + 112 + 18 * splits + 16) { tooltipToRender = getTooltipForControl(i); } } } int totalItems = auctionIds.size(); - int itemsScroll = (int)Math.floor((totalItems*scrollAmount)/9f)*9; + int itemsScroll = (int) Math.floor((totalItems * scrollAmount) / 9f) * 9; - int maxItemScroll = Math.max(0, totalItems - (5+splits)*9); + int maxItemScroll = Math.max(0, totalItems - (5 + splits) * 9); itemsScroll = Math.min(itemsScroll, maxItemScroll); - if(NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) { + if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) { out: - for(int i=0; i<5+splits; i++) { - int itemY = guiTop + i*18 + 18; - for(int j=0; j<9; j++) { - int itemX = guiLeft + j*18 + 9; - int id = itemsScroll + i*9 + j; - if(auctionIds.size() <= id) break out; + for (int i = 0; i < 5 + splits; i++) { + int itemY = guiTop + i * 18 + 18; + for (int j = 0; j < 9; j++) { + int itemX = guiLeft + j * 18 + 9; + int id = itemsScroll + i * 9 + j; + if (auctionIds.size() <= id) break out; try { String aucid = sortedAuctionIds.get(id); - GL11.glTranslatef(0,0,100); + GL11.glTranslatef(0, 0, 100); ItemStack stack = manager.auctionManager.getAuctionItems().get(aucid).getStack(); Utils.drawItemStack(stack, itemX, itemY); - GL11.glTranslatef(0,0,-100); + GL11.glTranslatef(0, 0, -100); - if(mouseX > itemX && mouseX < itemX+16) { - if(mouseY > itemY && mouseY < itemY+16) { + if (mouseX > itemX && mouseX < itemX + 16) { + if (mouseY > itemY && mouseY < itemY + 16) { tooltipToRender = getTooltipForAucId(aucid); } } - } catch(Exception e) { + } catch (Exception e) { } } } @@ -873,49 +912,140 @@ public class CustomAH extends Gui { Minecraft.getMinecraft().getTextureManager().bindTexture(creativeInventoryTabs); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.drawTexturedModalRect(guiLeft+175, guiTop+18+(int)((95+ySplitSize*2)*scrollAmount), - 256-(scrollClicked?12:24), 0, 12, 15); + this.drawTexturedModalRect(guiLeft + 175, guiTop + 18 + (int) ((95 + ySplitSize * 2) * scrollAmount), + 256 - (scrollClicked ? 12 : 24), 0, 12, 15); - if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) { - Utils.drawStringCentered(EnumChatFormatting.RED+"NEUAH is DISABLED! Enable in /neusettings.", - Minecraft.getMinecraft().fontRendererObj, guiLeft+getXSize()/2, guiTop+getYSize()/2-5, true, 0); + if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) { + Utils.drawStringCentered(EnumChatFormatting.RED + "NEUAH is DISABLED! Enable in /neusettings.", + Minecraft.getMinecraft().fontRendererObj, guiLeft + getXSize() / 2, guiTop + getYSize() / 2 - 5, true, 0); } - if(tooltipToRender != null) { + if (tooltipToRender != null) { List tooltipGray = new ArrayList<>(); - for(String line : tooltipToRender) { + for (String line : tooltipToRender) { tooltipGray.add(EnumChatFormatting.GRAY + line); } Utils.drawHoveringText(tooltipGray, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); } + float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f)); + int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (78 + 4)); + + // Price filter + if (!hasPopup && NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.priceFiltering) { + // Price bid filter + priceFilterField.xPosition = auctionViewLeft + 18; + priceFilterField.yPosition = guiTop + 18; + + Minecraft.getMinecraft().getTextureManager().bindTexture(auction_price); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 96, 83); + if (getPriceFilterAmount() == -1) { + priceFilterField.setTextColor(Color.RED.getRGB()); + } else { + priceFilterField.setTextColor(16777215); + } + priceFilterField.drawTextBox(); + + Utils.drawStringCenteredScaledMaxWidth("Price Filter", Minecraft.getMinecraft().fontRendererObj, + auctionViewLeft + 39, guiTop + 10, false, 70, 4210752); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons); + if (currentPriceFilterType == PriceFilter.Less) { + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32, 30, 16, 30, 16); + } else { + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32, 0, 16, 30, 16); + } + if (currentPriceFilterType == PriceFilter.Greater) { + this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32, 30, 16, 30, 16); + } else { + this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32, 0, 16, 30, 16); + } + if (currentPriceFilterType == PriceFilter.Equal) { + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 64, 32, 64, 16); + } else { + 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()); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + // Bin average price filter + binPriceFilterField.xPosition = auctionViewLeft + 18; + binPriceFilterField.yPosition = guiTop + 18 + binPriceFilterYOffset; + + Minecraft.getMinecraft().getTextureManager().bindTexture(auction_price); + this.drawTexturedModalRect(auctionViewLeft, guiTop + binPriceFilterYOffset, 0, 0, 96, 83); + if (getBinPriceFilterAmount() == -1) { + binPriceFilterField.setTextColor(Color.RED.getRGB()); + } else { + binPriceFilterField.setTextColor(16777215); + } + binPriceFilterField.drawTextBox(); + + Utils.drawStringCenteredScaledMaxWidth("BIN Average Filter", Minecraft.getMinecraft().fontRendererObj, + 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); + if (currentBinPriceFilterType == PriceFilter.Less) { + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32 + binPriceFilterYOffset, 30, 16, 30, 16); + } else { + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32 + binPriceFilterYOffset, 0, 16, 30, 16); + } + if (currentBinPriceFilterType == PriceFilter.Greater) { + this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32 + binPriceFilterYOffset, 30, 16, 30, 16); + } else { + this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32 + binPriceFilterYOffset, 0, 16, 30, 16); + } + if (currentBinPriceFilterType == PriceFilter.Equal) { + this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50 + binPriceFilterYOffset, 64, 32, 64, 16); + } else { + 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()); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } } public List getTooltipForControl(int index) { List lore = new ArrayList<>(); - if(