diff options
| author | Moulberry <jjenour@student.unimelb.edu.au> | 2021-06-04 08:53:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-04 08:53:31 +0000 |
| commit | 87e44e6a9443b51016964a94254875cb9761a604 (patch) | |
| tree | 20ea6e04aa613a14bdf01192b20f84ff7a60099a /src/main/java | |
| parent | a1fa5a67caebf754a0fcc43168672823ede0db93 (diff) | |
| parent | eeb5c45d71997cb259fc35330490a19db7865603 (diff) | |
| download | NotEnoughUpdates-87e44e6a9443b51016964a94254875cb9761a604.tar.gz NotEnoughUpdates-87e44e6a9443b51016964a94254875cb9761a604.tar.bz2 NotEnoughUpdates-87e44e6a9443b51016964a94254875cb9761a604.zip | |
Merge pull request #191 from carelesshippo/master
Reopened with merge conflicts resolved
Diffstat (limited to 'src/main/java')
3 files changed, 696 insertions, 443 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 895567b4..ddef0828 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; @@ -1370,7 +1371,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<subcategories.length; i++) { - categories[i+1] = subcategories[i].categoryMatch; + for (int i = 0; i < subcategories.length; i++) { + categories[i + 1] = subcategories[i].categoryMatch; } return categories; } @@ -247,6 +259,9 @@ public class CustomAH extends Gui { 84, fr.FONT_HEIGHT); this.priceField = new GuiTextField(1, fr, this.guiLeft + 82, this.guiTop + 6, 84, fr.FONT_HEIGHT); + this.priceFilterField = new GuiTextField(2, fr, this.guiLeft + 82, this.guiTop + 6, + 84, fr.FONT_HEIGHT); + this.binPriceFilterField = new GuiTextField(3, fr, this.guiLeft + 82, this.guiTop - 6, 84, fr.FONT_HEIGHT); this.searchField.setMaxStringLength(30); this.searchField.setEnableBackgroundDrawing(false); @@ -263,6 +278,22 @@ public class CustomAH extends Gui { this.priceField.setCanLoseFocus(true); this.priceField.setFocused(false); this.priceField.setText(""); + + this.priceFilterField.setMaxStringLength(10); + this.priceFilterField.setEnableBackgroundDrawing(false); + this.priceFilterField.setTextColor(16777215); + this.priceFilterField.setVisible(true); + this.priceFilterField.setCanLoseFocus(true); + this.priceFilterField.setFocused(false); + this.priceFilterField.setText(""); + + this.binPriceFilterField.setMaxStringLength(10); + this.binPriceFilterField.setEnableBackgroundDrawing(false); + this.binPriceFilterField.setTextColor(16777215); + this.binPriceFilterField.setVisible(true); + this.binPriceFilterField.setCanLoseFocus(true); + this.binPriceFilterField.setFocused(false); + this.binPriceFilterField.setText(""); } public boolean isRenderOverAuctionView() { @@ -270,7 +301,7 @@ public class CustomAH extends Gui { } public void setRenderOverAuctionView(boolean renderOverAuctionView) { - if(this.renderOverAuctionView && !renderOverAuctionView) lastRenderDisable = System.currentTimeMillis(); + if (this.renderOverAuctionView && !renderOverAuctionView) lastRenderDisable = System.currentTimeMillis(); this.renderOverAuctionView = renderOverAuctionView; } @@ -279,7 +310,7 @@ public class CustomAH extends Gui { } public int getYSize() { - return 136 + ySplitSize*splits; + return 136 + ySplitSize * splits; } private String prettyTime(long millis) { @@ -289,14 +320,14 @@ public class CustomAH extends Gui { long days = (millis / 1000 / 60 / 60 / 24); String endsIn = ""; - if(millis < 0) { + if (millis < 0) { endsIn += "Ended!"; - } else if(minutes == 0 && hours == 0 && days == 0) { + } else if (minutes == 0 && hours == 0 && days == 0) { endsIn += seconds + "s"; - } else if(hours==0 && days==0) { + } else if (hours == 0 && days == 0) { endsIn += minutes + "m" + seconds + "s"; - } else if(days==0) { - if(hours <= 6) { + } else if (days == 0) { + if (hours <= 6) { endsIn += hours + "h" + minutes + "m" + seconds + "s"; } else { endsIn += hours + "h"; @@ -313,40 +344,40 @@ public class CustomAH extends Gui { List<String> 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<Pattern, Long> 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<Pattern, Long> timeEntry : timeParseMap.entrySet()) { + for (Map.Entry<Pattern, Long> 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<String> 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<line2.length(); i++) { + for (int i = 0; i < line2.length(); i++) { char c = line2.charAt(i); - if((int)c >= 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 <auctionViewLeft+31+16 && - mouseY > 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 <auctionViewLeft+31+16) { - if(mouseY > 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); + |
