From 38bfc81ad013925463cd382bf99807d15b4fc53e Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sat, 28 Nov 2020 10:53:35 +1100 Subject: bye melb --- .../notenoughupdates/BetterContainers.java | 5 + .../notenoughupdates/CalendarOverlay.java | 60 ++++- .../notenoughupdates/NEUEventListener.java | 270 +++++++++++++-------- .../moulberry/notenoughupdates/NEUOverlay.java | 8 +- .../notenoughupdates/NotEnoughUpdates.java | 5 +- .../notenoughupdates/auction/APIManager.java | 2 +- .../notenoughupdates/dungeons/DungeonMap.java | 42 ++-- .../dungeons/GuiDungeonMapEditor.java | 51 ++-- .../notenoughupdates/mixins/MixinGuiContainer.java | 3 +- .../notenoughupdates/options/Options.java | 23 +- .../moulberry/notenoughupdates/util/Utils.java | 11 +- .../notenoughupdates/dungeon_chest_worth.png | Bin 1900 -> 2064 bytes 12 files changed, 321 insertions(+), 159 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java index 07fff01b..02ff2164 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java @@ -19,6 +19,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; import javax.imageio.ImageIO; import java.awt.*; @@ -90,6 +92,9 @@ public class BetterContainers { if(texture != null && loaded) { if(!usingCached) lastRenderMillis = System.currentTimeMillis(); lastRenderMillis = System.currentTimeMillis(); + + GlStateManager.color(1, 1, 1, 1); + textureManager.loadTexture(rl, texture); textureManager.bindTexture(rl); return; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java index ff6c500b..db168747 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java @@ -34,6 +34,8 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; + import static io.github.moulberry.notenoughupdates.GuiTextures.*; import java.io.File; @@ -92,6 +94,10 @@ public class CalendarOverlay { private int jfFavouriteSelectX = 0; private int jfFavouriteSelectY = 0; + private boolean drawTimerForeground = false; + + private static long spookyStart = 0; + private static long SECOND = 1000; private static long MINUTE = SECOND*60; private static long HOUR = MINUTE*60; @@ -649,7 +655,7 @@ public class CalendarOverlay { } @SubscribeEvent(priority = EventPriority.LOW) - public void onGuiDraw(RenderGameOverlayEvent event) { + public void onGuiDraw(RenderGameOverlayEvent.Post event) { if(NotEnoughUpdates.INSTANCE.manager.config.eventNotifications.value && event.type == RenderGameOverlayEvent.ElementType.ALL) { GlStateManager.pushMatrix(); @@ -714,6 +720,15 @@ public class CalendarOverlay { return false; } + long currentTime = System.currentTimeMillis(); + if(currentTime - spookyStart < HOUR && NotEnoughUpdates.INSTANCE.manager.config.spookyMorningNotification.value) { + long delta = (currentTime - SKYBLOCK_START) % (20*MINUTE) - 7*50*SECOND - 10*SECOND; + if(delta < 500 && delta > -8500) { + event = new SBEvent("spooky_festival_7am", "Spooky Festival 7am", new ItemStack(Items.bone), null); + timeUntil = delta; + } + } + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledResolution.getScaledWidth(); @@ -778,7 +793,23 @@ public class CalendarOverlay { } @SubscribeEvent - public void onGuiDraw(GuiScreenEvent.DrawScreenEvent.Post event) { + public void onGuiScreenDrawTimer(GuiScreenEvent.BackgroundDrawnEvent event) { + blurBackground(); + if(!drawTimerForeground) { + drawTimer(); + } + GlStateManager.color(1, 1, 1, 1); + GlStateManager.enableBlend(); + } + + @SubscribeEvent + public void onGuiScreenDrawTimer(GuiScreenEvent.DrawScreenEvent.Post event) { + if(drawTimerForeground) { + drawTimer(); + } + } + + public void drawTimer() { GlStateManager.pushMatrix(); GlStateManager.translate(0, 0, 10); if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer && NotEnoughUpdates.INSTANCE.isOnSkyblock()) { @@ -816,6 +847,12 @@ public class CalendarOverlay { continue; } + if(sbEvent.id.equals("spooky_festival")) { + if(currentTime - spookyStart > HOUR || (sbEvents.getKey() > currentTime && sbEvents.getKey() < spookyStart)) { + spookyStart = sbEvents.getKey(); + } + } + if(nextMajorEvent == null && !sbEvent.id.split(":")[0].equals("jacob_farming") && !sbEvent.id.equals("dark_auction")) { nextMajorEvent = sbEvent; @@ -865,7 +902,11 @@ public class CalendarOverlay { List tooltipToDisplay = null; FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - blurBackground(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableFog(); + GlStateManager.disableLighting(); + GlStateManager.disableColorMaterial(); + renderBlurredBackground(width, height, guiLeft+3, guiTop+3, xSize-6, ySize-6); Minecraft.getMinecraft().getTextureManager().bindTexture(DISPLAYBAR); @@ -934,8 +975,12 @@ public class CalendarOverlay { } } + drawTimerForeground = false; if(tooltipToDisplay != null) { + drawTimerForeground = true; + GlStateManager.translate(0, 0, 100); Utils.drawHoveringText(tooltipToDisplay, mouseX, Math.max(17, mouseY), width, height, -1, fr); + GlStateManager.translate(0, 0, -100); } } } @@ -980,7 +1025,6 @@ public class CalendarOverlay { Utils.drawGradientRect(0, 0, width, height, -1072689136, -804253680); - blurBackground(); renderBlurredBackground(width, height, guiLeft+3, guiTop+3, 162, 14); renderBlurredBackground(width, height, guiLeft+3, guiTop+26, 14, 141); renderBlurredBackground(width, height, guiLeft+151, guiTop+26, 14, 141); @@ -1045,6 +1089,12 @@ public class CalendarOverlay { int x = guiLeft+29+17*(index%3); int y = guiTop+44+17*(index/3); + if(sbEvent.id.equals("spooky_festival")) { + if(currentTime - spookyStart > HOUR || (sbEvents.getKey() > currentTime && sbEvents.getKey() < spookyStart)) { + spookyStart = sbEvents.getKey(); + } + } + if(index >= 21) { if(nextEvent != null) break; if(eventFavourites.isEmpty()) { @@ -1405,10 +1455,12 @@ public class CalendarOverlay { float vMin = (height-y)/(float)height; float vMax = (height-y-blurHeight)/(float)height; + GlStateManager.depthMask(false); blurOutputVert.bindFramebufferTexture(); GlStateManager.color(1f, 1f, 1f, 1f); Utils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax); blurOutputVert.unbindFramebufferTexture(); + GlStateManager.depthMask(true); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 9f33df1a..e4ec49cb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -88,14 +88,14 @@ public class NEUEventListener { String version = o.get("version").getAsString(); - if(!neu.VERSION.equalsIgnoreCase(version)) { + boolean shouldUpdate = !NotEnoughUpdates.VERSION.equalsIgnoreCase(version); + if(o.has("version_id") && o.get("version_id").isJsonPrimitive()) { + int version_id = o.get("version_id").getAsInt(); + shouldUpdate = version_id > NotEnoughUpdates.VERSION_ID; + } + + if(shouldUpdate) { String update_msg = o.get("update_msg").getAsString(); - String discord_link = o.get("discord_link").getAsString(); - String youtube_link = o.get("youtube_link").getAsString(); - String update_link = o.get("update_link").getAsString(); - String github_link = o.get("github_link").getAsString(); - String other_text = o.get("other_text").getAsString(); - String other_link = o.get("other_link").getAsString(); int first_len = -1; for(String line : update_msg.split("\n")) { @@ -119,7 +119,6 @@ public class NEUEventListener { neu.displayLinks(o); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - } } catch(Exception ignored) {} } @@ -722,7 +721,7 @@ public class NEUEventListener { Minecraft.getMinecraft().getTextureManager().bindTexture(dungeon_chest_worth); GL11.glColor4f(1, 1, 1, 1); GlStateManager.disableLighting(); - Utils.drawTexturedRect(guiLeft+xSize+4, guiTop, 180, 71, 0, 180/256f, 0, 71/256f, GL11.GL_NEAREST); + Utils.drawTexturedRect(guiLeft+xSize+4, guiTop, 180, 101, 0, 180/256f, 0, 101/256f, GL11.GL_NEAREST); int chestCost = 0; String line6 = Utils.cleanColour(neu.manager.getLoreFromNBT(rewardChest.getTagCompound())[6]); @@ -737,8 +736,11 @@ public class NEUEventListener { chestCost = Integer.parseInt(cost.toString()); } - boolean missing = false; + String missingItemBIN = null; + String missingItemABIN = null; + String missingItemAUC = null; int totalValueBIN = 0; + int totalValueABIN = 0; int totalValueAUC = 0; for(int i=0; i<5; i++) { ItemStack item = lower.getStackInSlot(11+i); @@ -750,86 +752,119 @@ public class NEUEventListener { bazaarPrice = bazaarInfo.get("avg_sell").getAsFloat(); } - float worthBIN = -1; + float worthBIN; + float worthABIN; float worthAUC = -1; if(bazaarPrice > 0) { worthBIN = bazaarPrice; + worthABIN = bazaarPrice; worthAUC = bazaarPrice; } else { - worthBIN = neu.manager.auctionManager.getItemAvgBin(internal); - if(worthBIN <= 0) { - worthBIN = neu.manager.auctionManager.getLowestBin(internal); - } + worthABIN = neu.manager.auctionManager.getItemAvgBin(internal); + worthBIN = neu.manager.auctionManager.getLowestBin(internal); + JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal); if(aucInfo != null) { worthAUC = aucInfo.get("price").getAsFloat(); } } - if(worthAUC <= 0 && worthBIN <= 0) { - missing = true; - break; - } - if(worthBIN > 0 && totalValueBIN >= 0) { totalValueBIN += worthBIN; } else { + if(totalValueBIN != -1) { + missingItemBIN = internal; + } totalValueBIN = -1; } + if(worthABIN > 0 && totalValueABIN >= 0) { + totalValueABIN += worthABIN; + } else { + if(totalValueABIN != -1) { + missingItemABIN = internal; + } + totalValueABIN = -1; + } + if(worthAUC > 0 && totalValueAUC >= 0) { totalValueAUC += worthAUC; } else { + if(totalValueAUC != -1) { + missingItemAUC = internal; + } totalValueAUC = -1; } } } - if(totalValueAUC <= 0 && totalValueBIN <= 0) { - missing = true; - } - if(missing) { - drawStringShadow(EnumChatFormatting.BLUE+"Couldn't find item on AH. Item is very rare!", - guiLeft+xSize+4+90, guiTop+14, 170); - } else { - NumberFormat format = NumberFormat.getInstance(Locale.US); - String valueStringBIN = EnumChatFormatting.YELLOW+"Value (BIN): " + EnumChatFormatting.GOLD + NumberFormat format = NumberFormat.getInstance(Locale.US); + String valueStringBIN; + String valueStringABIN; + String valueStringAUC; + if(totalValueBIN >= 0) { + valueStringBIN = EnumChatFormatting.YELLOW+"Value (BIN): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(totalValueBIN) + " coins"; - String valueStringAUC = EnumChatFormatting.YELLOW+"Value (AUC): " + EnumChatFormatting.GOLD + } else { + valueStringBIN = EnumChatFormatting.YELLOW+"Can't find BIN: " + missingItemBIN; + } + if(totalValueABIN >= 0) { + valueStringABIN = EnumChatFormatting.YELLOW+"Value (AVG BIN): " + EnumChatFormatting.GOLD + + EnumChatFormatting.BOLD + format.format(totalValueABIN) + " coins"; + } else { + valueStringABIN = EnumChatFormatting.YELLOW+"Can't find AVG BIN: " + missingItemABIN; + } + if(totalValueAUC >= 0) { + valueStringAUC = EnumChatFormatting.YELLOW+"Value (AUC): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(totalValueAUC) + " coins"; + } else { + valueStringAUC = EnumChatFormatting.YELLOW+"Can't find AUC: " + missingItemAUC; + } + String profitPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN + + EnumChatFormatting.BOLD + "+"; + String lossPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED + + EnumChatFormatting.BOLD + "-"; - int profitLossBIN = totalValueBIN - chestCost; - String plStringBIN; - if(profitLossBIN >= 0) { - plStringBIN = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN - + EnumChatFormatting.BOLD + "+" + format.format(profitLossBIN) + " coins"; - } else { - plStringBIN = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED - + EnumChatFormatting.BOLD + "-" + format.format(-profitLossBIN) + " coins"; - } - - int profitLossAUC = totalValueAUC - chestCost; - String plStringAUC; - if(profitLossAUC >= 0) { - plStringAUC = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN - + EnumChatFormatting.BOLD + "+" + format.format(profitLossAUC) + " coins"; - } else { - plStringAUC = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED - + EnumChatFormatting.BOLD + "-" + format.format(-profitLossAUC) + " coins"; - } + int profitLossBIN = totalValueBIN - chestCost; + String plStringBIN; + if(profitLossBIN >= 0) { + plStringBIN = profitPrefix + format.format(profitLossBIN) + " coins"; + } else { + plStringBIN = lossPrefix + format.format(-profitLossBIN) + " coins"; + } - drawStringShadow(valueStringBIN, guiLeft+xSize+4+90, - guiTop+14, 170); - drawStringShadow(plStringBIN, guiLeft+xSize+4+90, - guiTop+26, 170); + int profitLossABIN = totalValueABIN - chestCost; + String plStringABIN; + if(profitLossABIN >= 0) { + plStringABIN = profitPrefix + format.format(profitLossABIN) + " coins"; + } else { + plStringABIN = lossPrefix + format.format(-profitLossABIN) + " coins"; + } - drawStringShadow(valueStringAUC, guiLeft+xSize+4+90, - guiTop+44, 170); - drawStringShadow(plStringAUC, guiLeft+xSize+4+90, - guiTop+56, 170); + int profitLossAUC = totalValueAUC - chestCost; + String plStringAUC; + if(profitLossAUC >= 0) { + plStringAUC = profitPrefix + format.format(profitLossAUC) + " coins"; + } else { + plStringAUC = lossPrefix + format.format(-profitLossAUC) + " coins"; } + + drawStringShadow(valueStringBIN, guiLeft+xSize+4+90, + guiTop+14, 170); + if(totalValueBIN >= 0) drawStringShadow(plStringBIN, guiLeft+xSize+4+90, + guiTop+26, 170); + + drawStringShadow(valueStringABIN, guiLeft+xSize+4+90, + guiTop+44, 170); + if(totalValueABIN >= 0) drawStringShadow(plStringABIN, guiLeft+xSize+4+90, + guiTop+56, 170); + + drawStringShadow(valueStringAUC, guiLeft+xSize+4+90, + guiTop+74, 170); + if(totalValueAUC >= 0) drawStringShadow(plStringAUC, guiLeft+xSize+4+90, + guiTop+86, 170); } } catch(Exception e) { e.printStackTrace(); @@ -1383,8 +1418,11 @@ public class NEUEventListener { chestCost = Integer.parseInt(cost.toString()); } - boolean missing = false; + String missingItemBIN = null; + String missingItemABIN = null; + String missingItemAUC = null; int totalValueBIN = 0; + int totalValueABIN = 0; int totalValueAUC = 0; for(int i=0; i<5; i++) { ItemStack item = lower.getStackInSlot(11+i); @@ -1396,81 +1434,113 @@ public class NEUEventListener { bazaarPrice = bazaarInfo.get("avg_sell").getAsFloat(); } - float worthBIN = -1; + float worthBIN; + float worthABIN; float worthAUC = -1; if(bazaarPrice > 0) { worthBIN = bazaarPrice; + worthABIN = bazaarPrice; worthAUC = bazaarPrice; } else { - worthBIN = neu.manager.auctionManager.getItemAvgBin(internal); - if(worthBIN <= 0) { - worthBIN = neu.manager.auctionManager.getLowestBin(internal); - } + worthABIN = neu.manager.auctionManager.getItemAvgBin(internal); + worthBIN = neu.manager.auctionManager.getLowestBin(internal); + JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal); if(aucInfo != null) { worthAUC = aucInfo.get("price").getAsFloat(); } } - if(worthAUC <= 0 && worthBIN <= 0) { - missing = true; - break; - } - if(worthBIN > 0 && totalValueBIN >= 0) { totalValueBIN += worthBIN; } else { + if(totalValueBIN != -1) { + missingItemBIN = internal; + } totalValueBIN = -1; } + if(worthABIN > 0 && totalValueABIN >= 0) { + totalValueABIN += worthABIN; + } else { + if(totalValueABIN != -1) { + missingItemABIN = internal; + } + totalValueABIN = -1; + } + if(worthAUC > 0 && totalValueAUC >= 0) { totalValueAUC += worthAUC; } else { + if(totalValueAUC != -1) { + missingItemAUC = internal; + } totalValueAUC = -1; } } } - if(totalValueAUC <= 0 && totalValueBIN <= 0) { - missing = true; - } - String neu = EnumChatFormatting.YELLOW + "[NEU] "; - if(missing) { - newTooltip.add(neu + EnumChatFormatting.BLUE+"Couldn't find item on AH. Item is very rare!"); - } else { - NumberFormat format = NumberFormat.getInstance(Locale.US); - String valueStringBIN = EnumChatFormatting.YELLOW+"Value (BIN): " + EnumChatFormatting.GOLD + NumberFormat format = NumberFormat.getInstance(Locale.US); + String valueStringBIN; + String valueStringABIN; + String valueStringAUC; + if(totalValueBIN >= 0) { + valueStringBIN = EnumChatFormatting.YELLOW+"Value (BIN): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(totalValueBIN) + " coins"; - String valueStringAUC = EnumChatFormatting.YELLOW+"Value (AUC): " + EnumChatFormatting.GOLD + } else { + valueStringBIN = EnumChatFormatting.YELLOW+"Can't find BIN: " + missingItemBIN; + } + if(totalValueABIN >= 0) { + valueStringABIN = EnumChatFormatting.YELLOW+"Value (AVG BIN): " + EnumChatFormatting.GOLD + + EnumChatFormatting.BOLD + format.format(totalValueABIN) + " coins"; + } else { + valueStringABIN = EnumChatFormatting.YELLOW+"Can't find AVG BIN: " + missingItemABIN; + } + if(totalValueAUC >= 0) { + valueStringAUC = EnumChatFormatting.YELLOW+"Value (AUC): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(totalValueAUC) + " coins"; + } else { + valueStringAUC = EnumChatFormatting.YELLOW+"Can't find AUC: " + missingItemAUC; + } + String profitPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN + + EnumChatFormatting.BOLD + "+"; + String lossPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED + + EnumChatFormatting.BOLD + "-"; - int profitLossBIN = totalValueBIN - chestCost; - String plStringBIN; - if(profitLossBIN >= 0) { - plStringBIN = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN - + EnumChatFormatting.BOLD + "+" + format.format(profitLossBIN) + " coins"; - } else { - plStringBIN = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED - + EnumChatFormatting.BOLD + "-" + format.format(-profitLossBIN) + " coins"; - } + int profitLossBIN = totalValueBIN - chestCost; + String plStringBIN; + if(profitLossBIN >= 0) { + plStringBIN = profitPrefix + format.format(profitLossBIN) + " coins"; + } else { + plStringBIN = lossPrefix + format.format(-profitLossBIN) + " coins"; + } - int profitLossAUC = totalValueAUC - chestCost; - String plStringAUC; - if(profitLossAUC >= 0) { - plStringAUC = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN - + EnumChatFormatting.BOLD + "+" + format.format(profitLossAUC) + " coins"; - } else { - plStringAUC = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED - + EnumChatFormatting.BOLD + "-" + format.format(-profitLossAUC) + " coins"; - } + int profitLossABIN = totalValueABIN - chestCost; + String plStringABIN; + if(profitLossABIN >= 0) { + plStringABIN = profitPrefix + format.format(profitLossABIN) + " coins"; + } else { + plStringABIN = lossPrefix + format.format(-profitLossABIN) + " coins"; + } - newTooltip.add(neu + valueStringBIN); - newTooltip.add(neu + plStringBIN); - newTooltip.add(neu + valueStringAUC); - newTooltip.add(neu + plStringAUC); + int profitLossAUC = totalValueAUC - chestCost; + String plStringAUC; + if(profitLossAUC >= 0) { + plStringAUC = profitPrefix + format.format(profitLossAUC) + " coins"; + } else { + plStringAUC = lossPrefix + format.format(-profitLossAUC) + " coins"; } + + String neu = EnumChatFormatting.YELLOW + "[NEU] "; + + newTooltip.add(neu + valueStringBIN); + if(totalValueBIN >= 0) newTooltip.add(neu + plStringBIN); + newTooltip.add(neu + valueStringABIN); + if(totalValueABIN >= 0) newTooltip.add(neu + plStringABIN); + newTooltip.add(neu + valueStringAUC); + if(totalValueAUC >= 0) newTooltip.add(neu + plStringAUC); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 08d6c50b..7fc519a8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -50,6 +50,9 @@ import java.lang.reflect.Method; import java.text.NumberFormat; import java.util.List; import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; @@ -369,11 +372,10 @@ public class NEUOverlay extends Gui { String command = quickCommandStr.split(":")[0].trim(); if(command.startsWith("/")) { NotEnoughUpdates.INSTANCE.sendChatMessage(command); - Utils.playPressSound(); } else { - ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/"+command); //Need to add '/' because of sk1er's patcher being unbelievably shit - Utils.playPressSound(); + ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/"+command); } + Utils.playPressSound(); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 1894023b..fefa6ec0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -79,7 +79,8 @@ import java.util.regex.Pattern; @Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true) public class NotEnoughUpdates { public static final String MODID = "notenoughupdates"; - public static final String VERSION = "1.7-REL"; + public static final String VERSION = "1.7.1-REL"; + public static final int VERSION_ID = 10701; public static NotEnoughUpdates INSTANCE = null; @@ -930,7 +931,7 @@ public class NotEnoughUpdates { JOptionPane.showConfirmDialog(null, pf, "Enter password:", - JOptionPane.NO_OPTION, + JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE); auth.setPassword(new String(pf.getPassword())); System.out.print("Attempting login..."); 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 e2cc82bd..242ad2af 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -663,7 +663,7 @@ public class APIManager { auctionPricesJson = jsonObject; lastAuctionAvgUpdate = System.currentTimeMillis(); }, () -> {}); - manager.hypixelApi.getMyApiGZIPAsync("auction_averages_lbin/3day.json.gz", (jsonObject) -> { + manager.hypixelApi.getMyApiGZIPAsync("auction_averages_lbin/1day.json.gz", (jsonObject) -> { auctionPricesAvgLowestBinJson = jsonObject; }, () -> {}); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java index fb9af536..4a209cd9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java @@ -216,7 +216,11 @@ public class DungeonMap { GlStateManager.rotate(-rotation+180, 0, 0, 1); } + GlStateManager.pushMatrix(); + GlStateManager.scale(NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value, + NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value, 1); Utils.drawTexturedRect(-5, -5, 10, 10, GL11.GL_NEAREST); + GlStateManager.popMatrix(); if(!NotEnoughUpdates.INSTANCE.manager.config.dmOrientCheck.value) { GlStateManager.rotate(rotation-180, 0, 0, 1); @@ -649,6 +653,7 @@ public class DungeonMap { } } + boolean blackBorder = false; boolean headLayer = false; int pixelWidth = 8; int pixelHeight = 8; @@ -660,22 +665,14 @@ public class DungeonMap { playerSkinMap.containsKey(entry.getKey())) { Minecraft.getMinecraft().getTextureManager().bindTexture(playerSkinMap.get(entry.getKey())); - headLayer = true; - if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 3) { - minU = 9/64f; - minV = 9/64f; - maxU = 15/64f; - maxV = 15/64f; - } else { - minU = 8/64f; - minV = 8/64f; - maxU = 16/64f; - maxV = 16/64f; - } + minU = 8/64f; + minV = 8/64f; + maxU = 16/64f; + maxV = 16/64f; + headLayer = true; if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 2) { - pixelWidth = pixelWidth*6/8; - pixelHeight = pixelHeight*6/8; + blackBorder = true; } } else { Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); @@ -691,8 +688,16 @@ public class DungeonMap { GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.translate(x, y, -0.02F); + GlStateManager.scale(NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value, + NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value, 1); GlStateManager.rotate(angle, 0.0F, 0.0F, 1.0F); GlStateManager.translate(-0.5F, 0.5F, 0.0F); + + if(blackBorder) { + Gui.drawRect(-pixelWidth/2-1,-pixelHeight/2-1, pixelWidth/2+1, pixelHeight/2+1, 0xff111111); + GlStateManager.color(1, 1, 1, 1); + } + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)).tex(minU, minV).endVertex(); worldrenderer.pos(pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)).tex(maxU, minV).endVertex(); @@ -1192,13 +1197,14 @@ public class DungeonMap { byte id = vec4b.func_176110_a(); if(id != 1 && id != 3) continue; - if(decorations++ == 6) break; - float x = (float) vec4b.func_176112_b() / 2.0F + 64.0F; float y = (float) vec4b.func_176113_c() / 2.0F + 64.0F; - x = Math.max(0, Math.min(160, x)); - y = Math.max(0, Math.min(160, y)); + if(x < 0 || y < 0 || x > 128 || y > 128) { + continue; + } + + if(decorations++ >= 6) break; float deltaX = x - startRoomX; float deltaY = y - startRoomY; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java index 438eb01d..0bd7ed6f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java @@ -141,18 +141,18 @@ public class GuiDungeonMapEditor extends GuiScreen { //buttons.add(new Button(5, 98, 67+19, "Large", options.dmRoomSize)); //Map Border Styles - buttons.add(new Button(6, 6, 97, "None")); - buttons.add(new Button(7, 52, 97, "Custom")); - buttons.add(new Button(8, 98, 97, "Stone")); - buttons.add(new Button(9, 6, 116, "Wood")); - buttons.add(new Button(10, 52, 116, "Rustic(S)")); - buttons.add(new Button(11, 98, 116, "Rustic(C)")); - buttons.add(new Button(12, 6, 135, "Fade")); - buttons.add(new Button(13, 52, 135, "Ribbons")); - buttons.add(new Button(14, 98, 135, "Paper")); - buttons.add(new Button(15, 6, 154, "Crimson")); - buttons.add(new Button(16, 52, 154, "Ornate")); - buttons.add(new Button(17, 98, 154, "Dragon")); + buttons.add(new Button(6, 6, 97+30, "None")); + buttons.add(new Button(7, 52, 97+30, "Custom")); + buttons.add(new Button(8, 98, 97+30, "Stone")); + buttons.add(new Button(9, 6, 116+30, "Wood")); + buttons.add(new Button(10, 52, 116+30, "Rustic(S)")); + buttons.add(new Button(11, 98, 116+30, "Rustic(C)")); + buttons.add(new Button(12, 6, 135+30, "Fade")); + buttons.add(new Button(13, 52, 135+30, "Ribbons")); + buttons.add(new Button(14, 98, 135+30, "Paper")); + buttons.add(new Button(15, 6, 154+30, "Crimson")); + buttons.add(new Button(16, 52, 154+30, "Ornate")); + buttons.add(new Button(17, 98, 154+30, "Dragon")); //Dungeon Map buttons.add(new Button(18, 20+139, 36, "Yes/No", options.dmEnable)); @@ -267,12 +267,14 @@ public class GuiDungeonMapEditor extends GuiScreen { Minecraft.getMinecraft().fontRendererObj.drawString("NEU Dungeon Map Editor", guiLeft+8, guiTop+6, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Map Border Size", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Border Size", Minecraft.getMinecraft().fontRendererObj, guiLeft+76, guiTop+30, false, 137, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Map Rooms Size", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Rooms Size", Minecraft.getMinecraft().fontRendererObj, guiLeft+76, guiTop+60, false, 137, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Map Border Style", Minecraft.getMinecraft().fontRendererObj, + Utils.drawStringCenteredScaledMaxWidth("Icon Scale", Minecraft.getMinecraft().fontRendererObj, guiLeft+76, guiTop+90, false, 137, 0xFFB4B4B4); + Utils.drawStringCenteredScaledMaxWidth("Border Style", Minecraft.getMinecraft().fontRendererObj, + guiLeft+76, guiTop+120, false, 137, 0xFFB4B4B4); Utils.drawStringCenteredScaledMaxWidth("Dungeon Map", Minecraft.getMinecraft().fontRendererObj, guiLeft+44+139, guiTop+30, false, 60, 0xFFB4B4B4); @@ -305,19 +307,19 @@ public class GuiDungeonMapEditor extends GuiScreen { guiLeft+108+139, guiTop+175, false, 60, 0xFFB4B4B4); Utils.drawStringCenteredScaledMaxWidth("X (%)", Minecraft.getMinecraft().fontRendererObj, - guiLeft+44, guiTop+189, false, 60, 0xFFB4B4B4); + guiLeft+44, guiTop+209, false, 60, 0xFFB4B4B4); Utils.drawStringCenteredScaledMaxWidth("Y (%)", Minecraft.getMinecraft().fontRendererObj, - guiLeft+108, guiTop+189, false, 60, 0xFFB4B4B4); + guiLeft+108, guiTop+209, false, 60, 0xFFB4B4B4); drawSlider(NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize, guiLeft+76, guiTop+45); drawSlider(NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize, guiLeft+76, guiTop+75); + drawSlider(NotEnoughUpdates.INSTANCE.manager.config.dmIconScale, guiLeft+76, guiTop+105); Options options = NotEnoughUpdates.INSTANCE.manager.config; buttons.get(18-6).text = options.dmEnable.value ? "Enabled" : "Disabled"; buttons.get(19-6).text = options.dmCenterPlayer.value ? "Player" : "Map"; buttons.get(20-6).text = options.dmRotatePlayer.value ? "Player" : "Vertical"; - buttons.get(21-6).text = options.dmPlayerHeads.value <= 0 ? "Default" : options.dmPlayerHeads.value >= 3 ? "SmallHeads" : - options.dmPlayerHeads.value == 1 ? "Heads" : "ScaledHeads"; + buttons.get(21-6).text = options.dmPlayerHeads.value <= 0 ? "Default" : options.dmPlayerHeads.value == 1 ? "Heads" : "Heads w/ Border"; buttons.get(22-6).text = options.dmOrientCheck.value ? "Orient" : "Off"; buttons.get(23-6).text = options.dmCenterCheck.value ? "Center" : "Off"; buttons.get(24-6).text = options.dmPlayerInterp.value ? "Interp" : "No Interp"; @@ -332,8 +334,8 @@ public class GuiDungeonMapEditor extends GuiScreen { xField.setSize(48, 16); yField.setSize(48, 16); blurField.render(guiLeft+20+139, guiTop+181); - xField.render(guiLeft+20, guiTop+195); - yField.render(guiLeft+84, guiTop+195); + xField.render(guiLeft+20, guiTop+215); + yField.render(guiLeft+84, guiTop+215); Map decorations = new HashMap<>(); Vec4b vec4b = new Vec4b((byte)3, (byte)(((50)-64)*2), (byte)(((40)-64)*2), (byte)((60)*16/360)); @@ -543,6 +545,9 @@ public class GuiDungeonMapEditor extends GuiScreen { } else if(mouseY > guiTop+75-8 && mouseY < guiTop+75+8) { clickedSlider = NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize; return; + } else if(mouseY > guiTop+105-8 && mouseY < guiTop+105+8) { + clickedSlider = NotEnoughUpdates.INSTANCE.manager.config.dmIconScale; + return; } } @@ -553,7 +558,7 @@ public class GuiDungeonMapEditor extends GuiScreen { yField.otherComponentClick(); return; } - } else if(mouseY > guiTop+195 && mouseY < guiTop+195+16) { + } else if(mouseY > guiTop+215 && mouseY < guiTop+215+16) { if(mouseX > guiLeft+20 && mouseX < guiLeft+20+48) { xField.mouseClicked(mouseX, mouseY, mouseButton); yField.otherComponentClick(); @@ -746,7 +751,7 @@ public class GuiDungeonMapEditor extends GuiScreen { options.dmRotatePlayer.value = !options.dmRotatePlayer.value; break; case 21: options.dmPlayerHeads.value++; - if(options.dmPlayerHeads.value > 3) options.dmPlayerHeads.value = 0.0;break; + if(options.dmPlayerHeads.value > 2) options.dmPlayerHeads.value = 0.0; break; case 22: options.dmOrientCheck.value = !options.dmOrientCheck.value; break; case 23: diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index ee8282e9..e6d0a986 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -103,12 +103,13 @@ public abstract class MixinGuiContainer { if(slotIn != null && BetterContainers.isOverriding() && (BetterContainers.isBlankStack(slotIn.getStack()) || BetterContainers.isButtonStack(slotIn.getStack()))) { BetterContainers.clickSlot(slotIn.getSlotIndex()); - Utils.playPressSound(); if(BetterContainers.isBlankStack(slotIn.getStack())) { GuiContainer $this = (GuiContainer)(Object)this; $this.mc.playerController.windowClick($this.inventorySlots.windowId, slotId, 2, clickType, $this.mc.thePlayer); ci.cancel(); + } else { + Utils.playPressSound(); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java index 028f9fae..a5566ce6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java @@ -148,6 +148,11 @@ public class Options { "Hide GUI Filler Tooltips", false, "Hides the tooltip of glass panes in skyblock GUIs. Contrib: ThatGravyBoat", CAT_MISC); + public Option guiButtonClicks = new Option( + true, + "Button Click Sounds", + false, + "Plays a click sound whenever various NEU GUIs are interacted with", CAT_MISC); public Option dungeonProfitLore = new Option( false, "Dungeon Profit in Lore", @@ -217,6 +222,12 @@ public class Options { "Skyblock Event Notification Sounds", false, "Will play a sounds whenever a favourited event starts.", CAT_MISC); + public Option spookyMorningNotification = new Option( + true, + "Spooky Festival Morning Notification", + false, + "During a spooky festival, will notify the player whenever it hits 7am", CAT_MISC); + public Option accessoryBagOverlay = new Option( true, "Accessory Bag Overlay", @@ -464,12 +475,17 @@ public class Options { 1.0, "Border Size", false, - "Changes the size of the map border, without changing the size of the contents\nSmall = 90x\nMedium = 120x\nLarge = 160x", 0, 5, CAT_ALL); + "Changes the size of the map border, without changing the size of the contents", 0, 5, CAT_ALL); public Option dmRoomSize = new Option( 1.0, "Room Size", false, - "Changes the size of rooms. Useful for higher dungeons with larger maps\nSmall = 12x\nMedium = 16x\nLarge = 20x\nXLarge = 24x", 0, 5, CAT_ALL); + "Changes the size of rooms. Useful for higher dungeons with larger maps", 0, 5, CAT_ALL); + public Option dmIconScale = new Option( + 1.0, + "Icon Size", + false, + "Changes the scale of room indicators and player icons", 0.5, 3, CAT_ALL); public Option dmBorderStyle = new Option( 0.0, "Border Style", @@ -616,6 +632,7 @@ public class Options { tryAddOption(showQuickCommands, options); tryAddOption(hidePotionEffect, options); tryAddOption(hideEmptyPanes, options); + tryAddOption(guiButtonClicks, options); tryAddOption(advancedPriceInfo, options); tryAddOption(showUpdateMsg, options); tryAddOption(tooltipBorderColours, options); @@ -646,7 +663,7 @@ public class Options { tryAddOption(neuAuctionHouse, options); tryAddOption(eventNotifications, options); tryAddOption(showEventTimerInInventory, options); - tryAddOption(eventNotificationSounds, options); + tryAddOption(spookyMorningNotification, options); //Sliders tryAddOption(paneGuiScale, options); tryAddOption(smoothAoteMillis, options); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 667128b9..64bf3015 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -99,7 +99,7 @@ public class Utils { } } - int newScale = guiScales.size() > 0 ? Math.max(1, Math.min(4, guiScales.peek())) : Minecraft.getMinecraft().gameSettings.guiScale; + int newScale = guiScales.size() > 0 ? Math.max(0, Math.min(4, guiScales.peek())) : Minecraft.getMinecraft().gameSettings.guiScale; if(newScale == 0) newScale = Minecraft.getMinecraft().gameSettings.guiScale; int oldScale = Minecraft.getMinecraft().gameSettings.guiScale; @@ -366,8 +366,10 @@ public class Utils { } public static void playPressSound() { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create( - new ResourceLocation("gui.button.press"), 1.0F)); + if(NotEnoughUpdates.INSTANCE.manager.config.guiButtonClicks.value) { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create( + new ResourceLocation("gui.button.press"), 1.0F)); + } } public static String cleanDuplicateColourCodes(String line) { @@ -821,7 +823,7 @@ public class Utils { GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting(); - GlStateManager.disableDepth(); + GlStateManager.enableDepth(); int tooltipTextWidth = 0; for (String textLine : textLines) @@ -950,6 +952,7 @@ public class Utils { drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart); drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); + GlStateManager.disableDepth(); for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) { String line = textLines.get(lineNumber); diff --git a/src/main/resources/assets/notenoughupdates/dungeon_chest_worth.png b/src/main/resources/assets/notenoughupdates/dungeon_chest_worth.png index 37ad163e..fba53376 100644 Binary files a/src/main/resources/assets/notenoughupdates/dungeon_chest_worth.png and b/src/main/resources/assets/notenoughupdates/dungeon_chest_worth.png differ -- cgit