|
23 | 23 | import net.minecraft.client.gui.inventory.GuiContainer; |
24 | 24 | import net.minecraft.client.gui.inventory.GuiCrafting; |
25 | 25 | import net.minecraft.client.gui.inventory.GuiEditSign; |
| 26 | +import net.minecraft.client.network.NetworkPlayerInfo; |
26 | 27 | import net.minecraft.client.renderer.GlStateManager; |
| 28 | +import net.minecraft.entity.player.EntityPlayer; |
27 | 29 | import net.minecraft.event.ClickEvent; |
28 | 30 | import net.minecraft.init.Blocks; |
29 | 31 | import net.minecraft.inventory.ContainerChest; |
|
35 | 37 | import net.minecraft.util.ChatComponentText; |
36 | 38 | import net.minecraft.util.EnumChatFormatting; |
37 | 39 | import net.minecraftforge.client.event.*; |
| 40 | +import net.minecraftforge.event.entity.player.EntityInteractEvent; |
38 | 41 | import net.minecraftforge.event.entity.player.ItemTooltipEvent; |
| 42 | +import net.minecraftforge.event.entity.player.PlayerInteractEvent; |
39 | 43 | import net.minecraftforge.fml.common.Loader; |
40 | 44 | import net.minecraftforge.fml.common.eventhandler.EventPriority; |
41 | 45 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; |
@@ -180,16 +184,18 @@ public void onTick(TickEvent.ClientTickEvent event) { |
180 | 184 | displayUpdateMessageIfOutOfDate(); |
181 | 185 | } |
182 | 186 |
|
183 | | - long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L; |
184 | | - if(maxMemoryMB > 4100) { |
185 | | - notificationDisplayMillis = System.currentTimeMillis(); |
186 | | - notificationLines = new ArrayList<>(); |
187 | | - notificationLines.add(EnumChatFormatting.DARK_RED+"Too much memory allocated!"); |
188 | | - notificationLines.add(String.format(EnumChatFormatting.DARK_GRAY+"NEU has detected %03dMB of memory allocated to Minecraft!", maxMemoryMB)); |
189 | | - notificationLines.add(EnumChatFormatting.DARK_GRAY+"It is recommended to allocated between 2-4GB of memory"); |
190 | | - notificationLines.add(EnumChatFormatting.DARK_GRAY+"More than 4GB WILL cause FPS issues, EVEN if you have 16GB+ available"); |
191 | | - notificationLines.add(""); |
192 | | - notificationLines.add(EnumChatFormatting.DARK_GRAY+"For more information, visit #ram-info in discord.gg/spr6ESn"); |
| 187 | + if(NotEnoughUpdates.INSTANCE.manager.config.doRamNotif.value) { |
| 188 | + long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L; |
| 189 | + if(maxMemoryMB > 4100) { |
| 190 | + notificationDisplayMillis = System.currentTimeMillis(); |
| 191 | + notificationLines = new ArrayList<>(); |
| 192 | + notificationLines.add(EnumChatFormatting.DARK_RED+"Too much memory allocated!"); |
| 193 | + notificationLines.add(String.format(EnumChatFormatting.DARK_GRAY+"NEU has detected %03dMB of memory allocated to Minecraft!", maxMemoryMB)); |
| 194 | + notificationLines.add(EnumChatFormatting.DARK_GRAY+"It is recommended to allocated between 2-4GB of memory"); |
| 195 | + notificationLines.add(EnumChatFormatting.DARK_GRAY+"More than 4GB WILL cause FPS issues, EVEN if you have 16GB+ available"); |
| 196 | + notificationLines.add(""); |
| 197 | + notificationLines.add(EnumChatFormatting.DARK_GRAY+"For more information, visit #ram-info in discord.gg/spr6ESn"); |
| 198 | + } |
193 | 199 | } |
194 | 200 |
|
195 | 201 | if(!neu.manager.config.loadedModBefore.value) { |
@@ -358,6 +364,10 @@ public void onRenderGameOverlay(RenderGameOverlayEvent event) { |
358 | 364 | AtomicBoolean missingRecipe = new AtomicBoolean(false); |
359 | 365 | @SubscribeEvent |
360 | 366 | public void onGuiOpen(GuiOpenEvent event) { |
| 367 | + if(!(event.gui instanceof GuiContainer) && Minecraft.getMinecraft().currentScreen != null) { |
| 368 | + CalendarOverlay.setEnabled(false); |
| 369 | + } |
| 370 | + |
361 | 371 | neu.manager.auctionManager.customAH.lastGuiScreenSwitch = System.currentTimeMillis(); |
362 | 372 | BetterContainers.reset(); |
363 | 373 |
|
@@ -493,6 +503,24 @@ public void onGuiOpen(GuiOpenEvent event) { |
493 | 503 | } |
494 | 504 | } |
495 | 505 |
|
| 506 | + @SubscribeEvent |
| 507 | + public void onPlayerInteract(EntityInteractEvent event) { |
| 508 | + if(!event.isCanceled() && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && |
| 509 | + Minecraft.getMinecraft().thePlayer.isSneaking() && |
| 510 | + Minecraft.getMinecraft().ingameGUI != null) { |
| 511 | + if(event.target instanceof EntityPlayer) { |
| 512 | + for(NetworkPlayerInfo info : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { |
| 513 | + String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); |
| 514 | + if(name.contains("Status: "+EnumChatFormatting.RESET+EnumChatFormatting.BLUE+"Guest")) { |
| 515 | + NotEnoughUpdates.INSTANCE.sendChatMessage("/trade " + event.target.getName()); |
| 516 | + event.setCanceled(true); |
| 517 | + break; |
| 518 | + } |
| 519 | + } |
| 520 | + } |
| 521 | + } |
| 522 | + } |
| 523 | + |
496 | 524 | /** |
497 | 525 | * 1) When receiving "You are playing on profile" messages, will set the current profile. |
498 | 526 | * 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI) |
@@ -665,12 +693,14 @@ public void onGuiScreenDrawPost(GuiScreenEvent.DrawScreenEvent.Post event) { |
665 | 693 | if(!(TradeWindow.tradeWindowActive() || event.gui instanceof CustomAHGui || |
666 | 694 | neu.manager.auctionManager.customAH.isRenderOverAuctionView())) { |
667 | 695 | if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) { |
| 696 | + GlStateManager.pushMatrix(); |
668 | 697 | if(!focusInv) { |
669 | 698 | GL11.glTranslatef(0, 0, 300); |
670 | 699 | neu.overlay.render(hoverInv && focusInv); |
671 | 700 | GL11.glTranslatef(0, 0, -300); |
672 | 701 | } |
673 | 702 | neu.overlay.renderOverlay(); |
| 703 | + GlStateManager.popMatrix(); |
674 | 704 | } |
675 | 705 | } |
676 | 706 | } |
@@ -727,7 +757,10 @@ private void renderDungeonChestOverlay(GuiScreen gui) { |
727 | 757 | worthBIN = bazaarPrice; |
728 | 758 | worthAUC = bazaarPrice; |
729 | 759 | } else { |
730 | | - worthBIN = neu.manager.auctionManager.getLowestBin(internal); |
| 760 | + worthBIN = neu.manager.auctionManager.getItemAvgBin(internal); |
| 761 | + if(worthBIN <= 0) { |
| 762 | + worthBIN = neu.manager.auctionManager.getLowestBin(internal); |
| 763 | + } |
731 | 764 | JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal); |
732 | 765 | if(aucInfo != null) { |
733 | 766 | worthAUC = aucInfo.get("price").getAsFloat(); |
@@ -1250,7 +1283,50 @@ public void onItemTooltipLow(ItemTooltipEvent event) { |
1250 | 1283 | if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { |
1251 | 1284 | newTooltip.add(EnumChatFormatting.GRAY+"[SHIFT for Price Info]"); |
1252 | 1285 | } else { |
1253 | | - JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); |
| 1286 | + JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internalname); |
| 1287 | + float lowestBinAvg = neu.manager.auctionManager.getItemAvgBin(internalname); |
| 1288 | + |
| 1289 | + int lowestBin = neu.manager.auctionManager.getLowestBin(internalname); |
| 1290 | + APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname); |
| 1291 | + |
| 1292 | + boolean hasAuctionPrice = auctionInfo != null; |
| 1293 | + boolean hasLowestBinPrice = lowestBin > 0 && neu.manager.config.advancedPriceInfo.value; |
| 1294 | + boolean hasLowestBinAvgPrice = lowestBinAvg > 0; |
| 1295 | + |
| 1296 | + NumberFormat format = NumberFormat.getInstance(Locale.US); |
| 1297 | + |
| 1298 | + if(hasLowestBinPrice) { |
| 1299 | + newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+ |
| 1300 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); |
| 1301 | + } |
| 1302 | + if(hasLowestBinAvgPrice) { |
| 1303 | + newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+ |
| 1304 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins"); |
| 1305 | + } |
| 1306 | + if(hasAuctionPrice) { |
| 1307 | + int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); |
| 1308 | + newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+ |
| 1309 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins"); |
| 1310 | + if(neu.manager.config.advancedPriceInfo.value) { |
| 1311 | + newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+ |
| 1312 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("sales").getAsFloat())+" sales/day"); |
| 1313 | + } |
| 1314 | + if(auctionInfo.has("clean_price")) { |
| 1315 | + newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+ |
| 1316 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins"); |
| 1317 | + if(neu.manager.config.advancedPriceInfo.value) { |
| 1318 | + newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+ |
| 1319 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day"); |
| 1320 | + } |
| 1321 | + } |
| 1322 | + |
| 1323 | + } |
| 1324 | + if(hasAuctionPrice && craftCost.fromRecipe) { |
| 1325 | + newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+ |
| 1326 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins"); |
| 1327 | + } |
| 1328 | + |
| 1329 | + /*JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); |
1254 | 1330 |
|
1255 | 1331 | boolean hasAuctionPrice = auctionInfo != null; |
1256 | 1332 |
|
@@ -1280,7 +1356,7 @@ public void onItemTooltipLow(ItemTooltipEvent event) { |
1280 | 1356 | if(craftCost.fromRecipe) { |
1281 | 1357 | newTooltip.add(EnumChatFormatting.GRAY+"Raw Craft Cost: "+ |
1282 | 1358 | EnumChatFormatting.GOLD+format.format((int)craftCost.craftCost)+" coins"); |
1283 | | - } |
| 1359 | + }*/ |
1284 | 1360 | } |
1285 | 1361 | } |
1286 | 1362 | } |
@@ -1314,10 +1390,28 @@ public void onItemTooltipLow(ItemTooltipEvent event) { |
1314 | 1390 | ItemStack item = lower.getStackInSlot(11+i); |
1315 | 1391 | String internal = neu.manager.getInternalNameForItem(item); |
1316 | 1392 | if(internal != null) { |
1317 | | - float worthBIN = neu.manager.auctionManager.getLowestBin(internal); |
1318 | | - float worthAUC = neu.manager.auctionManager.getLowestBin(internal); |
| 1393 | + float bazaarPrice = -1; |
| 1394 | + JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internal); |
| 1395 | + if(bazaarInfo != null && bazaarInfo.has("avg_sell")) { |
| 1396 | + bazaarPrice = bazaarInfo.get("avg_sell").getAsFloat(); |
| 1397 | + } |
| 1398 | + |
| 1399 | + float worthBIN = -1; |
| 1400 | + float worthAUC = -1; |
1319 | 1401 |
|
1320 | | - if(worthAUC == -1) worthAUC = neu.manager.auctionManager.getCraftCost(internal).craftCost; |
| 1402 | + if(bazaarPrice > 0) { |
| 1403 | + worthBIN = bazaarPrice; |
| 1404 | + worthAUC = bazaarPrice; |
| 1405 | + } else { |
| 1406 | + worthBIN = neu.manager.auctionManager.getItemAvgBin(internal); |
| 1407 | + if(worthBIN <= 0) { |
| 1408 | + worthBIN = neu.manager.auctionManager.getLowestBin(internal); |
| 1409 | + } |
| 1410 | + JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal); |
| 1411 | + if(aucInfo != null) { |
| 1412 | + worthAUC = aucInfo.get("price").getAsFloat(); |
| 1413 | + } |
| 1414 | + } |
1321 | 1415 |
|
1322 | 1416 | if(worthAUC <= 0 && worthBIN <= 0) { |
1323 | 1417 | missing = true; |
@@ -1392,21 +1486,27 @@ public void onItemTooltipLow(ItemTooltipEvent event) { |
1392 | 1486 | if(internalname != null) { |
1393 | 1487 | JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internalname); |
1394 | 1488 | JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internalname); |
| 1489 | + float lowestBinAvg = neu.manager.auctionManager.getItemAvgBin(internalname); |
1395 | 1490 |
|
1396 | 1491 | int lowestBin = neu.manager.auctionManager.getLowestBin(internalname); |
1397 | 1492 | APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname); |
1398 | 1493 |
|
1399 | 1494 | boolean hasAuctionPrice = neu.manager.config.invAuctionPrice.value && auctionInfo != null; |
1400 | 1495 | boolean hasBazaarPrice = neu.manager.config.invBazaarPrice.value && bazaarInfo != null; |
1401 | | - boolean hasLowestBinPrice = neu.manager.config.invAuctionPrice.value && lowestBin > 0; |
| 1496 | + boolean hasLowestBinPrice = neu.manager.config.invAuctionPrice.value && lowestBin > 0 && neu.manager.config.advancedPriceInfo.value; |
| 1497 | + boolean hasLowestBinAvgPrice = neu.manager.config.invAuctionPrice.value && lowestBinAvg > 0; |
1402 | 1498 |
|
1403 | 1499 | NumberFormat format = NumberFormat.getInstance(Locale.US); |
1404 | 1500 |
|
1405 | | - if(hasAuctionPrice || hasBazaarPrice || hasLowestBinPrice) event.toolTip.add(""); |
| 1501 | + if(hasAuctionPrice || hasBazaarPrice || hasLowestBinAvgPrice || hasLowestBinPrice) event.toolTip.add(""); |
1406 | 1502 | if(hasLowestBinPrice) { |
1407 | 1503 | event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+ |
1408 | 1504 | EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); |
1409 | 1505 | } |
| 1506 | + if(hasLowestBinAvgPrice) { |
| 1507 | + event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+ |
| 1508 | + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins"); |
| 1509 | + } |
1410 | 1510 | if(hasAuctionPrice) { |
1411 | 1511 | int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); |
1412 | 1512 | event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+ |
|
0 commit comments