diff options
12 files changed, 537 insertions, 221 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index c7e89e9b..d6b9d3c8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -776,6 +776,20 @@ public class NEUEventListener { return Utils.trimIgnoreColour(text.replaceAll(EnumChatFormatting.DARK_GREEN+"\\S+ Drill Fuel", "")); } + + private IChatComponent replaceSocialControlsWithPV(IChatComponent chatComponent){ + + if(NotEnoughUpdates.INSTANCE.config.misc.replaceSocialOptions && chatComponent.getChatStyle() != null && chatComponent.getChatStyle().getChatClickEvent() != null && chatComponent.getChatStyle().getChatClickEvent().getAction() == ClickEvent.Action.RUN_COMMAND){ + if(chatComponent.getChatStyle().getChatClickEvent().getValue().startsWith("/socialoptions")){ + String username = chatComponent.getChatStyle().getChatClickEvent().getValue().substring(15); + + chatComponent.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/pv "+username, ""+EnumChatFormatting.YELLOW+"Click to open "+EnumChatFormatting.AQUA+EnumChatFormatting.BOLD+username+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+"'s profile in "+EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD+"NEU's"+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+ " profile viewer.")); + return chatComponent; + } + } + return chatComponent; + } + /** * 1) When receiving "You are playing on profile" messages, will set the current profile. * 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI) @@ -787,6 +801,8 @@ public class NEUEventListener { CrystalMetalDetectorSolver.process(e.message); e.message = processChatComponent(e.message); return; + } else if(e.type == 0){ + e.message = replaceSocialControlsWithPV(e.message); } DungeonWin.onChatMessage(e); @@ -937,15 +953,20 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(containerName.endsWith(" Profile")){ - Slot slot = new Slot(cc.getLowerChestInventory(), 34, cc.inventorySlots.get(34).xDisplayPosition, cc.inventorySlots.get(34).yDisplayPosition); - slot.putStack(Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), EnumChatFormatting.GREEN + "Profile Viewer", - EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!")); - cc.inventorySlots.replaceAll(e -> { - if(e.getSlotIndex() == 34) - return slot; - return e; - }); + if(containerName.contains(" Profile") && cc.inventorySlots.size() >= 54){ + if(cc.inventorySlots.get(22).getStack() != null && cc.inventorySlots.get(22).getStack().getTagCompound() != null){ + NBTTagCompound tag = eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound(); + if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){ + String tagName = tag.getCompoundTag("SkullOwner").getString("Name"); + String displayname = Utils.cleanColour(cc.inventorySlots.get(22).getStack().getDisplayName()); + if(tagName.equals(displayname.substring(displayname.length()-tagName.length()))){ + Slot slot = new Slot(cc.getLowerChestInventory(), 42, cc.inventorySlots.get(42).xDisplayPosition, cc.inventorySlots.get(42).yDisplayPosition); + slot.putStack(Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), EnumChatFormatting.GREEN + "Profile Viewer", + EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!")); + cc.inventorySlots.set(42, slot); + } + } + } } } @@ -1396,12 +1417,17 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(containerName.endsWith(" Profile") && eventGui.getSlotUnderMouse() != null && eventGui.getSlotUnderMouse().getSlotIndex() == 34 && - Mouse.getEventButton() >= 0) { + if(containerName.contains(" Profile") && eventGui.getSlotUnderMouse() != null && + eventGui.getSlotUnderMouse().getSlotIndex() == 42 && Mouse.getEventButton() >= 0) { event.setCanceled(true); - if(Mouse.getEventButtonState()) { - Utils.playPressSound(); - NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + if(Mouse.getEventButtonState() && eventGui.inventorySlots.inventorySlots.get(22).getStack() != null && + eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound() != null){ + NBTTagCompound tag = eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound(); + if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){ + String username = tag.getCompoundTag("SkullOwner").getString("Name"); + Utils.playPressSound(); + NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{username}); + } } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 79a822d8..1c6ae7f7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -15,7 +15,6 @@ import io.github.moulberry.notenoughupdates.mbgui.MBGuiElement; import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupAligned; import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupFloating; import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu; -import io.github.moulberry.notenoughupdates.miscgui.HelpGUI; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; @@ -52,7 +51,6 @@ import org.lwjgl.util.vector.Vector2f; import java.awt.*; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.List; import java.util.*; import java.util.concurrent.ExecutorService; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index f0cf7774..142cb149 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -27,6 +27,7 @@ import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes; import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; +import io.github.moulberry.notenoughupdates.miscgui.tutorials.NeuTutorial; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.overlays.FuelBar; @@ -990,7 +991,7 @@ public class NotEnoughUpdates { SimpleCommand tutorialCommand = new SimpleCommand("neututorial", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - openGui = new HelpGUI(); + openGui = new NeuTutorial(); } }); @@ -1257,7 +1258,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(packDevCommand); if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); ClientCommandHandler.instance.registerCommand(peekCommand); - //ClientCommandHandler.instance.registerCommand(tutorialCommand); +// ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 7f981092..7459c4a4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -420,7 +420,7 @@ public class SlotLocking { return; } else if(locked.locked || (clickType == 2 && SlotLocking.getInstance().isSlotIndexLocked(clickedButton))) { consumer.accept(null); - } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1) { + } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1 && locked.boundTo != -1) { GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen; Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, locked.boundTo); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java deleted file mode 100644 index cc41a76f..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java +++ /dev/null @@ -1,189 +0,0 @@ -package io.github.moulberry.notenoughupdates.miscgui; - -import io.github.moulberry.notenoughupdates.util.TexLoc; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Keyboard; -import org.lwjgl.util.vector.Vector2f; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class HelpGUI extends GuiScreen { - - private int guiLeft = 0; - private int guiTop = 0; - private int sizeX = 0; - private int sizeY = 0; - - private int page = 0; - private ResourceLocation screenshotBorder = new ResourceLocation("notenoughupdates:ss_border.jpg"); - private ResourceLocation[] screenshots = null; - - int scaleFactor = 0; - - @Override - public void setWorldAndResolution(Minecraft mc, int width, int height) { - super.setWorldAndResolution(mc, width, height); - - screenshots = new ResourceLocation[18]; - for(int i=0; i<=17; i++) { - screenshots[i] = new ResourceLocation("notenoughupdates:ss_small/ss"+(i+1)+"-0.jpg"); - } - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - Keyboard.enableRepeatEvents(true); - super.keyTyped(typedChar, keyCode); - if(keyCode == Keyboard.KEY_LEFT) { - page--; - } else if(keyCode == Keyboard.KEY_RIGHT) { - page++; - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - - drawDefaultBackground(); - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - scaleFactor = scaledResolution.getScaleFactor(); - - sizeX = width/2+40/scaleFactor; - sizeY = height/2+40/scaleFactor; - guiLeft = width/4-20/scaleFactor; - guiTop = height/4-20/scaleFactor; - - Minecraft.getMinecraft().getTextureManager().bindTexture(screenshotBorder); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY); - - page = Math.max(0, Math.min(17, page)); - - Minecraft.getMinecraft().getTextureManager().bindTexture(screenshots[page]); - Utils.drawTexturedRect(guiLeft+20f/scaleFactor, guiTop+20f/scaleFactor, sizeX-40f/scaleFactor, sizeY-40f/scaleFactor); - - Utils.drawStringCentered(EnumChatFormatting.GOLD+"NEU Tutorial - Page "+(page+1)+"/18 - Use arrow keys", Minecraft.getMinecraft().fontRendererObj, - width/2, guiTop+8, true, 0); - if(scaleFactor != 2) Utils.drawStringCentered(EnumChatFormatting.GOLD+"Use GUI Scale normal for better reading experience", Minecraft.getMinecraft().fontRendererObj, - width/2, guiTop+18, true, 0); - - for(Map.Entry<Vector2f, List<String>> entry : texts[page].entrySet()) { - Vector2f location = entry.getKey(); - List<String> text = entry.getValue(); - - float x = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*location.x; - float y = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*location.y; - - Utils.drawHoveringText(text, (int)x, (int)y+12, 100000, 100000, 200, Minecraft.getMinecraft().fontRendererObj); - } - } - - - private static HashMap<Vector2f, List<String>>[] texts = new HashMap[18]; - static { - for(int i=0; i<18; i++) { - texts[i] = new HashMap<>(); - } - texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", - EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); - texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"These are the page controls for the itemlist", - EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); - texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", - EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", - EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); - texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"This is the search bar for the itemlist", - EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", - EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", - EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); - texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( - EnumChatFormatting.GOLD+"QuickCommands", - EnumChatFormatting.GRAY+"These are the QuickCommands", - EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); - texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", - EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", - EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", - EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); - texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( - EnumChatFormatting.GOLD+"Collection Log", - EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", - EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", - EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); - texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( - EnumChatFormatting.GOLD+"Collection Log", - EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", - EnumChatFormatting.GRAY+"appear in the list")); - texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", - EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", - EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", - EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); - texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", - EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); - texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"Search for items using the search bar at the top", - EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); - texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"This toolbar contains many useful features", - EnumChatFormatting.GRAY+"which control the sorting and ordering of", - EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); - texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", - EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", - EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); - texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", - EnumChatFormatting.GRAY+"This is the main page of the profile viewer", - EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); - texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); - texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", - EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); - texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", - EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", - EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); - texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", - EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); - texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", - EnumChatFormatting.GRAY+"Click to select the pet on the left", - EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); - texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( - EnumChatFormatting.GOLD+"Overlay", - EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", - EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java new file mode 100644 index 00000000..c4d0115f --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java @@ -0,0 +1,9 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +public class NeuConfigTutorial extends TutorialBase { + + static { + title = "NEU Config Tutorial"; + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java new file mode 100644 index 00000000..454c8788 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java @@ -0,0 +1,127 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.util.vector.Vector2f; + +import java.util.ArrayList; +import java.util.HashMap; + +public class NeuTutorial extends TutorialBase { + + static { + title = "NEU Tutorial"; + } + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + screenshots = new ResourceLocation[18]; + for (int i = 0; i <= 17; i++) { + screenshots[i] = new ResourceLocation("notenoughupdates:ss_small/ss" + (i + 1) + "-0.jpg"); + } + } + +// static { +// +// texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", +// EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); +// texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the page controls for the itemlist", +// EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); +// texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", +// EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", +// EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); +// texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"This is the search bar for the itemlist", +// EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", +// EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", +// EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); +// texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( +// EnumChatFormatting.GOLD+"QuickCommands", +// EnumChatFormatting.GRAY+"These are the QuickCommands", +// EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); +// texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", +// EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", +// EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", +// EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); +// texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", +// EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); +// texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", +// EnumChatFormatting.GRAY+"appear in the list")); +// texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", +// EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", +// EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); +// texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", +// EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); +// texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Search for items using the search bar at the top", +// EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); +// texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This toolbar contains many useful features", +// EnumChatFormatting.GRAY+"which control the sorting and ordering of", +// EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); +// texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", +// EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", +// EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); +// texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", +// EnumChatFormatting.GRAY+"This is the main page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); +// texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); +// texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); +// texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", +// EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); +// texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); +// texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", +// EnumChatFormatting.GRAY+"Click to select the pet on the left", +// EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); +// texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"Overlay", +// EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", +// EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); +// } +// +// static { +// buttons = new ArrayList<>(); +// buttons.add(createNewButton(0.27f, 0.40f, new int[]{1, 2},"TESTSHIT", "neu")); +// } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java new file mode 100644 index 00000000..215f210c --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java @@ -0,0 +1,319 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ClientCommandHandler; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour.custom_ench_colour; + +public class TutorialBase extends GuiScreen { + + private int guiLeft = 0; + private int guiTop = 0; + private int sizeX = 0; + private int sizeY = 0; + + protected static String title; + + private int page = 0; + private ResourceLocation screenshotBorder = new ResourceLocation("notenoughupdates:ss_border.jpg"); + + protected ResourceLocation[] screenshots = null; + + int scaleFactor = 0; + + + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + } + + @Override + protected void keyTyped(char typedChar, int keyCode) throws IOException { + Keyboard.enableRepeatEvents(true); + super.keyTyped(typedChar, keyCode); + if(keyCode == Keyboard.KEY_LEFT) { + page--; + } else if(keyCode == Keyboard.KEY_RIGHT) { + page++; + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); + + drawDefaultBackground(); + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + scaleFactor = scaledResolution.getScaleFactor(); + + sizeX = width/2+40/scaleFactor; + sizeY = height/2+40/scaleFactor; + guiLeft = width/4-20/scaleFactor; + guiTop = height/4-20/scaleFactor; + + Minecraft.getMinecraft().getTextureManager().bindTexture(screenshotBorder); + Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY); + + page = Math.max(0, Math.min(17, page)); + + Minecraft.getMinecraft().getTextureManager().bindTexture(screenshots[page]); + Utils.drawTexturedRect(guiLeft+20f/scaleFactor, guiTop+20f/scaleFactor, sizeX-40f/scaleFactor, sizeY-40f/scaleFactor); + + Utils.drawStringCentered(EnumChatFormatting.GOLD+title+" - Page "+(page+1)+"/"+(texts.size())+" - Use arrow keys", Minecraft.getMinecraft().fontRendererObj, + width/2, guiTop+8, true, 0); + if(scaleFactor != 2) Utils.drawStringCentered(EnumChatFormatting.GOLD+"Use GUI Scale normal for better reading experience", Minecraft.getMinecraft().fontRendererObj, + width/2, guiTop+18, true, 0); + JsonArray pageTexts = texts.get(page); + for (int i = 0; i < pageTexts.size(); i++) { + JsonObject textElement = pageTexts.get(i).getAsJsonObject(); + float oldX = textElement.get("x").getAsFloat(); + float oldY = textElement.get("y").getAsFloat(); + +// List<String> text = entry.getValue(); + JsonArray textArray = textElement.getAsJsonArray("lines"); + List<String> text = new ArrayList<>(); + for (int j = 0; j < textArray.size(); j++) { + text.add(textArray.get(j).getAsString()); + } + + + float x = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*oldX; + float y = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*oldY; + + Utils.drawHoveringText(text, (int)x, (int)y+12, 100000, 100000, 200, Minecraft.getMinecraft().fontRendererObj); + } + + drawButtons(); + } + + protected void drawButtons(){ + + for (int i = 0; i < buttons.size(); i++) { + JsonObject button = buttons.get(i); + JsonArray pages = button.get("pages").getAsJsonArray(); + boolean drawButton = false; + for (int i1 = 0; i1 < pages.size(); i1++) { + if(pages.get(i1).getAsInt() == page){ + drawButton = true; + break; + } + } + if(!drawButton){ + continue; + } + float x = button.get("x").getAsFloat(); + float y = button.get("y").getAsFloat(); + String text = button.get("text").getAsString(); +// String command = button.get("command").getAsString(); + Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x, guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth(text, fontRendererObj, (guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x)+44, (guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y)+10, false, 86, 4210752); + + + } + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + int width= 88; + int height = 20; + + for (int i = 0; i < buttons.size(); i++) { + JsonObject button = buttons.get(i); + JsonArray pages = button.get("pages").getAsJsonArray(); + boolean drawButton = false; + for (int i1 = 0; i1 < pages.size(); i1++) { + if(pages.get(i1).getAsInt() == page){ + drawButton = true; + break; + } + } + if(!drawButton){ + continue; + } + float x = button.get("x").getAsFloat(); + float y = button.get("y").getAsFloat(); + //String text = button.get("text").getAsString(); + float realX = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x; + float realY = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y; + if(mouseX > realX && mouseX < realX+width && mouseY > realY && mouseY < realY+height){ + String command = button.get("command").getAsString(); + NotEnoughUpdates.INSTANCE.openGui = null; + ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/"+command); + return; + } + } + } + + + + + + protected static List<JsonArray> texts = new ArrayList<JsonArray>(); + + protected static List<JsonObject> buttons = new ArrayList<>(); + + protected static JsonObject createNewButton(float x, float y, int[] pages, String text, String command){ + JsonObject button = new JsonObject(); + JsonArray pagesArray = new JsonArray(); + for (int i = 0; i < pages.length; i++) { + pagesArray.add(new JsonPrimitive(pages[i])); + } + button.add("pages",pagesArray); + button.add("x", new JsonPrimitive(x)); + button.add("y", new JsonPrimitive(y)); + button.add("text", new JsonPrimitive(text)); + button.add("command", new JsonPrimitive(command)); + return button; + } + + protected static JsonArray createNewTexts(JsonObject... texts){ + JsonArray textArray = new JsonArray(); + for (int i = 0; i < texts.length; i++) { + textArray.add(texts[i]); + } + return textArray; + } + + protected static JsonObject createNewText(float x, float y, String... texts){ + JsonObject tooltip = new JsonObject(); + tooltip.add("x", new JsonPrimitive(x)); + tooltip.add("y", new JsonPrimitive(y)); + JsonArray lines = new JsonArray(); + for (int i = 0; i < texts.length; i++) { + lines.add(new JsonPrimitive(texts[i])); + } + tooltip.add("lines", lines); + return tooltip; + } + + protected static JsonObject createNewText(float x, float y, List<String> texts){ + JsonObject tooltip = new JsonObject(); + tooltip.add("x", new JsonPrimitive(x)); + tooltip.add("y", new JsonPrimitive(y)); + JsonArray lines = new JsonArray(); + for (int i = 0; i < texts.size(); i++) { + lines.add(new JsonPrimitive(texts.get(i))); + } + tooltip.add("lines", lines); + return tooltip; + } + +// static { +// for(int i=0; i<18; i++) { +// texts[i] = new HashMap<>(); +// } +// texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", +// EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); +// texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the page controls for the itemlist", +// EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); +// texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", +// EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", +// EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); +// texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"This is the search bar for the itemlist", +// EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", +// EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", +// EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); +// texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( +// EnumChatFormatting.GOLD+"QuickCommands", +// EnumChatFormatting.GRAY+"These are the QuickCommands", +// EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); +// texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", +// EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", +// EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", +// EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); +// texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", +// EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); +// texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", +// EnumChatFormatting.GRAY+"appear in the list")); +// texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", +// EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", +// EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); +// texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", +// EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); +// texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Search for items using the search bar at the top", +// EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); +// texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This toolbar contains many useful features", +// EnumChatFormatting.GRAY+"which control the sorting and ordering of", +// EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); +// texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", +// EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", +// EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); +// texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", +// EnumChatFormatting.GRAY+"This is the main page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); +// texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); +// texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); +// texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", +// EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); +// texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); +// texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", +// EnumChatFormatting.GRAY+"Click to select the pet on the left", +// EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); +// texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"Overlay", +// EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", +// EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); +// } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java index 6a083cae..b38e7fd5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java @@ -38,6 +38,17 @@ public class Misc { @ConfigEditorBoolean
public boolean guiButtonClicks = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Replace Chat Social Options",
+ desc = "Replace Hypixel's chat social options with NEU's profile viewer."
+ )
+ @ConfigEditorBoolean
+ public boolean replaceSocialOptions = true;
+
+
+
@Expose
@ConfigOption(
name = "Damage Indicator Style",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index c338c9a5..8a4c697e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -97,11 +97,11 @@ public class MiningOverlay extends TextOverlay { String line = lore[i1]; Matcher matcher = timeRemainingForge.matcher(line); if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")) { - ForgeItem newForgeItem = new ForgeItem("Locked", 0, 1, i, false); + ForgeItem newForgeItem = new ForgeItem(i, 1, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); //empty Slot } else if (stack.getDisplayName().matches("\\xA7aSlot #([1-5])")) { - ForgeItem newForgeItem = new ForgeItem("Empty", 0, 0, i, false); + ForgeItem newForgeItem = new ForgeItem(i, 0, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); } else if (matcher.matches()) { String timeremainingString = matcher.group(1); @@ -109,7 +109,7 @@ public class MiningOverlay extends TextOverlay { long duration = 0; if (matcher.group("Completed") != null && !matcher.group("Completed").equals("")) { - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, 2, i, false); + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, i, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); } else { @@ -129,7 +129,7 @@ public class MiningOverlay extends TextOverlay { } catch (Exception ignored) { } if (duration > 0) { - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, 2, i, false); + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, i, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); } } @@ -260,10 +260,10 @@ public class MiningOverlay extends TextOverlay { } else { if (name.contains("LOCKED")) { - ForgeItem item = new ForgeItem("Locked", 0, 1, forgeInt, true); + ForgeItem item = new ForgeItem(forgeInt, 1,true); replaceForgeOrAdd(item, hidden.forgeItems, true); } else if (name.contains("EMPTY")) { - ForgeItem item = new ForgeItem("Empty", 0, 0, forgeInt, true); + ForgeItem item = new ForgeItem(forgeInt, 0,true); replaceForgeOrAdd(item, hidden.forgeItems, true); //forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); } else { @@ -276,7 +276,7 @@ public class MiningOverlay extends TextOverlay { String itemName = matcher.group(1); if (matcher.group("Ready") != null && !matcher.group("Ready").equals("")) { - ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, 2, forgeInt, true); + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, forgeInt, true); replaceForgeOrAdd(item, hidden.forgeItems, true); } else { long duration = 0; @@ -297,7 +297,7 @@ public class MiningOverlay extends TextOverlay { } if (duration > 0) { duration = duration + 4000; - ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, 2, forgeInt, true); + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, forgeInt, true); replaceForgeOrAdd(item, hidden.forgeItems, false); } } @@ -483,17 +483,23 @@ public class MiningOverlay extends TextOverlay { } public static class ForgeItem{ - public ForgeItem(String itemName, long finishTime, int status, int forgeID, boolean fromScoreBoard){ + public ForgeItem(String itemName, long finishTime, int forgeID, boolean fromScoreBoard){ this.itemName = itemName; this.finishTime = finishTime; - this.status = status; + this.status = 2; + this.forgeID = forgeID; + this.fromScoreBoard = fromScoreBoard; + } + + public ForgeItem(int forgeID, int status, boolean fromScoreBoard){ this.forgeID = forgeID; + this.status = status; this.fromScoreBoard = fromScoreBoard; } - @Expose public final String itemName; - @Expose public final long finishTime; + @Expose public String itemName; + @Expose public long finishTime; @Expose public final int status; @Expose public final int forgeID; @Expose public final boolean fromScoreBoard; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java index f7d5157f..e75eaebb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.util; import com.google.gson.Gson; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import org.apache.commons.io.IOUtils; import java.io.BufferedReader; @@ -80,7 +81,9 @@ public class HypixelApi { try { consumer.accept(getApiSync(getMyApiURL()+urlS)); } catch(Exception e) { - e.printStackTrace(); + if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { + e.printStackTrace(); + } myApiError(current); error.run(); } 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 3e84261c..7f1c20d3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -1045,6 +1045,11 @@ public class Utils { style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW+value))); return style; } + public static ChatStyle createClickStyle(ClickEvent.Action action, String value, String message) { + ChatStyle style = createClickStyle(action, value); + style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(message))); + return style; + } public static void recursiveDelete(File file) { if(file.isDirectory() && !Files.isSymbolicLink(file.toPath())) { |