diff options
Diffstat (limited to 'src')
10 files changed, 71 insertions, 71 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index 4b5630bc..b47a7c7f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -101,9 +101,9 @@ public class ItemPriceInformation { } JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname); - float lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname); + double lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname); - int lowestBin = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname); + long lowestBin = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname); APIManager.CraftInfo craftCost = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(internalname); boolean bazaarItem = bazaarInfo != null; @@ -211,7 +211,7 @@ public class ItemPriceInformation { tooltip.add(""); added = true; } - float cost = craftCost.craftCost; + double cost = craftCost.craftCost; if (shiftPressed) cost = cost * shiftStackMultiplier; tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index c048ce1b..de050e5e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1261,8 +1261,8 @@ public class NEUOverlay extends Gui { String internal1 = o1.get("internalname").getAsString(); String internal2 = o2.get("internalname").getAsString(); - float cost1 = manager.auctionManager.getLowestBin(internal1); - float cost2 = manager.auctionManager.getLowestBin(internal2); + double cost1 = manager.auctionManager.getLowestBin(internal1); + double cost2 = manager.auctionManager.getLowestBin(internal2); if (cost1 < cost2) return mult; if (cost1 > cost2) return -mult; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index d4b6bd05..7c58cb4d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -273,11 +273,11 @@ public class APIManager { return keys; } - public int getLowestBin(String internalname) { - if (lowestBins != null && lowestBins.has(internalname)) { - JsonElement e = lowestBins.get(internalname); + public long getLowestBin(String internalName) { + if (lowestBins != null && lowestBins.has(internalName)) { + JsonElement e = lowestBins.get(internalName); if (e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) { - return e.getAsBigDecimal().intValue(); + return e.getAsBigDecimal().longValue(); } } return -1; @@ -775,13 +775,13 @@ public class APIManager { return e.getAsJsonObject(); } - public float getItemAvgBin(String internalname) { + public double getItemAvgBin(String internalName) { if (auctionPricesAvgLowestBinJson == null) return -1; - JsonElement e = auctionPricesAvgLowestBinJson.get(internalname); + JsonElement e = auctionPricesAvgLowestBinJson.get(internalName); if (e == null) { return -1; } - return Math.round(e.getAsFloat()); + return Math.round(e.getAsDouble()); } public Set<String> getBazaarKeySet() { @@ -823,7 +823,7 @@ public class APIManager { public static class CraftInfo { public boolean fromRecipe = false; public boolean vanillaItem = false; - public float craftCost = -1; + public double craftCost = -1; } public CraftInfo getCraftCost(String internalname) { @@ -839,10 +839,10 @@ public class APIManager { visited.add(internalname); boolean vanillaItem = isVanillaItem(internalname); - float craftCost = Float.POSITIVE_INFINITY; + double craftCost = Double.POSITIVE_INFINITY; JsonObject auctionInfo = getItemAuctionInfo(internalname); - float lowestBin = getLowestBin(internalname); + double lowestBin = getLowestBin(internalname); JsonObject bazaarInfo = getBazaarInfo(internalname); if (bazaarInfo != null && bazaarInfo.get("curr_buy") != null) { @@ -889,7 +889,7 @@ public class APIManager { } } visited.remove(internalname); - if (Float.isInfinite(craftCost)) { + if (Double.isInfinite(craftCost)) { return null; } CraftInfo craftInfo = new CraftInfo(); 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 b5d34ed7..d8fedecb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -679,7 +679,7 @@ public class CustomAH extends Gui { boolean hasAuctionPrice = auctionInfo != null; boolean hasBazaarPrice = bazaarInfo != null; - int lowestBin = manager.auctionManager.getLowestBin(internalname); + long lowestBin = manager.auctionManager.getLowestBin(internalname); NumberFormat format = NumberFormat.getInstance(Locale.US); @@ -1375,7 +1375,7 @@ public class CustomAH extends Gui { } } if (getBinPriceFilterAmount() > -1) { - int lowestBin = + long lowestBin = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem( auc.getStack())); if (lowestBin > 0) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java index 1dc45cf8..14df3926 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java @@ -559,7 +559,7 @@ public class ItemTooltipListener { String missingItem = null; int totalValue = 0; - HashMap<String, Float> itemValues = new HashMap<>(); + HashMap<String, Double> itemValues = new HashMap<>(); for (int i = 0; i < 5; i++) { ItemStack item = lower.getStackInSlot(11 + i); String internal = neu.manager.getInternalNameForItem(item); @@ -572,7 +572,7 @@ public class ItemTooltipListener { } if (bazaarPrice < 5000000 && internal.equals("RECOMBOBULATOR_3000")) bazaarPrice = 5000000; - float worth = -1; + double worth = -1; if (bazaarPrice > 0) { worth = bazaarPrice; } else { @@ -584,9 +584,9 @@ public class ItemTooltipListener { JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internal); if (auctionInfo != null) { if (auctionInfo.has("clean_price")) { - worth = (int) auctionInfo.get("clean_price").getAsFloat(); + worth = (long)auctionInfo.get("clean_price").getAsDouble(); } else { - worth = (int) (auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); + worth = (long) (auctionInfo.get("price").getAsDouble() / auctionInfo.get("count").getAsDouble()); } } break; @@ -675,7 +675,7 @@ public class ItemTooltipListener { newTooltip.add(neu + EnumChatFormatting.YELLOW + "Profit/Loss: " + plStringBIN); } - for (Map.Entry<String, Float> entry : itemValues.entrySet()) { + for (Map.Entry<String, Double> entry : itemValues.entrySet()) { newTooltip.add(neu + entry.getKey() + prefix + "+" + format.format(entry.getValue().intValue())); } } 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 0c3f592b..35a3581a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java @@ -717,7 +717,7 @@ public class RenderListener { String missingItem = null; int totalValue = 0; - HashMap<String, Float> itemValues = new HashMap<>(); + HashMap<String, Double> itemValues = new HashMap<>(); for (int i = 0; i < 5; i++) { ItemStack item = lower.getStackInSlot(11 + i); String internal = neu.manager.getInternalNameForItem(item); @@ -730,7 +730,7 @@ public class RenderListener { } if (bazaarPrice < 5000000 && internal.equals("RECOMBOBULATOR_3000")) bazaarPrice = 5000000; - float worth = -1; + double worth = -1; if (bazaarPrice > 0) { worth = bazaarPrice; } else { @@ -742,9 +742,9 @@ public class RenderListener { JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internal); if (auctionInfo != null) { if (auctionInfo.has("clean_price")) { - worth = (int) auctionInfo.get("clean_price").getAsFloat(); + worth = (long) auctionInfo.get("clean_price").getAsDouble(); } else { - worth = (int) (auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); + worth = (long) (auctionInfo.get("price").getAsDouble() / auctionInfo.get("count").getAsDouble()); } } break; @@ -813,7 +813,7 @@ public class RenderListener { valueStringBIN2 = missingItem; } - int profitLossBIN = totalValue - chestCost; + long profitLossBIN = totalValue - chestCost; boolean kismetUsed = false; // checking for kismet @@ -827,7 +827,7 @@ public class RenderListener { } } } - int kismetPrice = neu.manager.auctionManager.getLowestBin("KISMET_FEATHER"); + long kismetPrice = neu.manager.auctionManager.getLowestBin("KISMET_FEATHER"); String kismetStr = EnumChatFormatting.RED + format.format(kismetPrice) + " coins"; if (neu.config.dungeons.useKismetOnDungeonProfit) profitLossBIN = kismetUsed ? profitLossBIN - kismetPrice : profitLossBIN; @@ -884,10 +884,10 @@ public class RenderListener { } int index = 0; - for (Map.Entry<String, Float> entry : itemValues.entrySet()) { + for (Map.Entry<String, Double> entry : itemValues.entrySet()) { Utils.renderAlignedString( entry.getKey(), - prefix + format.format(entry.getValue().intValue()), + prefix + format.format(entry.getValue().longValue()), guiLeft + xSize + 4 + 10, guiTop + (neu.config.dungeons.useKismetOnDungeonProfit ? (kismetUsed ? 39 : 29) : 29) + (++index) * 10, 160 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 c52f8968..0d2d863d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java @@ -54,9 +54,9 @@ public class AuctionBINWarning extends GuiElement { private boolean showWarning = false; private List<String> sellingTooltip; private String sellingName; - private int sellingPrice; - private int lowestPrice; - private int buyPercentage; + private long sellingPrice; + private long lowestPrice; + private long buyPercentage; private int sellStackAmount; private boolean isALoss = true; @@ -96,7 +96,7 @@ public class AuctionBINWarning extends GuiElement { if (priceMatcher.matches()) { try { - sellingPrice = Integer.parseInt(priceMatcher.group(1).replace(",", "")); + sellingPrice = Long.parseLong(priceMatcher.group(1).replace(",", "")); } catch (NumberFormatException ignored) { } } 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 c8fd0fde..513252dc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -838,7 +838,7 @@ public class AccessoryBagOverlay { private static Comparator<String> getItemComparator() { return (o1, o2) -> { - float cost1; + double cost1; JsonObject o1Auc = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(o1); if (o1Auc != null && o1Auc.has("price")) { cost1 = o1Auc.get("price").getAsFloat(); @@ -849,7 +849,7 @@ public class AccessoryBagOverlay { else cost1 = 0; } - float cost2; + double cost2; JsonObject o2Auc = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(o2); if (o2Auc != null && o2Auc.has("price")) { cost2 = o2Auc.get("price").getAsFloat(); 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 6107985c..8a0353d3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java @@ -122,25 +122,25 @@ public class TradeWindow { ); } - private static int getPrice(String internalname) { - int pricePer = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname); + private static long getPrice(String internalName) { + long pricePer = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalName); if (pricePer == -1) { - JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname); + JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalName); if (bazaarInfo != null && bazaarInfo.has("avg_buy")) { - pricePer = (int) bazaarInfo.get("avg_buy").getAsFloat(); + pricePer = (long) bazaarInfo.get("avg_buy").getAsDouble(); } } if (pricePer == -1) { - JsonObject info = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); - if (info != null && !NotEnoughUpdates.INSTANCE.manager.auctionManager.isVanillaItem(internalname) && + JsonObject info = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalName); + if (info != null && !NotEnoughUpdates.INSTANCE.manager.auctionManager.isVanillaItem(internalName) && info.has("price") && info.has("count")) { - int auctionPricePer = (int) (info.get("price").getAsFloat() / info.get("count").getAsFloat()); + long auctionPricePer = (long) (info.get("price").getAsDouble() / info.get("count").getAsDouble()); pricePer = auctionPricePer; } } if (pricePer == -1) { - APIManager.CraftInfo craftCost = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(internalname); + APIManager.CraftInfo craftCost = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(internalName); if (craftCost != null) { pricePer = (int) craftCost.craftCost; } @@ -148,8 +148,8 @@ public class TradeWindow { return pricePer; } - private static int processTopItems( - ItemStack stack, Map<Integer, Set<String>> topItems, + private static long processTopItems( + ItemStack stack, Map<Long, Set<String>> topItems, Map<String, ItemStack> topItemsStack, Map<String, Integer> topItemsCount ) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); @@ -188,9 +188,9 @@ public class TradeWindow { topItemsStack.putIfAbsent("TRADE_COINS", stack); - int existingPrice = coins; - Set<Integer> toRemove = new HashSet<>(); - for (Map.Entry<Integer, Set<String>> entry : topItems.entrySet()) { + long existingPrice = coins; + Set<Long> toRemove = new HashSet<>(); + for (Map.Entry<Long, Set<String>> entry : topItems.entrySet()) { if (entry.getValue().contains("TRADE_COINS")) { entry.getValue().remove("TRADE_COINS"); existingPrice += entry.getKey(); @@ -208,12 +208,12 @@ public class TradeWindow { } } } else { - int pricePer = getPrice(internalname); + long pricePer = getPrice(internalname); if (pricePer > 0) { topItemsStack.putIfAbsent(internalname, stack); - int price = pricePer * stack.stackSize; - int priceInclBackpack = price; + long price = pricePer * stack.stackSize; + long priceInclBackpack = price; NBTTagCompound tag = stack.getTagCompound(); if (tag != null && tag.hasKey("ExtraAttributes", 10)) { @@ -254,9 +254,9 @@ public class TradeWindow { } } - int existingPrice = price; - Set<Integer> toRemove = new HashSet<>(); - for (Map.Entry<Integer, Set<String>> entry : topItems.entrySet()) { + long existingPrice = price; + Set<Long> toRemove = new HashSet<>(); + for (Map.Entry<Long, Set<String>> entry : topItems.entrySet()) { if (entry.getValue().contains(internalname)) { entry.getValue().remove(internalname); existingPrice += entry.getKey(); @@ -300,7 +300,7 @@ public class TradeWindow { NBTTagCompound nbt = items.getCompoundTagAt(k).getCompoundTag("tag"); String internalname2 = NotEnoughUpdates.INSTANCE.manager.getInternalnameFromNBT(nbt); if (internalname2 != null) { - int pricePer2 = getPrice(internalname2); + long pricePer2 = getPrice(internalname2); if (pricePer2 > 0) { int count2 = items.getCompoundTagAt(k).getByte("Count"); price += pricePer2 * count2; @@ -333,7 +333,7 @@ public class TradeWindow { //Set index mappings //Our slots - TreeMap<Integer, List<Integer>> ourTradeMap = new TreeMap<>(); + TreeMap<Long, List<Integer>> ourTradeMap = new TreeMap<>(); for (int i = 0; i < 16; i++) { ourTradeIndexes[i] = -1; @@ -378,19 +378,19 @@ public class TradeWindow { try { int coins = (int) (Float.parseFloat(sb.toString()) * mult); - List<Integer> list = ourTradeMap.computeIfAbsent(coins, k -> new ArrayList<>()); + List<Integer> list = ourTradeMap.computeIfAbsent((long) coins, k -> new ArrayList<>()); list.add(containerIndex); } catch (Exception ignored) { - List<Integer> list = ourTradeMap.computeIfAbsent(-1, k -> new ArrayList<>()); + List<Integer> list = ourTradeMap.computeIfAbsent(-1L, k -> new ArrayList<>()); list.add(containerIndex); } } else { - List<Integer> list = ourTradeMap.computeIfAbsent(-1, k -> new ArrayList<>()); + List<Integer> list = ourTradeMap.computeIfAbsent(-1L, k -> new ArrayList<>()); list.add(containerIndex); } } else { - int price = getPrice(internalname); + long price = getPrice(internalname); if (price == -1) price = 0; price += getBackpackValue(stack); @@ -501,7 +501,7 @@ public class TradeWindow { } } int ourTradeIndex = 0; - for (Map.Entry<Integer, List<Integer>> entry : ourTradeMap.descendingMap().entrySet()) { + for (Map.Entry<Long, List<Integer>> entry : ourTradeMap.descendingMap().entrySet()) { for (Integer index : entry.getValue()) { ourTradeIndexes[ourTradeIndex++] = index; } @@ -833,7 +833,7 @@ public class TradeWindow { } if (NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePrices) { - TreeMap<Integer, Set<String>> ourTopItems = new TreeMap<>(); + TreeMap<Long, Set<String>> ourTopItems = new TreeMap<>(); TreeMap<String, ItemStack> ourTopItemsStack = new TreeMap<>(); TreeMap<String, Integer> ourTopItemsCount = new TreeMap<>(); double ourPrice = 0; @@ -847,7 +847,7 @@ public class TradeWindow { ourPrice += processTopItems(stack, ourTopItems, ourTopItemsStack, ourTopItemsCount); } - TreeMap<Integer, Set<String>> theirTopItems = new TreeMap<>(); + TreeMap<Long, Set<String>> theirTopItems = new TreeMap<>(); TreeMap<String, ItemStack> theirTopItemsStack = new TreeMap<>(); TreeMap<String, Integer> theirTopItemsCount = new TreeMap<>(); double theirPrice = 0; @@ -879,7 +879,7 @@ public class TradeWindow { int ourTopIndex = Math.max(0, 3 - ourTopItemsStack.size()); out: - for (Map.Entry<Integer, Set<String>> entry : ourTopItems.descendingMap().entrySet()) { + for (Map.Entry<Long, Set<String>> entry : ourTopItems.descendingMap().entrySet()) { for (String ourTopItemInternal : entry.getValue()) { ItemStack stack = ourTopItemsStack.get(ourTopItemInternal); if (stack == null) continue; @@ -942,7 +942,7 @@ public class TradeWindow { int theirTopIndex = Math.max(0, 3 - theirTopItemsStack.size()); out: - for (Map.Entry<Integer, Set<String>> entry : theirTopItems.descendingMap().entrySet()) { + for (Map.Entry<Long, Set<String>> entry : theirTopItems.descendingMap().entrySet()) { for (String theirTopItemInternal : entry.getValue()) { ItemStack stack = theirTopItemsStack.get(theirTopItemInternal); if (stack == null) continue; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index 7ed3a799..4797254d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -562,11 +562,11 @@ public class ProfileViewer { JsonObject bzInfo = manager.auctionManager.getBazaarInfo(internalname); - int auctionPrice; + long auctionPrice; if (bzInfo != null && bzInfo.has("curr_sell")) { auctionPrice = (int) bzInfo.get("curr_sell").getAsFloat(); } else { - auctionPrice = (int) manager.auctionManager.getItemAvgBin(internalname); + auctionPrice = (long) manager.auctionManager.getItemAvgBin(internalname); if (auctionPrice <= 0) { auctionPrice = manager.auctionManager.getLowestBin(internalname); } @@ -590,11 +590,11 @@ public class ProfileViewer { JsonObject bzInfo2 = manager.auctionManager.getBazaarInfo(internalname2); - int auctionPrice2; + long auctionPrice2; if (bzInfo2 != null && bzInfo2.has("curr_sell")) { auctionPrice2 = (int) bzInfo2.get("curr_sell").getAsFloat(); } else { - auctionPrice2 = (int) manager.auctionManager.getItemAvgBin(internalname2); + auctionPrice2 = (long) manager.auctionManager.getItemAvgBin(internalname2); if (auctionPrice2 <= 0) { auctionPrice2 = manager.auctionManager.getLowestBin(internalname2); } |