From 8499a98beeb556c16987fc375dbd7d05d6c27ab4 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Mon, 20 Jul 2020 05:12:05 +1000 Subject: some profile viewer stuffs --- .../notenoughupdates/NotEnoughUpdates.java | 216 +++++++++++++-------- 1 file changed, 138 insertions(+), 78 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index a589fe2b..a7a30233 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -11,6 +11,8 @@ import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.infopanes.CollectionLogInfoPane; import io.github.moulberry.notenoughupdates.infopanes.CosmeticsInfoPane; +import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; +import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import io.github.moulberry.notenoughupdates.questing.GuiQuestLine; import io.github.moulberry.notenoughupdates.questing.NEUQuesting; import io.github.moulberry.notenoughupdates.util.Utils; @@ -29,6 +31,7 @@ import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.scoreboard.ScoreObjective; @@ -129,6 +132,37 @@ public class NotEnoughUpdates { } }); + private static ProfileViewer profileViewer; + + SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(args.length != 1) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "idiot.")); + } + profileViewer.getProfileByName(args[0], profile -> { + openGui = new GuiProfileViewer(profile); + }); + } + }); + + SimpleCommand linksCommand = new SimpleCommand("neulinks", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + File repo = manager.repoLocation; + if(repo.exists()) { + File updateJson = new File(repo, "update.json"); + try { + JsonObject update = manager.getJsonFromFile(updateJson); + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + displayLinks(update); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + } catch (Exception ignored) { + } + } + } + }); + SimpleCommand overlayPlacementsCommand = new SimpleCommand("neuoverlay", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { openGui = new NEUOverlayPlacements(); @@ -175,6 +209,8 @@ public class NotEnoughUpdates { f.mkdirs(); ClientCommandHandler.instance.registerCommand(collectionLogCommand); ClientCommandHandler.instance.registerCommand(cosmeticsCommand); + ClientCommandHandler.instance.registerCommand(linksCommand); + ClientCommandHandler.instance.registerCommand(viewProfileCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); //ClientCommandHandler.instance.registerCommand(questingCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); @@ -183,6 +219,7 @@ public class NotEnoughUpdates { manager = new NEUManager(this, neuio, f); manager.loadItemInformation(); overlay = new NEUOverlay(manager); + profileViewer = new ProfileViewer(manager); for(KeyBinding kb : manager.keybinds) { ClientRegistry.registerKeyBinding(kb); @@ -203,7 +240,7 @@ public class NotEnoughUpdates { })); //TODO: login code. Ignore this, used for testing. - /*try { + try { Field field = Minecraft.class.getDeclaredField("session"); YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()) @@ -232,7 +269,7 @@ public class NotEnoughUpdates { field.setAccessible(true); field.set(Minecraft.getMinecraft(), session); } catch (NoSuchFieldException | AuthenticationException | IllegalAccessException e) { - }*/ + } } /** @@ -250,6 +287,98 @@ public class NotEnoughUpdates { } } + private void displayLinks(JsonObject update) { + String discord_link = update.get("discord_link").getAsString(); + String youtube_link = update.get("youtube_link").getAsString(); + String update_link = update.get("update_link").getAsString(); + String github_link = update.get("github_link").getAsString(); + String other_text = update.get("other_text").getAsString(); + String other_link = update.get("other_link").getAsString(); + + ChatComponentText other = null; + if(other_text.length() > 0) { + other = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.BLUE+other_text+EnumChatFormatting.GRAY+"]"); + other.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, other_link)); + } + ChatComponentText links = new ChatComponentText(""); + ChatComponentText separator = new ChatComponentText( + EnumChatFormatting.GRAY+EnumChatFormatting.BOLD.toString()+EnumChatFormatting.STRIKETHROUGH+(other==null?"---":"--")); + ChatComponentText discord = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.BLUE+"Discord"+EnumChatFormatting.GRAY+"]"); + discord.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, discord_link)); + ChatComponentText youtube = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.RED+"YouTube"+EnumChatFormatting.GRAY+"]"); + youtube.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, youtube_link)); + ChatComponentText release = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.GREEN+"Release"+EnumChatFormatting.GRAY+"]"); + release.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, update_link)); + ChatComponentText github = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.DARK_PURPLE+"GitHub"+EnumChatFormatting.GRAY+"]"); + github.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, github_link)); + + + links.appendSibling(separator); + links.appendSibling(discord); + links.appendSibling(separator); + links.appendSibling(youtube); + links.appendSibling(separator); + links.appendSibling(release); + links.appendSibling(separator); + links.appendSibling(github); + links.appendSibling(separator); + if(other != null) { + links.appendSibling(other); + links.appendSibling(separator); + } + + Minecraft.getMinecraft().thePlayer.addChatMessage(links); + } + + private boolean displayUpdateMessageIfOutOfDate() { + File repo = manager.repoLocation; + if(repo.exists()) { + File updateJson = new File(repo, "update.json"); + try { + JsonObject o = manager.getJsonFromFile(updateJson); + + String version = o.get("version").getAsString(); + + if(!VERSION.equalsIgnoreCase(version)) { + 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")) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + int len = fr.getStringWidth(line); + if(first_len == -1) { + first_len = len; + } + int missing_len = first_len-len; + if(missing_len > 0) { + StringBuilder sb = new StringBuilder(line); + for(int i=0; i 0) { - StringBuilder sb = new StringBuilder(line); - for(int i=0; i 0) { - other = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.BLUE+other_text+EnumChatFormatting.GRAY+"]"); - other.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, other_link)); - } - ChatComponentText links = new ChatComponentText(""); - ChatComponentText separator = new ChatComponentText( - EnumChatFormatting.GRAY+EnumChatFormatting.BOLD.toString()+EnumChatFormatting.STRIKETHROUGH+(other==null?"---":"--")); - ChatComponentText discord = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.BLUE+"Discord"+EnumChatFormatting.GRAY+"]"); - discord.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, discord_link)); - ChatComponentText youtube = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.RED+"YouTube"+EnumChatFormatting.GRAY+"]"); - youtube.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, youtube_link)); - ChatComponentText release = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.GREEN+"Release"+EnumChatFormatting.GRAY+"]"); - release.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, update_link)); - ChatComponentText github = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.DARK_PURPLE+"GitHub"+EnumChatFormatting.GRAY+"]"); - github.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, github_link)); - - - links.appendSibling(separator); - links.appendSibling(discord); - links.appendSibling(separator); - links.appendSibling(youtube); - links.appendSibling(separator); - links.appendSibling(release); - links.appendSibling(separator); - links.appendSibling(github); - links.appendSibling(separator); - if(other != null) { - links.appendSibling(other); - links.appendSibling(separator); - } - - Minecraft.getMinecraft().thePlayer.addChatMessage(links); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - - } - - joinedSB = true; - } catch(Exception ignored) {} + if(displayUpdateMessageIfOutOfDate()) { + joinedSB = false; } } //NEUQuesting.getInstance().tick(); @@ -387,7 +444,6 @@ public class NotEnoughUpdates { } } } else { - for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { processUniqueStack(stack, newItem); } @@ -407,6 +463,7 @@ public class NotEnoughUpdates { if(newItemAddMap.containsKey(internalname)) { if(System.currentTimeMillis() - newItemAddMap.get(internalname) > 1000) { log.add(internalname); + try { manager.saveConfig(); } catch(IOException ignored) {} } } else { newItemAddMap.put(internalname, System.currentTimeMillis()); @@ -732,7 +789,10 @@ public class NotEnoughUpdates { ItemStack item = lower.getStackInSlot(11+i); String internal = manager.getInternalNameForItem(item); if(internal != null) { - int worth = manager.auctionManager.getLowestBin(internal); + float worth = manager.auctionManager.getLowestBin(internal); + + if(worth == -1) worth = manager.getCraftCost(internal).craftCost; + if(worth > 0) { totalValue += worth; } else { -- cgit From d04771c7ef5cdab9554aa6aef506a39c8e2bd3d4 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Wed, 22 Jul 2020 03:54:59 +1000 Subject: less scuffed profile viewer :) --- .../notenoughupdates/NotEnoughUpdates.java | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index a7a30233..734f7ca1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -14,7 +14,7 @@ import io.github.moulberry.notenoughupdates.infopanes.CosmeticsInfoPane; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import io.github.moulberry.notenoughupdates.questing.GuiQuestLine; -import io.github.moulberry.notenoughupdates.questing.NEUQuesting; +import io.github.moulberry.notenoughupdates.questing.SBScoreboardData; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -31,20 +31,15 @@ import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.Session; import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.GuiOpenEvent; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.*; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; @@ -139,10 +134,13 @@ public class NotEnoughUpdates { if(args.length != 1) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "idiot.")); + } else { + profileViewer.getProfileByName(args[0], profile -> { + profile.resetCache(); + openGui = new GuiProfileViewer(profile); + }); } - profileViewer.getProfileByName(args[0], profile -> { - openGui = new GuiProfileViewer(profile); - }); + //openGui = new GuiProfileViewer(null); } }); @@ -398,7 +396,7 @@ public class NotEnoughUpdates { joinedSB = false; } } - //NEUQuesting.getInstance().tick(); + SBScoreboardData.getInstance().tick(); //GuiQuestLine.questLine.tick(); } if(currChatMessage != null && System.currentTimeMillis() - lastChatMessage > CHAT_MSG_COOLDOWN) { @@ -473,6 +471,15 @@ public class NotEnoughUpdates { } } + @SubscribeEvent(priority=EventPriority.HIGHEST) + public void onRenderEntitySpecials(RenderLivingEvent.Specials.Pre event) { + if(Minecraft.getMinecraft().currentScreen instanceof GuiProfileViewer) { + if(((GuiProfileViewer)Minecraft.getMinecraft().currentScreen).getEntityPlayer() == event.entity) { + event.setCanceled(true); + } + } + } + @SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent event) { if(event.type != null && event.type.equals(RenderGameOverlayEvent.ElementType.BOSSHEALTH) && -- cgit From f0293a74282cece3aa8a2a328559889d6e187209 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sun, 26 Jul 2020 12:12:25 +1000 Subject: 1.11.7 --- .../notenoughupdates/NotEnoughUpdates.java | 166 +++++++++++++++++++-- 1 file changed, 150 insertions(+), 16 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 734f7ca1..efd38c55 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -11,6 +11,7 @@ import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.infopanes.CollectionLogInfoPane; import io.github.moulberry.notenoughupdates.infopanes.CosmeticsInfoPane; +import io.github.moulberry.notenoughupdates.mixins.MixinRenderItem; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import io.github.moulberry.notenoughupdates.questing.GuiQuestLine; @@ -24,6 +25,8 @@ import net.minecraft.client.gui.inventory.*; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.client.shader.Shader; import net.minecraft.command.ICommandSender; import net.minecraft.event.ClickEvent; import net.minecraft.init.Blocks; @@ -37,6 +40,7 @@ import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Matrix4f; import net.minecraft.util.Session; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.*; @@ -61,10 +65,13 @@ import java.lang.reflect.Modifier; import java.net.Proxy; import java.text.NumberFormat; import java.util.*; +import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import static io.github.moulberry.notenoughupdates.GuiTextures.*; @@ -127,10 +134,20 @@ public class NotEnoughUpdates { } }); + SimpleCommand enchantColourCommand = new SimpleCommand("neuec", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + openGui = new GuiEnchantColour(); + } + }); + private static ProfileViewer profileViewer; SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { + /*if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "This feature requires FBOs to work. Try disabling Optifine's 'Fast Render'.")); + } else*/ if(args.length != 1) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "idiot.")); @@ -210,6 +227,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(linksCommand); ClientCommandHandler.instance.registerCommand(viewProfileCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); + ClientCommandHandler.instance.registerCommand(enchantColourCommand); //ClientCommandHandler.instance.registerCommand(questingCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); @@ -383,28 +401,39 @@ public class NotEnoughUpdates { * 2)Adds unique items to the collection log */ private HashMap newItemAddMap = new HashMap<>(); + private long lastLongUpdate = 0; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { + boolean longUpdate = false; + long currentTime = System.currentTimeMillis(); + if(currentTime - lastLongUpdate > 1000) { + longUpdate = true; + lastLongUpdate = currentTime; + } if(openGui != null) { Minecraft.getMinecraft().displayGuiScreen(openGui); openGui = null; } - if(hasSkyblockScoreboard()) { - manager.auctionManager.tick(); - if(!joinedSB && manager.config.showUpdateMsg.value) { - if(displayUpdateMessageIfOutOfDate()) { - joinedSB = false; + if(longUpdate) { + updateSkyblockScoreboard(); + if(hasSkyblockScoreboard()) { + manager.auctionManager.tick(); + if(!joinedSB && manager.config.showUpdateMsg.value) { + if(displayUpdateMessageIfOutOfDate()) { + joinedSB = false; + } } + SBScoreboardData.getInstance().tick(); + //GuiQuestLine.questLine.tick(); } - SBScoreboardData.getInstance().tick(); - //GuiQuestLine.questLine.tick(); + //ItemRarityHalo.resetItemHaloCache(); } - if(currChatMessage != null && System.currentTimeMillis() - lastChatMessage > CHAT_MSG_COOLDOWN) { - lastChatMessage = System.currentTimeMillis(); + if(currChatMessage != null && currentTime - lastChatMessage > CHAT_MSG_COOLDOWN) { + lastChatMessage = currentTime; Minecraft.getMinecraft().thePlayer.sendChatMessage(currChatMessage); currChatMessage = null; } - if(hasSkyblockScoreboard() && manager.getCurrentProfile() != null && manager.getCurrentProfile().length() > 0) { + if(longUpdate && hasSkyblockScoreboard() && manager.getCurrentProfile() != null && manager.getCurrentProfile().length() > 0) { HashSet newItem = new HashSet<>(); if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer && !(Minecraft.getMinecraft().currentScreen instanceof GuiCrafting)) { @@ -512,7 +541,8 @@ public class NotEnoughUpdates { String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText(); manager.auctionManager.customAH.setRenderOverAuctionView(containerName.trim().equals("Auction View") || - containerName.trim().equals("BIN Auction View") || containerName.trim().equals("Confirm Bid")); + containerName.trim().equals("BIN Auction View") || containerName.trim().equals("Confirm Bid") || + containerName.trim().equals("Confirm Purchase")); } //OPEN @@ -682,7 +712,7 @@ public class NotEnoughUpdates { */ @SubscribeEvent public void onGuiBackgroundDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - if((event.gui instanceof GuiContainer || event.gui instanceof CustomAHGui) && isOnSkyblock()) { + if((event.gui instanceof GuiContainer || event.gui instanceof CustomAHGui || event.gui instanceof GuiItemRecipe) && isOnSkyblock()) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledresolution.getScaledWidth(); @@ -749,7 +779,7 @@ public class NotEnoughUpdates { @SubscribeEvent public void onGuiScreenDrawPost(GuiScreenEvent.DrawScreenEvent.Post event) { if(!(event.gui instanceof CustomAHGui || manager.auctionManager.customAH.isRenderOverAuctionView())) { - if(event.gui instanceof GuiContainer && isOnSkyblock()) { + if((event.gui instanceof GuiContainer || event.gui instanceof GuiItemRecipe) && isOnSkyblock()) { renderDungeonChestOverlay(event.gui); @@ -1003,6 +1033,103 @@ public class NotEnoughUpdates { }*/ } + @SubscribeEvent(priority = EventPriority.LOW) + public void onItemTooltipLow(ItemTooltipEvent event) { + //NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value + int index = 0; + List newTooltip = new ArrayList<>(); + for(String line : event.toolTip) { + for(String op : NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value) { + List colourOps = GuiEnchantColour.splitter.splitToList(op); + String enchantName = GuiEnchantColour.getColourOpIndex(colourOps, 0); + String comparator = GuiEnchantColour.getColourOpIndex(colourOps, 1); + String comparison = GuiEnchantColour.getColourOpIndex(colourOps, 2); + String colourCode = GuiEnchantColour.getColourOpIndex(colourOps, 3); + + if(enchantName.length() == 0) continue; + if(comparator.length() == 0) continue; + if(comparison.length() == 0) continue; + if(colourCode.length() == 0) continue; + + if(enchantName.contains("(") || enchantName.contains(")")) continue; + + int comparatorI = ">=<".indexOf(comparator.charAt(0)); + + int levelToFind = -1; + try { + levelToFind = Integer.parseInt(comparison); + } catch(Exception e) { continue; } + + if(comparatorI < 0) continue; + if("0123456789abcdefz".indexOf(colourCode.charAt(0)) < 0) continue; + + //item_lore = item_lore.replaceAll("\\u00A79("+lvl4Max+" IV)", EnumChatFormatting.DARK_PURPLE+"$1"); + //9([a-zA-Z ]+?) ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$) + Pattern pattern; + try { + String prefix = "\u00A79"; + if(enchantName.startsWith("ULT_")) prefix = "\u00A7l\u00A7d"; + pattern = Pattern.compile(prefix+"("+enchantName+") ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$)"); + } catch(Exception e) {continue;} //malformed regex + Matcher matcher = pattern.matcher(line); + int matchCount = 0; + while(matcher.find() && matchCount < 5) { + matchCount++; + int level = -1; + String levelStr = matcher.group(2); + if(levelStr == null) continue; + try { + level = Integer.parseInt(levelStr); + } catch(Exception e) { + switch(levelStr) { + case "I": + level = 1; break; + case "II": + level = 2; break; + case "III": + level = 3; break; + case "IV": + level = 4; break; + case "V": + level = 5; break; + case "VI": + level = 6; break; + case "VII": + level = 7; break; + case "VIII": + level = 8; break; + case "IX": + level = 9; break; + case "X": + level = 10; break; + } + } + boolean matches = false; + if(level > 0) { + switch(comparator) { + case ">": + matches = level > levelToFind; break; + case "=": + matches = level == levelToFind; break; + case "<": + matches = level < levelToFind; break; + } + } + if(matches) { + if(!colourCode.equals("z")) { + line = line.replaceAll("\\u00A79"+matcher.group(1), "\u00A7"+colourCode+matcher.group(1)); + } else { + line = line.replaceAll("\\u00A79"+matcher.group(1), Utils.chromaString(matcher.group(1))); + } + } + } + } + newTooltip.add(line); + } + event.toolTip.clear(); + event.toolTip.addAll(newTooltip); + } + /** * This makes it so that holding LCONTROL while hovering over an item with NBT will show the NBT of the item. * @param event @@ -1103,13 +1230,19 @@ public class NotEnoughUpdates { } } - //Stolen from Biscut's SkyblockAddons public boolean isOnSkyblock() { if(!manager.config.onlyShowOnSkyblock.value) return true; return hasSkyblockScoreboard(); } + private boolean hasSkyblockScoreboard; + public boolean hasSkyblockScoreboard() { + return hasSkyblockScoreboard; + } + + //Stolen from Biscut's SkyblockAddons + private void updateSkyblockScoreboard() { Minecraft mc = Minecraft.getMinecraft(); if (mc != null && mc.theWorld != null) { @@ -1119,12 +1252,13 @@ public class NotEnoughUpdates { String objectiveName = sidebarObjective.getDisplayName().replaceAll("(?i)\\u00A7.", ""); for (String skyblock : SKYBLOCK_IN_ALL_LANGUAGES) { if (objectiveName.startsWith(skyblock)) { - return true; + hasSkyblockScoreboard = true; + return; } } } } - return false; + hasSkyblockScoreboard = false; } } -- cgit From 1fbc1f60082ea1bfb5e40eff1ca50b7122f5f38d Mon Sep 17 00:00:00 2001 From: Moulberry Date: Mon, 27 Jul 2020 11:37:56 +1000 Subject: 1.11.8 --- .../notenoughupdates/NotEnoughUpdates.java | 58 ++++++++++++++++------ 1 file changed, 43 insertions(+), 15 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index efd38c55..169b6b9f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -19,6 +19,7 @@ import io.github.moulberry.notenoughupdates.questing.SBScoreboardData; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.*; @@ -38,10 +39,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.Matrix4f; -import net.minecraft.util.Session; +import net.minecraft.util.*; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.*; import net.minecraftforge.common.MinecraftForge; @@ -140,7 +138,7 @@ public class NotEnoughUpdates { } }); - private static ProfileViewer profileViewer; + public static ProfileViewer profileViewer; SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { @@ -148,16 +146,34 @@ public class NotEnoughUpdates { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This feature requires FBOs to work. Try disabling Optifine's 'Fast Render'.")); } else*/ - if(args.length != 1) { + if (manager.config.apiKey.value == null || manager.config.apiKey.value.trim().isEmpty()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "idiot.")); + "Can't view profile, apikey is not set. Run /api new and put the result in settings.")); + } else if (args.length == 0) { + profileViewer.getProfileByName(Minecraft.getMinecraft().thePlayer.getName(), profile -> { + if (profile != null) profile.resetCache(); + openGui = new GuiProfileViewer(profile); + }); + } else if (args.length > 1) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Too many arguments. Usage: /neuprofile [name]")); } else { profileViewer.getProfileByName(args[0], profile -> { - profile.resetCache(); + if (profile != null) profile.resetCache(); openGui = new GuiProfileViewer(profile); }); } - //openGui = new GuiProfileViewer(null); + } + }, new SimpleCommand.TabCompleteRunnable() { + @Override + public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + /*if(args.length) { + + }*/ + for(String arg : args) { + System.out.println(arg); + } + return null; } }); @@ -200,7 +216,7 @@ public class NotEnoughUpdates { "You must be on Skyblock to use this feature.")); } else if(manager.config.apiKey.value == null || manager.config.apiKey.value.trim().isEmpty()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ - "Can't open NeuAH, Api Key is not set. Run /api new and put the result in settings.")); + "Can't open NeuAH, apikey is not set. Run /api new and put the result in settings.")); } else { openGui = new CustomAHGui(); manager.auctionManager.customAH.lastOpen = System.currentTimeMillis(); @@ -228,7 +244,6 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(viewProfileCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); - //ClientCommandHandler.instance.registerCommand(questingCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); neuio = new NEUIO(getAccessToken()); @@ -712,7 +727,7 @@ public class NotEnoughUpdates { */ @SubscribeEvent public void onGuiBackgroundDraw(GuiScreenEvent.BackgroundDrawnEvent event) { - if((event.gui instanceof GuiContainer || event.gui instanceof CustomAHGui || event.gui instanceof GuiItemRecipe) && isOnSkyblock()) { + if((shouldRenderOverlay(event.gui) || event.gui instanceof CustomAHGui) && isOnSkyblock()) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledresolution.getScaledWidth(); @@ -771,6 +786,19 @@ public class NotEnoughUpdates { } } + private static boolean shouldRenderOverlay(Gui gui) { + boolean validGui = gui instanceof GuiContainer || gui instanceof GuiItemRecipe; + if(gui instanceof GuiChest) { + GuiChest eventGui = (GuiChest) gui; + ContainerChest cc = (ContainerChest) eventGui.inventorySlots; + String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.trim().equals("Fast Travel")) { + validGui = false; + } + } + return validGui; + } + /** * Will draw the NEUOverlay over the inventory if focusInv == false. (z-translation of 300 is so that NEUOverlay * will draw over Items in the inventory (which render at a z value of about 250)) @@ -779,7 +807,7 @@ public class NotEnoughUpdates { @SubscribeEvent public void onGuiScreenDrawPost(GuiScreenEvent.DrawScreenEvent.Post event) { if(!(event.gui instanceof CustomAHGui || manager.auctionManager.customAH.isRenderOverAuctionView())) { - if((event.gui instanceof GuiContainer || event.gui instanceof GuiItemRecipe) && isOnSkyblock()) { + if(shouldRenderOverlay(event.gui) && isOnSkyblock()) { renderDungeonChestOverlay(event.gui); @@ -889,7 +917,7 @@ public class NotEnoughUpdates { overlay.mouseInput(); return; } - if(event.gui instanceof GuiContainer && !(hoverInv && focusInv) && isOnSkyblock()) { + if(shouldRenderOverlay(event.gui) && !(hoverInv && focusInv) && isOnSkyblock()) { if(overlay.mouseInput()) { event.setCanceled(true); } @@ -914,7 +942,7 @@ public class NotEnoughUpdates { return; } - if(event.gui instanceof GuiContainer && isOnSkyblock()) { + if(shouldRenderOverlay(event.gui) && isOnSkyblock()) { if(overlay.keyboardInput(focusInv)) { event.setCanceled(true); } -- cgit From 9716e11a253a370e16dd1f0bdfdd70ac21ee4102 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Tue, 28 Jul 2020 10:35:58 +1000 Subject: 1.11.10 --- .../moulberry/notenoughupdates/NotEnoughUpdates.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 169b6b9f..f5475123 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -29,6 +29,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.shader.Framebuffer; import net.minecraft.client.shader.Shader; import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.init.Blocks; import net.minecraft.inventory.ContainerChest; @@ -167,13 +168,17 @@ public class NotEnoughUpdates { }, new SimpleCommand.TabCompleteRunnable() { @Override public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - /*if(args.length) { - - }*/ - for(String arg : args) { - System.out.println(arg); + if(args.length != 1) return null; + + String lastArg = args[args.length-1]; + List playerMatches = new ArrayList<>(); + for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if(playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } } - return null; + return playerMatches; } }); @@ -705,7 +710,8 @@ public class NotEnoughUpdates { missingRecipe.set(true); } //System.out.println(e.message); - if(isOnSkyblock() && manager.config.streamerMode.value && e.message instanceof ChatComponentText) { + if(unformatted.startsWith("Sending to server") && + isOnSkyblock() && manager.config.streamerMode.value && e.message instanceof ChatComponentText) { String m = e.message.getFormattedText(); String m2 = StreamerMode.filterChat(e.message.getFormattedText()); if(!m.equals(m2)) { -- cgit From 6115246bf36fb98037ca0df2faac869eba7845c3 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Wed, 29 Jul 2020 12:21:03 +1000 Subject: 1.11.10.5 --- src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index f5475123..9e4e851a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -411,6 +411,7 @@ public class NotEnoughUpdates { return true; } catch(Exception ignored) {} + return true; } return false; } -- cgit From d4445fe189480e272ad247860255194d413095dd Mon Sep 17 00:00:00 2001 From: Moulberry Date: Thu, 30 Jul 2020 02:19:32 +1000 Subject: 1.0.3 --- .../moulberry/notenoughupdates/NotEnoughUpdates.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 9e4e851a..0e21067b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -77,7 +77,7 @@ import static io.github.moulberry.notenoughupdates.GuiTextures.*; @Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION) public class NotEnoughUpdates { public static final String MODID = "notenoughupdates"; - public static final String VERSION = "REL-1.0.0"; + public static final String VERSION = "REL-1.0.1"; public static NotEnoughUpdates INSTANCE = null; @@ -366,7 +366,7 @@ public class NotEnoughUpdates { Minecraft.getMinecraft().thePlayer.addChatMessage(links); } - private boolean displayUpdateMessageIfOutOfDate() { + private void displayUpdateMessageIfOutOfDate() { File repo = manager.repoLocation; if(repo.exists()) { File updateJson = new File(repo, "update.json"); @@ -408,12 +408,8 @@ public class NotEnoughUpdates { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); } - - return true; } catch(Exception ignored) {} - return true; } - return false; } /** @@ -425,6 +421,8 @@ public class NotEnoughUpdates { private long lastLongUpdate = 0; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { + if(event.phase != TickEvent.Phase.START) return; + boolean longUpdate = false; long currentTime = System.currentTimeMillis(); if(currentTime - lastLongUpdate > 1000) { @@ -440,9 +438,8 @@ public class NotEnoughUpdates { if(hasSkyblockScoreboard()) { manager.auctionManager.tick(); if(!joinedSB && manager.config.showUpdateMsg.value) { - if(displayUpdateMessageIfOutOfDate()) { - joinedSB = false; - } + joinedSB = true; + displayUpdateMessageIfOutOfDate(); } SBScoreboardData.getInstance().tick(); //GuiQuestLine.questLine.tick(); -- cgit From 6166dd2cbc8acfb67165834869b5d7dee5176cff Mon Sep 17 00:00:00 2001 From: Moulberry Date: Thu, 30 Jul 2020 04:02:01 +1000 Subject: 1.0.4 --- .../notenoughupdates/NotEnoughUpdates.java | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 0e21067b..a68421b8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -141,12 +141,8 @@ public class NotEnoughUpdates { public static ProfileViewer profileViewer; - SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", new SimpleCommand.ProcessCommandRunnable() { + SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - /*if(!OpenGlHelper.isFramebufferEnabled()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "This feature requires FBOs to work. Try disabling Optifine's 'Fast Render'.")); - } else*/ if (manager.config.apiKey.value == null || manager.config.apiKey.value.trim().isEmpty()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Can't view profile, apikey is not set. Run /api new and put the result in settings.")); @@ -165,7 +161,9 @@ public class NotEnoughUpdates { }); } } - }, new SimpleCommand.TabCompleteRunnable() { + }; + + SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", viewProfileRunnable, new SimpleCommand.TabCompleteRunnable() { @Override public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { if(args.length != 1) return null; @@ -182,6 +180,23 @@ public class NotEnoughUpdates { } }); + SimpleCommand viewProfileShortCommand = new SimpleCommand("pv", viewProfileRunnable, new SimpleCommand.TabCompleteRunnable() { + @Override + public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if(args.length != 1) return null; + + String lastArg = args[args.length-1]; + List playerMatches = new ArrayList<>(); + for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if(playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } + } + return playerMatches; + } + }); + SimpleCommand linksCommand = new SimpleCommand("neulinks", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { File repo = manager.repoLocation; @@ -247,6 +262,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(cosmeticsCommand); ClientCommandHandler.instance.registerCommand(linksCommand); ClientCommandHandler.instance.registerCommand(viewProfileCommand); + ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); -- cgit From 1b2b38531242d2f3862f5594199bd55d0bf00539 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Fri, 31 Jul 2020 19:32:53 +1000 Subject: 1.0.5 --- .../notenoughupdates/NotEnoughUpdates.java | 41 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index a68421b8..4b1e3c3c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -220,6 +220,12 @@ public class NotEnoughUpdates { } }); + SimpleCommand tutorialCommand = new SimpleCommand("neututorial", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + openGui = new HelpGUI(); + } + }); + SimpleCommand cosmeticsCommand = new SimpleCommand("neucosmetics", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) { @@ -262,6 +268,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(cosmeticsCommand); ClientCommandHandler.instance.registerCommand(linksCommand); ClientCommandHandler.instance.registerCommand(viewProfileCommand); + ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); @@ -456,6 +463,19 @@ public class NotEnoughUpdates { if(!joinedSB && manager.config.showUpdateMsg.value) { joinedSB = true; displayUpdateMessageIfOutOfDate(); + if(!manager.config.loadedModBefore.value) { + manager.config.loadedModBefore.value = true; + try { manager.saveConfig(); } catch(IOException e) {} + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.BLUE+"It seems this is your first time using NotEnoughUpdates.")); + ChatComponentText clickText = new ChatComponentText( + EnumChatFormatting.YELLOW+"Click this message if you would like to view a short tutorial."); + clickText.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neututorial")); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickText); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + } } SBScoreboardData.getInstance().tick(); //GuiQuestLine.questLine.tick(); @@ -773,13 +793,24 @@ public class NotEnoughUpdates { npe.printStackTrace(); focusInv = !hoverPane; } - if(focusInv) { - try { - overlay.render(event.getMouseX(), event.getMouseY(), hoverInv && focusInv); - } catch(ConcurrentModificationException e) {e.printStackTrace();} - GL11.glTranslatef(0, 0, 10); + } + if(event.gui instanceof GuiItemRecipe) { + GuiItemRecipe guiItemRecipe = ((GuiItemRecipe)event.gui); + hoverInv = event.getMouseX() > guiItemRecipe.guiLeft && event.getMouseX() < guiItemRecipe.guiLeft + guiItemRecipe.xSize && + event.getMouseY() > guiItemRecipe.guiTop && event.getMouseY() < guiItemRecipe.guiTop + guiItemRecipe.ySize; + + if(hoverPane) { + if(!hoverInv) focusInv = false; + } else { + focusInv = true; } } + if(focusInv) { + try { + overlay.render(event.getMouseX(), event.getMouseY(), hoverInv && focusInv); + } catch(ConcurrentModificationException e) {e.printStackTrace();} + GL11.glTranslatef(0, 0, 10); + } } } -- cgit From f729d5199a2acd9264f9e4244d598debdc53cbcc Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sun, 9 Aug 2020 07:02:36 +1000 Subject: 1.1.1 --- .../notenoughupdates/NotEnoughUpdates.java | 137 ++++++++++++++------- 1 file changed, 95 insertions(+), 42 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 4b1e3c3c..fbcd3de3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -52,6 +52,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.apache.commons.lang3.StringUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; @@ -77,7 +78,7 @@ import static io.github.moulberry.notenoughupdates.GuiTextures.*; @Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION) public class NotEnoughUpdates { public static final String MODID = "notenoughupdates"; - public static final String VERSION = "REL-1.0.1"; + public static final String VERSION = "1.1-REL"; public static NotEnoughUpdates INSTANCE = null; @@ -180,16 +181,51 @@ public class NotEnoughUpdates { } }); - SimpleCommand viewProfileShortCommand = new SimpleCommand("pv", viewProfileRunnable, new SimpleCommand.TabCompleteRunnable() { + SimpleCommand viewProfileShortCommand = new SimpleCommand("pv", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(!hasSkyblockScoreboard()) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pv " + StringUtils.join(args, " ")); + } else { + viewProfileRunnable.processCommand(sender, args); + } + } + }, new SimpleCommand.TabCompleteRunnable() { @Override public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if(args.length != 1) return null; - - String lastArg = args[args.length-1]; + if (args.length != 1) return null; + + String lastArg = args[args.length - 1]; List playerMatches = new ArrayList<>(); - for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { String playerName = player.getName(); - if(playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } + } + return playerMatches; + } + }); + + SimpleCommand viewProfileShort2Command = new SimpleCommand("vp", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(!hasSkyblockScoreboard()) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/vp " + StringUtils.join(args, " ")); + } else { + viewProfileRunnable.processCommand(sender, args); + } + } + }, new SimpleCommand.TabCompleteRunnable() { + @Override + public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length != 1) return null; + + String lastArg = args[args.length - 1]; + List playerMatches = new ArrayList<>(); + for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { playerMatches.add(playerName); } } @@ -268,8 +304,9 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(cosmeticsCommand); ClientCommandHandler.instance.registerCommand(linksCommand); ClientCommandHandler.instance.registerCommand(viewProfileCommand); - ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); + ClientCommandHandler.instance.registerCommand(viewProfileShort2Command); + ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); @@ -442,6 +479,7 @@ public class NotEnoughUpdates { */ private HashMap newItemAddMap = new HashMap<>(); private long lastLongUpdate = 0; + private long lastSkyblockScoreboard = 0; @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if(event.phase != TickEvent.Phase.START) return; @@ -459,7 +497,7 @@ public class NotEnoughUpdates { if(longUpdate) { updateSkyblockScoreboard(); if(hasSkyblockScoreboard()) { - manager.auctionManager.tick(); + lastSkyblockScoreboard = currentTime; if(!joinedSB && manager.config.showUpdateMsg.value) { joinedSB = true; displayUpdateMessageIfOutOfDate(); @@ -480,6 +518,11 @@ public class NotEnoughUpdates { SBScoreboardData.getInstance().tick(); //GuiQuestLine.questLine.tick(); } + if(currentTime - lastSkyblockScoreboard < 5*60*1000) { //5 minutes +