diff options
41 files changed, 7725 insertions, 7032 deletions
diff --git a/README.md b/README.md new file mode 100644 index 00000000..d8ced796 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ + +# NotEnoughUpdates Fork by DoKM + +### Currently if you get a array out of bounds exception this is due to the todolist update +Please go into .minecraft/config/notenoughupdates and then open the configNew.json in a text editor. +In that file go to the "miscOverlays" section and find "todoText" and clear it. + +This is a fork that I will try to keep updated with the original NEU repo while also adding features/fixing bugs etc. + +**Currently the added features are:** + +1. More options for the Todo list +2. Added the voidgloom slayer stats to the /pv +3. Added Dungeon accesories to the accesory bag upgrade view +4. Added Dungeon items to the itemlist categories (for example armors now include dungeon armors and weapons include dungeon weapons) +5. Added check to see if titanium that spawned atleast touches 1 air block (toggleable) +6. Added check so titanium alert doesnt happen if titanium commision is set to "DONE" +7. Added Storage to PV (with correct sizes) +8. Added Personal Vault to PV + +**Currently the fixed features are:** + +1. Todo list + 1. Fixed fetchur display + 2. Fixed godpot timer + +2. PV's wardrobe view not showing second page bottom row (not fully fixed could be better by dividing on every 4 and drawing per column instead of row but right now its always a full page) +3. Made dwarven overlay work in crystal hollows +4. Added Gemstone powder to dwarven overlay +5. Made smooth aote work with aotv (thanks to 8k for letting me test his aotv) + +**Currently the fixed bugs are:** + +1. Arrow Key backpack option under storage gui not doing anything +2. Fixed pets gui going away if you open /pets + + + diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index d55bad48..2a6160f1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1186,11 +1186,11 @@ public class NEUOverlay extends Gui { return internalname.matches(petRegex) && item.get("displayname").getAsString().contains("["); } else if(getSortMode() == SORT_MODE_TOOL) { return checkItemType(item.get("lore").getAsJsonArray(), - "SWORD", "BOW", "AXE", "PICKAXE", "FISHING ROD", "WAND", "SHOVEL", "HOE") >= 0; + "SWORD", "BOW", "AXE", "PICKAXE", "FISHING ROD", "WAND", "SHOVEL", "HOE", "DUNGEON SWORD", "DUNGEON BOW") >= 0; } else if(getSortMode() == SORT_MODE_ARMOR) { - return checkItemType(item.get("lore").getAsJsonArray(), "HELMET", "CHESTPLATE", "LEGGINGS", "BOOTS") >= 0; + return checkItemType(item.get("lore").getAsJsonArray(), "HELMET", "CHESTPLATE", "LEGGINGS", "BOOTS", "DUNGEON HELMET", "DUNGEON CHESTPLATE", "DUNGEON LEGGINGS", "DUNGEON BOOTS") >= 0; } else if(getSortMode() == SORT_MODE_ACCESSORY) { - return checkItemType(item.get("lore").getAsJsonArray(), "ACCESSORY") >= 0; + return checkItemType(item.get("lore").getAsJsonArray(), "ACCESSORY", "HATCCESSORY", "DUNGEON ACCESSORY") >= 0; } return true; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java index b0e46e00..ea2631df 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java @@ -1,714 +1,715 @@ -package io.github.moulberry.notenoughupdates.dungeons; - -import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor; -import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; -import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils; -import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.core.GuiElementColour; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption; -import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; -import io.github.moulberry.notenoughupdates.util.SpecialColour; -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.client.renderer.OpenGlHelper; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.client.shader.Shader; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.Matrix4f; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec4b; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.*; -import java.util.List; -import static io.github.moulberry.notenoughupdates.util.GuiTextures.*; - -public class GuiDungeonMapEditor extends GuiScreen { - - public static final ResourceLocation BACKGROUND = new ResourceLocation("notenoughupdates:dungeon_map/editor/background.png"); - public static final ResourceLocation BUTTON = new ResourceLocation("notenoughupdates:button.png"); - private static final DungeonMap demoMap = new DungeonMap(); - - private int sizeX; - private int sizeY; - private int guiLeft; - private int guiTop; - - private List<Button> buttons = new ArrayList<>(); - - private GuiElementTextField blurField = new GuiElementTextField("", GuiElementTextField.NUM_ONLY | GuiElementTextField.NO_SPACE); - private GuiElementColour activeColourEditor = null; - - private Field clickedSlider; - - class Button { - private int id; - private int x; - private int y; - private String text; - private Color colour = new Color(-1, true); - private Field option; - private String displayName; - private String desc; - - public Button(int id, int x, int y, String text) { - this(id, x, y, text, null); - } - - public Button(int id, int x, int y, String text, Field option) { - this.id = id; - this.x = x; - this.y = y; - this.text = text; - this.option = option; - - if(option != null) { - ConfigOption optionAnnotation = option.getAnnotation(ConfigOption.class); - displayName = optionAnnotation.name(); - desc = optionAnnotation.desc(); - } - } - - public List<String> getTooltip() { - if(option == null) { - return null; - } - - List<String> tooltip = new ArrayList<>(); - tooltip.add(EnumChatFormatting.YELLOW+displayName); - for(String line : desc.split("\n")) { - tooltip.add(EnumChatFormatting.AQUA+line); - } - return tooltip; - } - - public void render() { - if(text == null) return; - - Minecraft.getMinecraft().getTextureManager().bindTexture(BUTTON); - if(isButtonPressed(id)) { - GlStateManager.color(colour.getRed()*0.85f/255f, colour.getGreen()*0.85f/255f, - colour.getBlue()*0.85f/255f, 1); - Utils.drawTexturedRect(guiLeft+x, guiTop+y, 48, 16, 1, 0, 1, 0, GL11.GL_NEAREST); - } else { - GlStateManager.color(colour.getRed()/255f, colour.getGreen()/255f, colour.getBlue()/255f, 1); - Utils.drawTexturedRect(guiLeft+x, guiTop+y, 48, 16, GL11.GL_NEAREST); - } - - if(text.length() > 0) { - Utils.drawStringCenteredScaledMaxWidth(text, Minecraft.getMinecraft().fontRendererObj , guiLeft+x+24, guiTop+y+8, false, 39, 0xFF000000); - } - } - - } - - public GuiDungeonMapEditor() { - NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap; - //Map Border Size - //buttons.add(new Button(0, 6, 37, "Small", options.dmBorderSize)); - //buttons.add(new Button(1, 52, 37, "Medium", options.dmBorderSize)); - //buttons.add(new Button(2, 98, 37, "Large", options.dmBorderSize)); - - //Map Rooms Size - //buttons.add(new Button(3, 6, 67+19, "Small", options.dmRoomSize)); - //buttons.add(new Button(4, 52, 67+19, "Medium", options.dmRoomSize)); - //buttons.add(new Button(5, 98, 67+19, "Large", options.dmRoomSize)); - - //Map Border Styles - buttons.add(new Button(6, 6, 97+30, "None")); - buttons.add(new Button(7, 52, 97+30, "Custom")); - buttons.add(new Button(8, 98, 97+30, "Stone")); - buttons.add(new Button(9, 6, 116+30, "Wood")); - buttons.add(new Button(10, 52, 116+30, "Rustic(S)")); - buttons.add(new Button(11, 98, 116+30, "Rustic(C)")); - buttons.add(new Button(12, 6, 135+30, "Fade")); - buttons.add(new Button(13, 52, 135+30, "Ribbons")); - buttons.add(new Button(14, 98, 135+30, "Paper")); - buttons.add(new Button(15, 6, 154+30, "Crimson")); - buttons.add(new Button(16, 52, 154+30, "Ornate")); - buttons.add(new Button(17, 98, 154+30, "Dragon")); - - try { - //Dungeon Map - buttons.add(new Button(18, 20+139, 36, "Yes/No", NEUConfig.DungeonMap.class.getDeclaredField("dmEnable"))); - //Center - buttons.add(new Button(19, 84+139, 36, "Player/Map", NEUConfig.DungeonMap.class.getDeclaredField("dmCenterPlayer"))); - //Rotate - buttons.add(new Button(20, 20+139, 65, "Player/No Rotate", NEUConfig.DungeonMap.class.getDeclaredField("dmRotatePlayer"))); - //Icon Style - buttons.add(new Button(21, 84+139, 65, "Default/Heads", NEUConfig.DungeonMap.class.getDeclaredField("dmPlayerHeads"))); - //Check Orient - buttons.add(new Button(22, 20+139, 94, "Normal/Reorient", NEUConfig.DungeonMap.class.getDeclaredField("dmOrientCheck"))); - //Check Center - buttons.add(new Button(23, 84+139, 94, "Yes/No", NEUConfig.DungeonMap.class.getDeclaredField("dmCenterCheck"))); - //Interpolation - buttons.add(new Button(24, 20+139, 123, "Yes/No", NEUConfig.DungeonMap.class.getDeclaredField("dmPlayerInterp"))); - //Compatibility - buttons.add(new Button(25, 84+139, 123, "Normal/No SHD/No FB/SHD", NEUConfig.DungeonMap.class.getDeclaredField("dmCompat"))); - - //Background - buttons.add(new Button(26, 20+139, 152, "", NEUConfig.DungeonMap.class.getDeclaredField("dmBackgroundColour"))); - //Border - buttons.add(new Button(27, 84+139, 152, "", NEUConfig.DungeonMap.class.getDeclaredField("dmBorderColour"))); - - //Chroma Mode - buttons.add(new Button(28, 84+139, 181, "Normal/Scroll", NEUConfig.DungeonMap.class.getDeclaredField("dmChromaBorder"))); - } catch(Exception e) { - e.printStackTrace(); - } - - //buttons.add(new Button(29, 52, 86+19, "XLarge", options.dmRoomSize)); - //buttons.add(new Button(30, 52, 56, "XLarge", options.dmBorderSize)); - - { - double val = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur; - String strVal; - if(val % 1 == 0) { - strVal = Integer.toString((int)val); - } else { - strVal = Double.toString(val); - strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1"); - strVal = strVal.replaceAll("0+$", ""); - } - blurField.setText(strVal); - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - ScaledResolution scaledResolution = Utils.pushGuiScale(2); - this.width = scaledResolution.getScaledWidth(); - this.height = scaledResolution.getScaledHeight(); - - mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth; - mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; - - List<String> tooltipToDisplay = null; - for(Button button : buttons) { - if(mouseX >= guiLeft+button.x && mouseX <= guiLeft+button.x+48 && - mouseY >= guiTop+button.y-13 && mouseY <= guiTop+button.y+16) { - if(button.id >= 6 && button.id <= 17) { - String mapDesc = null; - String mapCredit = null; - int id = button.id; - switch(id) { - case 6: - mapDesc = "No Border"; break; - case 7: - mapDesc = "Used by custom Resource Packs"; break; - case 8: - mapDesc = "Simple gray border"; mapCredit = "TomEngMaster"; break; - case 9: - mapDesc = "Viney wood border"; mapCredit = "iDevil4Hell"; break; - case 10: - mapDesc = "Steampunk-inspired square border"; mapCredit = "ThatGravyBoat"; break; - case 11: - mapDesc = "Steampunk-inspired circular border"; mapCredit = "ThatGravyBoat"; break; - case 12: - mapDesc = "Light fade border"; mapCredit = "Qwiken"; break; - case 13: - mapDesc = "Simple gray border with red ribbons"; mapCredit = "Sai"; break; - case 14: - mapDesc = "Paper border"; mapCredit = "KingJames02st"; break; - case 15: - mapDesc = "Nether-inspired border"; mapCredit = "DTRW191"; break; - case 16: - mapDesc = "Golden ornate border"; mapCredit = "iDevil4Hell"; break; - case 17: - mapDesc = "Stone dragon border"; mapCredit = "ImperiaL"; break; - } - - ArrayList<String> tooltip = new ArrayList<>(); - tooltip.add(EnumChatFormatting.YELLOW+"Border Style"); - tooltip.add(EnumChatFormatting.AQUA+"Customize the look of the dungeon border"); - tooltip.add(""); - if(mapDesc != null) tooltip.add(EnumChatFormatting.YELLOW+"Set to: "+EnumChatFormatting.AQUA+mapDesc); - if(mapCredit != null) tooltip.add(EnumChatFormatting.YELLOW+"Artist: "+EnumChatFormatting.GOLD+mapCredit); - tooltipToDisplay = tooltip; - } else { - tooltipToDisplay = button.getTooltip(); - } - break; - } - } - - this.sizeX = 431; - this.sizeY = 237; - this.guiLeft = (this.width - this.sizeX) / 2; - this.guiTop = (this.height-this.sizeY)/2; - - super.drawScreen(mouseX, mouseY, partialTicks); - drawDefaultBackground(); - - blurBackground(); - renderBlurredBackground(width, height, guiLeft+2, guiTop+2, sizeX-4, sizeY-4); - - Minecraft.getMinecraft().getTextureManager().bindTexture(BACKGROUND); - GlStateManager.color(1, 1, 1, 1); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - - Minecraft.getMinecraft().fontRendererObj.drawString("NEU Dungeon Map Editor", guiLeft+8, guiTop+6, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("Border Size", Minecraft.getMinecraft().fontRendererObj, - guiLeft+76, guiTop+30, false, 137, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Rooms Size", Minecraft.getMinecraft().fontRendererObj, - guiLeft+76, guiTop+60, false, 137, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Icon Scale", Minecraft.getMinecraft().fontRendererObj, - guiLeft+76, guiTop+90, false, 137, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Border Style", Minecraft.getMinecraft().fontRendererObj, - guiLeft+76, guiTop+120, false, 137, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("Dungeon Map", Minecraft.getMinecraft().fontRendererObj, - guiLeft+44+139, guiTop+30, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Center", Minecraft.getMinecraft().fontRendererObj, - guiLeft+108+139, guiTop+30, false, 60, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("Rotate", Minecraft.getMinecraft().fontRendererObj, - guiLeft+44+139, guiTop+59, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Icon Style", Minecraft.getMinecraft().fontRendererObj, - guiLeft+108+139, guiTop+59, false, 60, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("Check Orient", Minecraft.getMinecraft().fontRendererObj, - guiLeft+44+139, guiTop+88, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Check Center", Minecraft.getMinecraft().fontRendererObj, - guiLeft+108+139, guiTop+88, false, 60, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("Interpolation", Minecraft.getMinecraft().fontRendererObj, - guiLeft+44+139, guiTop+117, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Compatibility", Minecraft.getMinecraft().fontRendererObj, - guiLeft+108+139, guiTop+117, false, 60, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("Background", Minecraft.getMinecraft().fontRendererObj, - guiLeft+44+139, guiTop+146, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Border", Minecraft.getMinecraft().fontRendererObj, - guiLeft+108+139, guiTop+146, false, 60, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("BG Blur", Minecraft.getMinecraft().fontRendererObj, - guiLeft+44+139, guiTop+175, false, 60, 0xFFB4B4B4); - Utils.drawStringCenteredScaledMaxWidth("Chroma Type", Minecraft.getMinecraft().fontRendererObj, - guiLeft+108+139, guiTop+175, false, 60, 0xFFB4B4B4); - - Utils.drawStringCenteredScaledMaxWidth("Edit Map Position", Minecraft.getMinecraft().fontRendererObj, - guiLeft+76, guiTop+209, false, 200, 0xFFB4B4B4); - - try { - drawSlider(NEUConfig.DungeonMap.class.getDeclaredField("dmBorderSize"), guiLeft+76, guiTop+45); - drawSlider(NEUConfig.DungeonMap.class.getDeclaredField("dmRoomSize"), guiLeft+76, guiTop+75); - drawSlider(NEUConfig.DungeonMap.class.getDeclaredField("dmIconScale"), guiLeft+76, guiTop+105); - } catch(Exception e) { - e.printStackTrace(); - } - - NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap; - buttons.get(18-6).text = options.dmEnable ? "Enabled" : "Disabled"; - buttons.get(19-6).text = options.dmCenterPlayer ? "Player" : "Map"; - buttons.get(20-6).text = options.dmRotatePlayer ? "Player" : "Vertical"; - buttons.get(21-6).text = options.dmPlayerHeads <= 0 ? "Default" : options.dmPlayerHeads == 1 ? "Heads" : "Heads w/ Border"; - buttons.get(22-6).text = options.dmOrientCheck ? "Orient" : "Off"; - buttons.get(23-6).text = options.dmCenterCheck ? "Center" : "Off"; - buttons.get(24-6).text = options.dmPlayerInterp ? "Interp" : "No Interp"; - buttons.get(25-6).text = options.dmCompat <= 0 ? "Normal" : options.dmCompat >= 2 ? "No FB/SHD" : "No SHD"; - - buttons.get(26-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBackgroundColour)); - buttons.get(27-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBorderColour)); - - buttons.get(28-6).text = options.dmChromaBorder ? "Scroll" : "Normal"; - - blurField.setSize(48, 16); - blurField.render(guiLeft+20+139, guiTop+181); - - GlStateManager.color(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex); - RenderUtils.drawTexturedRect(guiLeft+52, guiTop+215, 48, 16); - TextRenderUtils.drawStringCenteredScaledMaxWidth("Edit", fontRendererObj, guiLeft+76, guiTop+223, - false, 48, 0xFF303030); - - Map<String, Vec4b> decorations = new HashMap<>(); - Vec4b vec4b = new Vec4b((byte)3, (byte)(((50)-64)*2), (byte)(((40)-64)*2), (byte)((60)*16/360)); - decorations.put(Minecraft.getMinecraft().thePlayer.getName(), vec4b); - - HashSet<String> players = new HashSet<>(); - players.add(Minecraft.getMinecraft().thePlayer.getName()); - GlStateManager.color(1, 1, 1, 1); - - demoMap.renderMap(guiLeft+357, guiTop+125, NotEnoughUpdates.INSTANCE.colourMap, decorations, 0, - players, false, partialTicks); - - for(Button button : buttons) { - button.render(); - } - - //List<String> textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, FontRenderer font - if(tooltipToDisplay != null) { - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, 200, Minecraft.getMinecraft().fontRendererObj); - } - - Utils.pushGuiScale(-1); - - if(activeColourEditor != null) { - activeColourEditor.render(); - } - } - - public void drawSlider(Field option, int centerX, int centerY) { - float value; - float minValue; - float maxValue; - try { - value = ((Number)option.get(NotEnoughUpdates.INSTANCE.config.dungeonMap)).floatValue(); - - ConfigEditorSlider sliderAnnotation = option.getAnnotation(ConfigEditorSlider.class); - minValue = sliderAnnotation.minValue(); - maxValue = sliderAnnotation.maxValue(); - } catch(Exception e) { - e.printStackTrace(); - return; - } - - float sliderAmount = Math.max(0, Math.min(1, (value-minValue)/(maxValue-minValue))); - int sliderAmountI = (int)(96*sliderAmount); - - GlStateManager.color(1f, 1f, 1f, 1f); - Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_large); - Utils.drawTexturedRect(centerX-48, centerY-8, sliderAmountI, 16, - 0, sliderAmount, 0, 1, GL11.GL_NEAREST); - - Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_large); - Utils.drawTexturedRect(centerX-48+sliderAmountI, centerY-8, 96-sliderAmountI, 16, - sliderAmount, 1, 0, 1, GL11.GL_NEAREST); - - Minecraft.getMinecraft().getTextureManager().bindTexture(slider_button); - Utils.drawTexturedRect(centerX-48+sliderAmountI-4, centerY-8, 8, 16, - 0, 1, 0, 1, GL11.GL_NEAREST); - } - - @Override - protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); - - if(clickedSlider != null) { - float minValue; - float maxValue; - try { - ConfigEditorSlider sliderAnnotation = clickedSlider.getAnnotation(ConfigEditorSlider.class); - minValue = sliderAnnotation.minValue(); - maxValue = sliderAnnotation.maxValue(); - } catch(Exception e) { - e.printStackTrace(); - return; - } - - float sliderAmount = (mouseX - (guiLeft+76-48))/96f; - double val = minValue+(maxValue-minValue)*sliderAmount; - if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - val = Math.round(val); - } - float value = (float)Math.max(minValue, Math.min(maxValue, val)); - try { - if(clickedSlider.getType() == int.class) { - clickedSlider.set(NotEnoughUpdates.INSTANCE.config.dungeonMap, Math.round(value)); - } else { - clickedSlider.set(NotEnoughUpdates.INSTANCE.config.dungeonMap, value); - } - } catch(Exception e) { - e.printStackTrace(); - } - } - - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { - for(Button button : buttons) { - if(mouseX >= guiLeft+button.x && mouseX <= guiLeft+button.x+48 && - mouseY >= guiTop+button.y && mouseY <= guiTop+button.y+16) { - buttonClicked(mouseX, mouseY, button.id); - - blurField.otherComponentClick(); - return; - } - } - - clickedSlider = null; - if(mouseX >= guiLeft+76-48 && mouseX <= guiLeft+76+48) { - try { - if(mouseY > guiTop+45-8 && mouseY < guiTop+45+8) { - clickedSlider = NEUConfig.DungeonMap.class.getDeclaredField("dmBorderSize"); - return; - } else if(mouseY > guiTop+75-8 && mouseY < guiTop+75+8) { - clickedSlider = NEUConfig.DungeonMap.class.getDeclaredField("dmRoomSize"); - return; - } else if(mouseY > guiTop+105-8 && mouseY < guiTop+105+8) { - clickedSlider = NEUConfig.DungeonMap.class.getDeclaredField("dmIconScale"); - return; - } - } catch(Exception e) { - e.printStackTrace(); - } - } - - if(mouseY > guiTop+181 && mouseY < guiTop+181+16) { - if(mouseX > guiLeft+20+139 && mouseX < guiLeft+20+139+48) { - blurField.mouseClicked(mouseX, mouseY, mouseButton); - return; - } - } else if(mouseY > guiTop+215 && mouseY < guiTop+215+16) { - if(mouseX > guiLeft+52 && mouseX < guiLeft+100) { - int size = 80 + Math.round(40*NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize); - - Map<String, Vec4b> decorations = new HashMap<>(); - Vec4b vec4b = new Vec4b((byte)3, (byte)(((50)-64)*2), (byte)(((40)-64)*2), (byte)((60)*16/360)); - decorations.put(Minecraft.getMinecraft().thePlayer.getName(), vec4b); - - HashSet<String> players = new HashSet<>(); - players.add(Minecraft.getMinecraft().thePlayer.getName()); - GlStateManager.color(1, 1, 1, 1); - - Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor( - NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition, - size, size, () -> { - ScaledResolution scaledResolution = Utils.pushGuiScale(2); - demoMap.renderMap(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsX(scaledResolution, size)+size/2, - NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsY(scaledResolution, size)+size/2, - NotEnoughUpdates.INSTANCE.colourMap, decorations, 0, - players, false, 0); - Utils.pushGuiScale(-1); - }, () -> { - }, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor() - ).withScale(2)); - return; - } - } - - blurField.otherComponentClick(); - } - - @Override - public void handleMouseInput() throws IOException { - super.handleMouseInput(); - - if(activeColourEditor != null) { - ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft()); - int mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth; - int mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1; - activeColourEditor.mouseInput(mouseX, mouseY); - } - } - - @Override - public void handleKeyboardInput() throws IOException { - super.handleKeyboardInput(); - - if(activeColourEditor != null) { - activeColourEditor.keyboardInput(); - } - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - - if(blurField.getFocus()) { - blurField.keyTyped(typedChar, keyCode); - - try { - blurField.setCustomBorderColour(-1); - NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur = Float.parseFloat(blurField.getText()); - } catch(Exception e) { - blurField.setCustomBorderColour(Color.RED.getRGB()); - } - } - } - - private void buttonClicked(int mouseX, int mouseY, int id) { - NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap; - switch (id) { - case 0: - options.dmBorderSize = 0; break; - case 1: - options.dmBorderSize = 1; break; - case 2: - options.dmBorderSize = 2; break; - case 30: - options.dmBorderSize = 3; break; - case 3: - options.dmRoomSize = 0; break; - case 4: - options.dmRoomSize = 1; break; - case 5: - options.dmRoomSize = 2; break; - case 29: - options.dmRoomSize = 3; break; - case 18: - options.dmEnable = !options.dmEnable; break; - case 19: - options.dmCenterPlayer = !options.dmCenterPlayer; break; - case 20: - options.dmRotatePlayer = !options.dmRotatePlayer; break; - case 21: - options.dmPlayerHeads++; - if(options.dmPlayerHeads > 2) options.dmPlayerHeads = 0; break; - case 22: - options.dmOrientCheck = !options.dmOrientCheck; break; - case 23: - options.dmCenterCheck = !options.dmCenterCheck; break; - case 24: - options.dmPlayerInterp = !options.dmPlayerInterp; break; - case 25: - options.dmCompat++; - if(options.dmCompat > 2) options.dmCompat = 0; - break; - case 26: { - ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft()); - mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth; - mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1; - activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBackgroundColour, - (col) -> options.dmBackgroundColour = col, () -> activeColourEditor = null); - } - break; - case 27: { - ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft()); - mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth; - mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1; - activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBorderColour, - (col) -> options.dmBorderColour = col, () -> activeColourEditor = null); - } - break; - case 28: - options.dmChromaBorder = !options.dmChromaBorder; break; - default: - if(id >= 6 && id <= 17) { - options.dmBorderStyle = id-6; break; - } - }; - } - - private boolean isButtonPressed(int id) { - NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap; - - if(id >= 0 && id <= 2) { - return options.dmBorderSize == id; - } else if(id >= 3 && id <= 5) { - return options.dmRoomSize == id-3; - } else if(id >= 6 && id <= 17) { - return options.dmBorderStyle == id-6; - } else if(id == 29) { - return options.dmRoomSize == 3; - } else if(id == 30) { - return options.dmBorderSize == 3; - } - return false; - } - - Shader blurShaderHorz = null; - Framebuffer blurOutputHorz = null; - Shader blurShaderVert = null; - Framebuffer blurOutputVert = null; - - /** - * Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate - * space [-1 -> 1; 1 -> -1] (Note: flipped y-axis). - * - * This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to - * apply scales and translations manually. - */ - private Matrix4f createProjectionMatrix(int width, int height) { - Matrix4f projMatrix = new Matrix4f(); - projMatrix.setIdentity(); - projMatrix.m00 = 2.0F / (float)width; - projMatrix.m11 = 2.0F / (float)(-height); - projMatrix.m22 = -0.0020001999F; - projMatrix.m33 = 1.0F; - projMatrix.m03 = -1.0F; - projMatrix.m13 = 1.0F; - projMatrix.m23 = -1.0001999F; - return projMatrix; - } - - private double lastBgBlurFactor = -1; - private void blurBackground() { - if(!OpenGlHelper.isFramebufferEnabled()) return; - - int width = Minecraft.getMinecraft().displayWidth; - int height = Minecraft.getMinecraft().displayHeight; - - if(blurOutputHorz == null) { - blurOutputHorz = new Framebuffer(width, height, false); - blurOutputHorz.setFramebufferFilter(GL11.GL_NEAREST); - } - if(blurOutputVert == null) { - blurOutputVert = new Framebuffer(width, height, false); - blurOutputVert.setFramebufferFilter(GL11.GL_NEAREST); - } - if(blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) { - blurOutputHorz.createBindFramebuffer(width, height); - blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height)); - Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); - } - if(blurOutputVert.framebufferWidth != width || blurOutputVert.framebufferHeight != height) { - blurOutputVert.createBindFramebuffer(width, height); - blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height)); - Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); - } - - if(blurShaderHorz == null) { - try { - blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", - Minecraft.getMinecraft().getFramebuffer(), blurOutputHorz); - blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0); - blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height)); - } catch(Exception e) { } - } - if(blurShaderVert == null) { - try { - blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", - blurOutputHorz, blurOutputVert); - blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1); - blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height)); - } catch(Exception e) { } - } - if(blurShaderHorz != null && blurShaderVert != null) { - if(15 != lastBgBlurFactor) { - blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)15); - blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)15); - lastBgBlurFactor = 15; - } - GL11.glPushMatrix(); - blurShaderHorz.loadShader(0); - blurShaderVert.loadShader(0); - GlStateManager.enableDepth(); - GL11.glPopMatrix(); - - Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); - } - } - - /** - * Renders a subsection of the blurred framebuffer on to the corresponding section of the screen. - * Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight] - */ - public void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) { - if(!OpenGlHelper.isFramebufferEnabled()) return; - - float uMin = x/(float)width; - float uMax = (x+blurWidth)/(float)width; - float vMin = (height-y)/(float)height; - float vMax = (height-y-blurHeight)/(float)height; - - blurOutputVert.bindFramebufferTexture(); - GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax); - blurOutputVert.unbindFramebufferTexture(); - } - -} +package io.github.moulberry.notenoughupdates.dungeons;
+
+import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import io.github.moulberry.notenoughupdates.options.NEUConfig;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.GuiElementColour;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.options.seperateSections.DungeonMapConfig;
+import io.github.moulberry.notenoughupdates.util.SpecialColour;
+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.client.renderer.OpenGlHelper;
+import net.minecraft.client.shader.Framebuffer;
+import net.minecraft.client.shader.Shader;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.Matrix4f;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.Vec4b;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.*;
+import java.util.List;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
+
+public class GuiDungeonMapEditor extends GuiScreen {
+
+ public static final ResourceLocation BACKGROUND = new ResourceLocation("notenoughupdates:dungeon_map/editor/background.png");
+ public static final ResourceLocation BUTTON = new ResourceLocation("notenoughupdates:button.png");
+ private static final DungeonMap demoMap = new DungeonMap();
+
+ private int sizeX;
+ private int sizeY;
+ private int guiLeft;
+ private int guiTop;
+
+ private List<Button> buttons = new ArrayList<>();
+
+ private GuiElementTextField blurField = new GuiElementTextField("", GuiElementTextField.NUM_ONLY | GuiElementTextField.NO_SPACE);
+ private GuiElementColour activeColourEditor = null;
+
+ private Field clickedSlider;
+
+ class Button {
+ private int id;
+ private int x;
+ private int y;
+ private String text;
+ private Color colour = new Color(-1, true);
+ private Field option;
+ private String displayName;
+ private String desc;
+
+ public Button(int id, int x, int y, String text) {
+ this(id, x, y, text, null);
+ }
+
+ public Button(int id, int x, int y, String text, Field option) {
+ this.id = id;
+ this.x = x;
+ this.y = y;
+ this.text = text;
+ this.option = option;
+
+ if(option != null) {
+ ConfigOption optionAnnotation = option.getAnnotation(ConfigOption.class);
+ displayName = optionAnnotation.name();
+ desc = optionAnnotation.desc();
+ }
+ }
+
+ public List<String> getTooltip() {
+ if(option == null) {
+ return null;
+ }
+
+ List<String> tooltip = new ArrayList<>();
+ tooltip.add(EnumChatFormatting.YELLOW+displayName);
+ for(String line : desc.split("\n")) {
+ tooltip.add(EnumChatFormatting.AQUA+line);
+ }
+ return tooltip;
+ }
+
+ public void render() {
+ if(text == null) return;
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(BUTTON);
+ if(isButtonPressed(id)) {
+ GlStateManager.color(colour.getRed()*0.85f/255f, colour.getGreen()*0.85f/255f,
+ colour.getBlue()*0.85f/255f, 1);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y, 48, 16, 1, 0, 1, 0, GL11.GL_NEAREST);
+ } else {
+ GlStateManager.color(colour.getRed()/255f, colour.getGreen()/255f, colour.getBlue()/255f, 1);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y, 48, 16, GL11.GL_NEAREST);
+ }
+
+ if(text.length() > 0) {
+ Utils.drawStringCenteredScaledMaxWidth(text, Minecraft.getMinecraft().fontRendererObj , guiLeft+x+24, guiTop+y+8, false, 39, 0xFF000000);
+ }
+ }
+
+ }
+
+ public GuiDungeonMapEditor() {
+ DungeonMapConfig options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
+ //Map Border Size
+ //buttons.add(new Button(0, 6, 37, "Small", options.dmBorderSize));
+ //buttons.add(new Button(1, 52, 37, "Medium", options.dmBorderSize));
+ //buttons.add(new Button(2, 98, 37, "Large", options.dmBorderSize));
+
+ //Map Rooms Size
+ //buttons.add(new Button(3, 6, 67+19, "Small", options.dmRoomSize));
+ //buttons.add(new Button(4, 52, 67+19, "Medium", options.dmRoomSize));
+ //buttons.add(new Button(5, 98, 67+19, "Large", options.dmRoomSize));
+
+ //Map Border Styles
+ buttons.add(new Button(6, 6, 97+30, "None"));
+ buttons.add(new Button(7, 52, 97+30, "Custom"));
+ buttons.add(new Button(8, 98, 97+30, "Stone"));
+ buttons.add(new Button(9, 6, 116+30, "Wood"));
+ buttons.add(new Button(10, 52, 116+30, "Rustic(S)"));
+ buttons.add(new Button(11, 98, 116+30, "Rustic(C)"));
+ buttons.add(new Button(12, 6, 135+30, "Fade"));
+ buttons.add(new Button(13, 52, 135+30, "Ribbons"));
+ buttons.add(new Button(14, 98, 135+30, "Paper"));
+ buttons.add(new Button(15, 6, 154+30, "Crimson"));
+ buttons.add(new Button(16, 52, 154+30, "Ornate"));
+ buttons.add(new Button(17, 98, 154+30, "Dragon"));
+
+ try {
+ //Dungeon Map
+ buttons.add(new Button(18, 20+139, 36, "Yes/No", DungeonMapConfig.class.getDeclaredField("dmEnable")));
+ //Center
+ buttons.add(new Button(19, 84+139, 36, "Player/Map", DungeonMapConfig.class.getDeclaredField("dmCenterPlayer")));
+ //Rotate
+ buttons.add(new Button(20, 20+139, 65, "Player/No Rotate", DungeonMapConfig.class.getDeclaredField("dmRotatePlayer")));
+ //Icon Style
+ buttons.add(new Button(21, 84+139, 65, "Default/Heads", DungeonMapConfig.class.getDeclaredField("dmPlayerHeads")));
+ //Check Orient
+ buttons.add(new Button(22, 20+139, 94, "Normal/Reorient", DungeonMapConfig.class.getDeclaredField("dmOrientCheck")));
+ //Check Center
+ buttons.add(new Button(23, 84+139, 94, "Yes/No", DungeonMapConfig.class.getDeclaredField("dmCenterCheck")));
+ //Interpolation
+ buttons.add(new Button(24, 20+139, 123, "Yes/No", DungeonMapConfig.class.getDeclaredField("dmPlayerInterp")));
+ //Compatibility
+ buttons.add(new Button(25, 84+139, 123, "Normal/No SHD/No FB/SHD", DungeonMapConfig.class.getDeclaredField("dmCompat")));
+
+ //Background
+ buttons.add(new Button(26, 20+139, 152, "", DungeonMapConfig.class.getDeclaredField("dmBackgroundColour")));
+ //Border
+ buttons.add(new Button(27, 84+139, 152, "", DungeonMapConfig.class.getDeclaredField("dmBorderColour")));
+
+ //Chroma Mode
+ buttons.add(new Button(28, 84+139, 181, "Normal/Scroll", DungeonMapConfig.class.getDeclaredField("dmChromaBorder")));
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ //buttons.add(new Button(29, 52, 86+19, "XLarge", options.dmRoomSize));
+ //buttons.add(new Button(30, 52, 56, "XLarge", options.dmBorderSize));
+
+ {
+ double val = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur;
+ String strVal;
+ if(val % 1 == 0) {
+ strVal = Integer.toString((int)val);
+ } else {
+ strVal = Double.toString(val);
+ strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
+ strVal = strVal.replaceAll("0+$", "");
+ }
+ blurField.setText(strVal);
+ }
+ }
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ ScaledResolution scaledResolution = Utils.pushGuiScale(2);
+ this.width = scaledResolution.getScaledWidth();
+ this.height = scaledResolution.getScaledHeight();
+
+ mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
+ mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
+
+ List<String> tooltipToDisplay = null;
+ for(Button button : buttons) {
+ if(mouseX >= guiLeft+button.x && mouseX <= guiLeft+button.x+48 &&
+ mouseY >= guiTop+button.y-13 && mouseY <= guiTop+button.y+16) {
+ if(button.id >= 6 && button.id <= 17) {
+ String mapDesc = null;
+ String mapCredit = null;
+ int id = button.id;
+ switch(id) {
+ case 6:
+ mapDesc = "No Border"; break;
+ case 7:
+ mapDesc = "Used by custom Resource Packs"; break;
+ case 8:
+ mapDesc = "Simple gray border"; mapCredit = "TomEngMaster"; break;
+ case 9:
+ mapDesc = "Viney wood border"; mapCredit = "iDevil4Hell"; break;
+ case 10:
+ mapDesc = "Steampunk-inspired square border"; mapCredit = "ThatGravyBoat"; break;
+ case 11:
+ mapDesc = "Steampunk-inspired circular border"; mapCredit = "ThatGravyBoat"; break;
+ case 12:
+ mapDesc = "Light fade border"; mapCredit = "Qwiken"; break;
+ case 13:
+ mapDesc = "Simple gray border with red ribbons"; mapCredit = "Sai"; break;
+ case 14:
+ mapDesc = "Paper border"; mapCredit = "KingJames02st"; break;
+ case 15:
+ mapDesc = "Nether-inspired border"; mapCredit = "DTRW191"; break;
+ case 16:
+ mapDesc = "Golden ornate border"; mapCredit = "iDevil4Hell"; break;
+ case 17:
+ mapDesc = "Stone dragon border"; mapCredit = "ImperiaL"; break;
+ }
+
+ ArrayList<String> tooltip = new ArrayList<>();
+ tooltip.add(EnumChatFormatting.YELLOW+"Border Style");
+ tooltip.add(EnumChatFormatting.AQUA+"Customize the look of the dungeon border");
+ tooltip.add("");
+ if(mapDesc != null) tooltip.add(EnumChatFormatting.YELLOW+"Set to: "+EnumChatFormatting.AQUA+mapDesc);
+ if(mapCredit != null) tooltip.add(EnumChatFormatting.YELLOW+"Artist: "+EnumChatFormatting.GOLD+mapCredit);
+ tooltipToDisplay = tooltip;
+ } else {
+ tooltipToDisplay = button.getTooltip();
+ }
+ break;
+ }
+ }
+
+ this.sizeX = 431;
+ this.sizeY = 237;
+ this.guiLeft = (this.width - this.sizeX) / 2;
+ this.guiTop = (this.height-this.sizeY)/2;
+
+ super.drawScreen(mouseX, mouseY, partialTicks);
+ drawDefaultBackground();
+
+ blurBackground();
+ renderBlurredBackground(width, height, guiLeft+2, guiTop+2, sizeX-4, sizeY-4);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(BACKGROUND);
+ GlStateManager.color(1, 1, 1, 1);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().fontRendererObj.drawString("NEU Dungeon Map Editor", guiLeft+8, guiTop+6, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("Border Size", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+76, guiTop+30, false, 137, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Rooms Size", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+76, guiTop+60, false, 137, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Icon Scale", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+76, guiTop+90, false, 137, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Border Style", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+76, guiTop+120, false, 137, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("Dungeon Map", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+44+139, guiTop+30, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Center", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+108+139, guiTop+30, false, 60, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("Rotate", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+44+139, guiTop+59, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Icon Style", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+108+139, guiTop+59, false, 60, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("Check Orient", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+44+139, guiTop+88, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Check Center", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+108+139, guiTop+88, false, 60, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("Interpolation", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+44+139, guiTop+117, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Compatibility", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+108+139, guiTop+117, false, 60, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("Background", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+44+139, guiTop+146, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Border", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+108+139, guiTop+146, false, 60, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("BG Blur", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+44+139, guiTop+175, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Chroma Type", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+108+139, guiTop+175, false, 60, 0xFFB4B4B4);
+
+ Utils.drawStringCenteredScaledMaxWidth("Edit Map Position", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+76, guiTop+209, false, 200, 0xFFB4B4B4);
+
+ try {
+ drawSlider(DungeonMapConfig.class.getDeclaredField("dmBorderSize"), guiLeft+76, guiTop+45);
+ drawSlider(DungeonMapConfig.class.getDeclaredField("dmRoomSize"), guiLeft+76, guiTop+75);
+ drawSlider(DungeonMapConfig.class.getDeclaredField("dmIconScale"), guiLeft+76, guiTop+105);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ DungeonMapConfig options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
+ buttons.get(18-6).text = options.dmEnable ? "Enabled" : "Disabled";
+ buttons.get(19-6).text = options.dmCenterPlayer ? "Player" : "Map";
+ buttons.get(20-6).text = options.dmRotatePlayer ? "Player" : "Vertical";
+ buttons.get(21-6).text = options.dmPlayerHeads <= 0 ? "Default" : options.dmPlayerHeads == 1 ? "Heads" : "Heads w/ Border";
+ buttons.get(22-6).text = options.dmOrientCheck ? "Orient" : "Off";
+ buttons.get(23-6).text = options.dmCenterCheck ? "Center" : "Off";
+ buttons.get(24-6).text = options.dmPlayerInterp ? "Interp" : "No Interp";
+ buttons.get(25-6).text = options.dmCompat <= 0 ? "Normal" : options.dmCompat >= 2 ? "No FB/SHD" : "No SHD";
+
+ buttons.get(26-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBackgroundColour));
+ buttons.get(27-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBorderColour));
+
+ buttons.get(28-6).text = options.dmChromaBorder ? "Scroll" : "Normal";
+
+ blurField.setSize(48, 16);
+ blurField.render(guiLeft+20+139, guiTop+181);
+
+ GlStateManager.color(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex);
+ RenderUtils.drawTexturedRect(guiLeft+52, guiTop+215, 48, 16);
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Edit", fontRendererObj, guiLeft+76, guiTop+223,
+ false, 48, 0xFF303030);
+
+ Map<String, Vec4b> decorations = new HashMap<>();
+ Vec4b vec4b = new Vec4b((byte)3, (byte)(((50)-64)*2), (byte)(((40)-64)*2), (byte)((60)*16/360));
+ decorations.put(Minecraft.getMinecraft().thePlayer.getName(), vec4b);
+
+ HashSet<String> players = new HashSet<>();
+ players.add(Minecraft.getMinecraft().thePlayer.getName());
+ GlStateManager.color(1, 1, 1, 1);
+
+ demoMap.renderMap(guiLeft+357, guiTop+125, NotEnoughUpdates.INSTANCE.colourMap, decorations, 0,
+ players, false, partialTicks);
+
+ for(Button button : buttons) {
+ button.render();
+ }
+
+ //List<String> textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, FontRenderer font
+ if(tooltipToDisplay != null) {
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, 200, Minecraft.getMinecraft().fontRendererObj);
+ }
+
+ Utils.pushGuiScale(-1);
+
+ if(activeColourEditor != null) {
+ activeColourEditor.render();
+ }
+ }
+
+ public void drawSlider(Field option, int centerX, int centerY) {
+ float value;
+ float minValue;
+ float maxValue;
+ try {
+ value = ((Number)option.get(NotEnoughUpdates.INSTANCE.config.dungeonMap)).floatValue();
+
+ ConfigEditorSlider sliderAnnotation = option.getAnnotation(ConfigEditorSlider.class);
+ minValue = sliderAnnotation.minValue();
+ maxValue = sliderAnnotation.maxValue();
+ } catch(Exception e) {
+ e.printStackTrace();
+ return;
+ }
+
+ float sliderAmount = Math.max(0, Math.min(1, (value-minValue)/(maxValue-minValue)));
+ int sliderAmountI = (int)(96*sliderAmount);
+
+ GlStateManager.color(1f, 1f, 1f, 1f);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_large);
+ Utils.drawTexturedRect(centerX-48, centerY-8, sliderAmountI, 16,
+ 0, sliderAmount, 0, 1, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_large);
+ Utils.drawTexturedRect(centerX-48+sliderAmountI, centerY-8, 96-sliderAmountI, 16,
+ sliderAmount, 1, 0, 1, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_button);
+ Utils.drawTexturedRect(centerX-48+sliderAmountI-4, centerY-8, 8, 16,
+ 0, 1, 0, 1, GL11.GL_NEAREST);
+ }
+
+ @Override
+ protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
+ super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
+
+ if(clickedSlider != null) {
+ float minValue;
+ float maxValue;
+ try {
+ ConfigEditorSlider sliderAnnotation = clickedSlider.getAnnotation(ConfigEditorSlider.class);
+ minValue = sliderAnnotation.minValue();
+ maxValue = sliderAnnotation.maxValue();
+ } catch(Exception e) {
+ e.printStackTrace();
+ return;
+ }
+
+ float sliderAmount = (mouseX - (guiLeft+76-48))/96f;
+ double val = minValue+(maxValue-minValue)*sliderAmount;
+ if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ val = Math.round(val);
+ }
+ float value = (float)Math.max(minValue, Math.min(maxValue, val));
+ try {
+ if(clickedSlider.getType() == int.class) {
+ clickedSlider.set(NotEnoughUpdates.INSTANCE.config.dungeonMap, Math.round(value));
+ } else {
+ clickedSlider.set(NotEnoughUpdates.INSTANCE.config.dungeonMap, value);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ @Override
+ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
+ for(Button button : buttons) {
+ if(mouseX >= guiLeft+button.x && mouseX <= guiLeft+button.x+48 &&
+ mouseY >= guiTop+button.y && mouseY <= guiTop+button.y+16) {
+ buttonClicked(mouseX, mouseY, button.id);
+
+ blurField.otherComponentClick();
+ return;
+ }
+ }
+
+ clickedSlider = null;
+ if(mouseX >= guiLeft+76-48 && mouseX <= guiLeft+76+48) {
+ try {
+ if(mouseY > guiTop+45-8 && mouseY < guiTop+45+8) {
+ clickedSlider = DungeonMapConfig.class.getDeclaredField("dmBorderSize");
+ return;
+ } else if(mouseY > guiTop+75-8 && mouseY < guiTop+75+8) {
+ clickedSlider = DungeonMapConfig.class.getDeclaredField("dmRoomSize");
+ return;
+ } else if(mouseY > guiTop+105-8 && mouseY < guiTop+105+8) {
+ clickedSlider = DungeonMapConfig.class.getDeclaredField("dmIconScale");
+ return;
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ if(mouseY > guiTop+181 && mouseY < guiTop+181+16) {
+ if(mouseX > guiLeft+20+139 && mouseX < guiLeft+20+139+48) {
+ blurField.mouseClicked(mouseX, mouseY, mouseButton);
+ return;
+ }
+ } else if(mouseY > guiTop+215 && mouseY < guiTop+215+16) {
+ if(mouseX > guiLeft+52 && mouseX < guiLeft+100) {
+ int size = 80 + Math.round(40*NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize);
+
+ Map<String, Vec4b> decorations = new HashMap<>();
+ Vec4b vec4b = new Vec4b((byte)3, (byte)(((50)-64)*2), (byte)(((40)-64)*2), (byte)((60)*16/360));
+ decorations.put(Minecraft.getMinecraft().thePlayer.getName(), vec4b);
+
+ HashSet<String> players = new HashSet<>();
+ players.add(Minecraft.getMinecraft().thePlayer.getName());
+ GlStateManager.color(1, 1, 1, 1);
+
+ Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition,
+ size, size, () -> {
+ ScaledResolution scaledResolution = Utils.pushGuiScale(2);
+ demoMap.renderMap(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsX(scaledResolution, size)+size/2,
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPosition.getAbsY(scaledResolution, size)+size/2,
+ NotEnoughUpdates.INSTANCE.colourMap, decorations, 0,
+ players, false, 0);
+ Utils.pushGuiScale(-1);
+ }, () -> {
+ }, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor()
+ ).withScale(2));
+ return;
+ }
+ }
+
+ blurField.otherComponentClick();
+ }
+
+ @Override
+ public void handleMouseInput() throws IOException {
+ super.handleMouseInput();
+
+ if(activeColourEditor != null) {
+ ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft());
+ int mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth;
+ int mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1;
+ activeColourEditor.mouseInput(mouseX, mouseY);
+ }
+ }
+
+ @Override
+ public void handleKeyboardInput() throws IOException {
+ super.handleKeyboardInput();
+
+ if(activeColourEditor != null) {
+ activeColourEditor.keyboardInput();
+ }
+ }
+
+ @Override
+ protected void keyTyped(char typedChar, int keyCode) throws IOException {
+ super.keyTyped(typedChar, keyCode);
+
+ if(blurField.getFocus()) {
+ blurField.keyTyped(typedChar, keyCode);
+
+ try {
+ blurField.setCustomBorderColour(-1);
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur = Float.parseFloat(blurField.getText());
+ } catch(Exception e) {
+ blurField.setCustomBorderColour(Color.RED.getRGB());
+ }
+ }
+ }
+
+ private void buttonClicked(int mouseX, int mouseY, int id) {
+ DungeonMapConfig options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
+ switch (id) {
+ case 0:
+ options.dmBorderSize = 0; break;
+ case 1:
+ options.dmBorderSize = 1; break;
+ case 2:
+ options.dmBorderSize = 2; break;
+ case 30:
+ options.dmBorderSize = 3; break;
+ case 3:
+ options.dmRoomSize = 0; break;
+ case 4:
+ options.dmRoomSize = 1; break;
+ case 5:
+ options.dmRoomSize = 2; break;
+ case 29:
+ options.dmRoomSize = 3; break;
+ case 18:
+ options.dmEnable = !options.dmEnable; break;
+ case 19:
+ options.dmCenterPlayer = !options.dmCenterPlayer; break;
+ case 20:
+ options.dmRotatePlayer = !options.dmRotatePlayer; break;
+ case 21:
+ options.dmPlayerHeads++;
+ if(options.dmPlayerHeads > 2) options.dmPlayerHeads = 0; break;
+ case 22:
+ options.dmOrientCheck = !options.dmOrientCheck; break;
+ case 23:
+ options.dmCenterCheck = !options.dmCenterCheck; break;
+ case 24:
+ options.dmPlayerInterp = !options.dmPlayerInterp; break;
+ case 25:
+ options.dmCompat++;
+ if(options.dmCompat > 2) options.dmCompat = 0;
+ break;
+ case 26: {
+ ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft());
+ mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth;
+ mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1;
+ activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBackgroundColour,
+ (col) -> options.dmBackgroundColour = col, () -> activeColourEditor = null);
+ }
+ break;
+ case 27: {
+ ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft());
+ mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth;
+ mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1;
+ activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBorderColour,
+ (col) -> options.dmBorderColour = col, () -> activeColourEditor = null);
+ }
+ break;
+ case 28:
+ options.dmChromaBorder = !options.dmChromaBorder; break;
+ default:
+ if(id >= 6 && id <= 17) {
+ options.dmBorderStyle = id-6; break;
+ }
+ };
+ }
+
+ private boolean isButtonPressed(int id) {
+ DungeonMapConfig options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
+
+ if(id >= 0 && id <= 2) {
+ return options.dmBorderSize == id;
+ } else if(id >= 3 && id <= 5) {
+ return options.dmRoomSize == id-3;
+ } else if(id >= 6 && id <= 17) {
+ return options.dmBorderStyle == id-6;
+ } else if(id == 29) {
+ return options.dmRoomSize == 3;
+ } else if(id == 30) {
+ return options.dmBorderSize == 3;
+ }
+ return false;
+ }
+
+ Shader blurShaderHorz = null;
+ Framebuffer blurOutputHorz = null;
+ Shader blurShaderVert = null;
+ Framebuffer blurOutputVert = null;
+
+ /**
+ * Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate
+ * space [-1 -> 1; 1 -> -1] (Note: flipped y-axis).
+ *
+ * This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to
+ * apply scales and translations manually.
+ */
+ private Matrix4f createProjectionMatrix(int width, int height) {
+ Matrix4f projMatrix = new Matrix4f();
+ projMatrix.setIdentity();
+ projMatrix.m00 = 2.0F / (float)width;
+ projMatrix.m11 = 2.0F / (float)(-height);
+ projMatrix.m22 = -0.0020001999F;
+ projMatrix.m33 = 1.0F;
+ projMatrix.m03 = -1.0F;
+ projMatrix.m13 = 1.0F;
+ projMatrix.m23 = -1.0001999F;
+ return projMatrix;
+ }
+
+ private double lastBgBlurFactor = -1;
+ private void blurBackground() {
+ if(!OpenGlHelper.isFramebufferEnabled()) return;
+
+ int width = Minecraft.getMinecraft().displayWidth;
+ int height = Minecraft.getMinecraft().displayHeight;
+
+ if(blurOutputHorz == null) {
+ blurOutputHorz = new Framebuffer(width, height, false);
+ blurOutputHorz.setFramebufferFilter(GL11.GL_NEAREST);
+ }
+ if(blurOutputVert == null) {
+ blurOutputVert = new Framebuffer(width, height, false);
+ blurOutputVert.setFramebufferFilter(GL11.GL_NEAREST);
+ }
+ if(blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) {
+ blurOutputHorz.createBindFramebuffer(width, height);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+ if(blurOutputVert.framebufferWidth != width || blurOutputVert.framebufferHeight != height) {
+ blurOutputVert.createBindFramebuffer(width, height);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+
+ if(blurShaderHorz == null) {
+ try {
+ blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ Minecraft.getMinecraft().getFramebuffer(), blurOutputHorz);
+ blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
+ }
+ if(blurShaderVert == null) {
+ try {
+ blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ blurOutputHorz, blurOutputVert);
+ blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
+ }
+ if(blurShaderHorz != null && blurShaderVert != null) {
+ if(15 != lastBgBlurFactor) {
+ blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)15);
+ blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)15);
+ lastBgBlurFactor = 15;
+ }
+ GL11.glPushMatrix();
+ blurShaderHorz.loadShader(0);
+ blurShaderVert.loadShader(0);
+ GlStateManager.enableDepth();
+ GL11.glPopMatrix();
+
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+ }
+
+ /**
+ * Renders a subsection of the blurred framebuffer on to the corresponding section of the screen.
+ * Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight]
+ */
+ public void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) {
+ if(!OpenGlHelper.isFramebufferEnabled()) return;
+
+ float uMin = x/(float)width;
+ float uMax = (x+blurWidth)/(float)width;
+ float vMin = (height-y)/(float)height;
+ float vMax = (height-y-blurHeight)/(float)height;
+
+ blurOutputVert.bindFramebufferTexture();
+ GlStateManager.color(1f, 1f, 1f, 1f);
+ Utils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax);
+ blurOutputVert.unbindFramebufferTexture();
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index e49644bf..ba96777f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -151,7 +151,7 @@ public class CustomItemEffects { if(NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillis <= 0 || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) return; - boolean aote = NotEnoughUpdates.INSTANCE.config.itemOverlays.enableSmoothAOTE && internal.equals("ASPECT_OF_THE_END"); + boolean aote = NotEnoughUpdates.INSTANCE.config.itemOverlays.enableSmoothAOTE && (internal.equals("ASPECT_OF_THE_END") || internal.equals("ASPECT_OF_THE_VOID")); boolean hyp = NotEnoughUpdates.INSTANCE.config.itemOverlays.enableSmoothHyperion && shadowWarp; if(aote || hyp) { aoteUseMillis = System.currentTimeMillis(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java index 01d81460..0a5de509 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java @@ -3,13 +3,10 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -96,7 +93,7 @@ public class EnchantingSolvers { } public static ItemStack overrideStack(IInventory inventory, int slotIndex, ItemStack stack) { - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return null; } @@ -199,7 +196,7 @@ public class EnchantingSolvers { } public static boolean onStackRender(ItemStack stack, IInventory inventory, int slotIndex, int x, int y) { - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return false; } @@ -231,14 +228,14 @@ public class EnchantingSolvers { if(item.containerIndex == slotIndex) { int meta = 0; if(solveIndex == ultrasequencerReplayIndex) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqNext; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.seqNext; } else if(solveIndex == ultrasequencerReplayIndex+1) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqUpcoming; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.seqUpcoming; } if(meta > 0) { Utils.drawItemStack(new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, meta-1), x, y); } - if(NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqNumbers && + if(NotEnoughUpdates.INSTANCE.config.enchanting.seqNumbers && solveIndex >= ultrasequencerReplayIndex) { int w = Minecraft.getMinecraft().fontRendererObj.getStringWidth((solveIndex+1)+""); GlStateManager.disableDepth(); @@ -257,15 +254,15 @@ public class EnchantingSolvers { if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass) && superpairStacks.containsKey(slotIndex)) { if(possibleMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPossible; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supPossible; } else { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supUnmatched; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supUnmatched; } } else { if(powerupMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPower; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supPower; } else if(successfulMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supMatched; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supMatched; } } if(meta > 0) { @@ -278,7 +275,7 @@ public class EnchantingSolvers { } public static boolean onStackClick(ItemStack stack, int windowId, int slotId, int mouseButtonClicked, int mode) { - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return false; } @@ -371,7 +368,7 @@ public class EnchantingSolvers { public static void processInventoryContents(boolean fromTick) { if(currentSolver != SolverType.CHRONOMATRON && !fromTick) return; - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return; } @@ -533,7 +530,7 @@ public class EnchantingSolvers { @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { - if(NotEnoughUpdates.INSTANCE.config.enchantingSolvers.hideTooltips && + if(NotEnoughUpdates.INSTANCE.config.enchanting.hideTooltips && (currentSolver == SolverType.CHRONOMATRON || currentSolver == SolverType.ULTRASEQUENCER)) { String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); if(internal == null && event.toolTip.size() > 0 && !event.toolTip.get(0).trim().replaceAll("\\(#.+\\)$", "").trim().contains(" ")) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java index 32c64f4c..3bf75a0f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java @@ -272,6 +272,7 @@ public class FishingHelper { } public boolean onSpawnParticle(EnumParticleTypes particleType, double x, double y, double z, double xOffset, double yOffset, double zOffset) { + if(!NotEnoughUpdates.INSTANCE.config.fishing.hideOtherPlayerAll && !NotEnoughUpdates.INSTANCE.config.fishing.enableCustomParticles && !NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning && @@ -282,10 +283,12 @@ public class FishingHelper { return false; } - if(particleType == EnumParticleTypes.WATER_WAKE && Math.abs(yOffset - 0.01f) < 0.001f) { + + if((particleType == EnumParticleTypes.WATER_WAKE|| particleType == EnumParticleTypes.SMOKE_NORMAL) && Math.abs(yOffset - 0.01f) < 0.001f) { double angle1 = calculateAngleFromOffsets(xOffset, -zOffset); double angle2 = calculateAngleFromOffsets(-xOffset, zOffset); + final List<Integer> possibleHooks1 = new ArrayList<>(); final List<Integer> possibleHooks2 = new ArrayList<>(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java index 6f706b5c..cfd97d3f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java @@ -6,6 +6,7 @@ import io.github.moulberry.notenoughupdates.overlays.MiningOverlay; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.block.BlockAir; import net.minecraft.block.BlockStone; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -23,10 +24,18 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.Map; + public class MiningStuff { private static BlockPos overlayLoc = null; private static long titaniumNotifMillis = 0; + private static Minecraft mc; + + + public MiningStuff(){ + mc = Minecraft.getMinecraft(); + } public static void processBlockChangePacket(S23PacketBlockChange packetIn) { if(!NotEnoughUpdates.INSTANCE.config.mining.titaniumAlert) { @@ -38,14 +47,19 @@ public class MiningStuff { SBInfo.getInstance().getLocation().startsWith("mining_") && state.getBlock() == Blocks.stone && state.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) { - for(String s : MiningOverlay.commissionProgress.keySet()) { + + for(Map.Entry<String, Float> entry : MiningOverlay.commissionProgress.entrySet()) { + String s = entry.getKey(); if(s.contains("Titanium")) { + if(entry.getValue() == 1f){ + return; + } BlockPos pos = packetIn.getBlockPosition(); IBlockState existingBlock = Minecraft.getMinecraft().theWorld.getBlockState(pos); if(existingBlock == null) return; if(existingBlock.getBlock() == Blocks.stone && existingBlock.getValue(BlockStone.VARIANT) == BlockStone.EnumType.DIORITE_SMOOTH) return; - + if(!checkIfAnyIsAir(getAttachedBlocks(pos)) && NotEnoughUpdates.INSTANCE.config.mining.titaniumAlertMustBeVisible) return; BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); double distSq = pos.distanceSq(player); @@ -59,6 +73,26 @@ public class MiningStuff { } } + private static BlockPos[] getAttachedBlocks(BlockPos block){ + BlockPos[] blocks = new BlockPos[6]; + blocks[0] = new BlockPos(block.getX()-1, block.getY(), block.getZ()); + blocks[1] = new BlockPos(block.getX()+1, block.getY(), block.getZ()); + blocks[2] = new BlockPos(block.getX(), block.getY()-1, block.getZ()); + blocks[3] = new BlockPos(block.getX(), block.getY()+1, block.getZ()); + blocks[4] = new BlockPos(block.getX(), block.getY(), block.getZ()-1); + blocks[5] = new BlockPos(block.getX(), block.getY(), block.getZ()+1); + return blocks; + } + + private static boolean checkIfAnyIsAir(BlockPos[] blocks){ + for (BlockPos block : blocks) { + if(mc.theWorld.getBlockState(block).getBlock() instanceof BlockAir){ + return true; + } + } + return false; + } + @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent.Post event) { if(!NotEnoughUpdates.INSTANCE.config.mining.titaniumAlert) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 62a3a5d1..7769c274 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -752,7 +752,7 @@ public class PetInfoOverlay extends TextOverlay { break; } } - if(!foundDespawn && config.selectedPet == petIndex) { + if(foundDespawn && config.selectedPet == petIndex) { clearPet(); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index 6d0873ed..3ad83f1a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -331,7 +331,7 @@ public class AccessoryBagOverlay { List<String> missingInternal = new ArrayList<>(); for(Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager.getItemInformation().entrySet()) { if(entry.getValue().has("lore")) { - if(checkItemType(entry.getValue().get("lore").getAsJsonArray(), "ACCESSORY", "HATCCESSORY") >= 0) { + if(checkItemType(entry.getValue().get("lore").getAsJsonArray(), "ACCESSORY", "HATCCESSORY", "DUNGEON ACCESSORY") >= 0) { missingInternal.add(entry.getKey()); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 2707c7ab..3cc42d7d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -38,7 +38,6 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.Project; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.io.PrintStream; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -200,7 +199,7 @@ public class GuiCustomEnchant extends Gui { } public boolean shouldOverride(String containerName) { - shouldOverrideFast = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableTableGUI && + shouldOverrideFast = NotEnoughUpdates.INSTANCE.config.enchanting.enableTableGUI && containerName != null && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && containerName.equalsIgnoreCase("Enchant Item"); @@ -467,8 +466,8 @@ public class GuiCustomEnchant extends Gui { } } NEUConfig cfg = NotEnoughUpdates.INSTANCE.config; - int mult = cfg.enchantingSolvers.enchantOrdering == 0 ? 1 : -1; - Comparator<Enchantment> comparator = cfg.enchantingSolvers.enchantSorting == 0 ? + int mult = cfg.enchanting.enchantOrdering == 0 ? 1 : -1; + Comparator<Enchantment> comparator = cfg.enchanting.enchantSorting == 0 ? Comparator.comparingInt(e -> mult*e.xpCost) : (c1, c2) -> mult*c1.enchId.toLowerCase().compareTo(c2.enchId.toLowerCase()); removable.sort(comparator); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 58d6f119..e525117c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -40,6 +40,7 @@ import org.lwjgl.util.vector.Vector4f; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.awt.*; +import java.awt.event.KeyEvent; import java.util.*; import java.util.List; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 484a12a0..5b0e0128 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -11,16 +11,14 @@ import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor; import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour; import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor; import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements; +import io.github.moulberry.notenoughupdates.options.seperateSections.*; import io.github.moulberry.notenoughupdates.overlays.*; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; -import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.ClientCommandHandler; -import org.lwjgl.input.Keyboard; import org.lwjgl.util.vector.Vector2f; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -153,10 +151,10 @@ public class NEUConfig extends Config { public SkillOverlays skillOverlays = new SkillOverlays(); @Expose - /*@Category( + @Category( name = "Misc Overlays", desc = "Misc Overlays" - )*/ + ) public MiscOverlays miscOverlays = new MiscOverlays(); @Expose @@ -179,7 +177,7 @@ public class NEUConfig extends Config { name = "Enchanting GUI/Solvers", desc = "Enchanting GUI/Solvers" ) - public EnchSolvers enchantingSolvers = new EnchSolvers(); + public Enchanting enchanting = new Enchanting(); @Expose @Category( @@ -256,1989 +254,36 @@ public class NEUConfig extends Config { public Hidden hidden = new Hidden(); @Expose - public DungeonMap dungeonMap = new DungeonMap(); - - public static class Misc { - @Expose - @ConfigOption( - name = "Only Show on Skyblock", - desc = "The item list and some other GUI elements will only show on skyblock" - ) - @ConfigEditorBoolean - public boolean onlyShowOnSkyblock = true; - - @Expose - @ConfigOption( - name = "Hide Potion Effects", - desc = "Hide the potion effects inside your inventory while on skyblock" - ) - @ConfigEditorBoolean - public boolean hidePotionEffect = true; - - @Expose - @ConfigOption( - name = "Streamer Mode", - desc = "Randomize lobby names in the scoreboard and chat messages to help prevent stream sniping" - ) - @ConfigEditorBoolean - public boolean streamerMode = false; - - @Expose - @ConfigOption( - name = "GUI Click Sounds", - desc = "Play click sounds in various NEU-related GUIs when pressing buttons" - ) - @ConfigEditorBoolean - public boolean guiButtonClicks = true; - - @Expose - @ConfigOption( - name = "Damage Indicator Style", - desc = "Change the style of Skyblock damage indicators to be easier to read" - ) - @ConfigEditorDropdown( - values = {"Off", "Commas", "Shortened"} - ) - public int damageIndicatorStyle = 1; - - @Expose - @ConfigOption( - name = "Edit Enchant Colours", - desc = "Change the colours of certain skyblock enchants" - ) - @ConfigEditorButton(runnableId = 8, buttonText = "Open") - public boolean editEnchantColoursButton = true; - - @Expose - @ConfigOption( - name = "Chroma Text Speed", - desc = "Change the speed of chroma text for items names (/neucustomize) and enchant colours (/neuec) with the chroma colour code (&z)" - ) - @ConfigEditorSlider( - minValue = 10, - maxValue = 500, - minStep = 10 - ) - public int chromaSpeed = 100; - } - - public static class Notifications { - @Expose - @ConfigOption( - name = "Update Messages", - desc = "Give a notification in chat whenever a new version of NEU is released" - ) - @ConfigEditorBoolean - public boolean showUpdateMsg = true; - - @Expose - @ConfigOption( - name = "RAM Warning", - desc = "Warning when game starts with lots of RAM allocated\n"+ - "\u00a7cBefore disabling this, please seriously read the message. If you complain about FPS issues without listening to the warning, that's your fault." - ) - @ConfigEditorBoolean - public boolean doRamNotif = true; - - /*@Expose - @ConfigOption( - name = "Wrong Pet", - desc = "Gives a notification in chat whenever you're using a pet that doesnt match the same xp you're gathering." - ) - @ConfigEditorBoolean - public boolean showWrongPetMsg = false;*/ - } - - public static class Itemlist { - @Expose - @ConfigOption( - name = "Show Vanilla Items", - desc = "Vanilla items are included in the item list" - ) - @ConfigEditorBoolean - public boolean showVanillaItems = true; - - @Expose - @ConfigOption( - name = "Open Itemlist Arrow", - desc = "Creates an arrow on the right-side to open the item list when hovered" - ) - @ConfigEditorBoolean - public boolean tabOpen = true; - - @Expose - @ConfigOption( - name = "Keep Open", - desc = "Keeps the Itemlist open after the inventory is closed" - ) - @ConfigEditorBoolean - public boolean keepopen = false; - - @Expose - @ConfigOption( - name = "Item Style", - desc = "Sets the style of the background behind items" - ) - @ConfigEditorDropdown( - values = {"Round", "Square"} - ) - public int itemStyle = 0; - - @Expose - @ConfigOption( - name = "Pane Gui Scale", - desc = "Change the gui scale of the Itemlist" - ) - @ConfigEditorDropdown( - values = {"Default", "Small", "Medium", "Large", "Auto"} - ) - public int paneGuiScale = 0; - - @Expose - @ConfigOption( - name = "Background Blur", - desc = "Change the blur amount behind the Itemlist. 0 = off" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 20, - minStep = 1 - ) - public int bgBlurFactor = 5; - - @Expose - @ConfigOption( - name = "Pane Width Multiplier", - desc = "Change the width of the Itemlist" - ) - @ConfigEditorSlider( - minValue = 0.5f, - maxValue = 1.5f, - minStep = 0.1f - ) - public float paneWidthMult = 1.0f; - - @Expose - @ConfigOption( - name = "Pane Padding", - desc = "Change the padding around the Itemlist" - ) - @ConfigEditorSlider( - minValue = 0f, - maxValue = 20f, - minStep = 1f - ) - public int panePadding = 10; - - @Expose - @ConfigOption( - name = "Foreground Colour", - desc = "Change the colour of foreground elements in the Itemlist" - ) - @ConfigEditorColour - public String foregroundColour = "00:255:100:100:100"; - - @Expose - @ConfigOption( - name = "Favourite Colour", - desc = "Change the colour of favourited elements in the Itemlist" - ) - @ConfigEditorColour - public String favouriteColour = "00:255:200:150:50"; - - @Expose - @ConfigOption( - name = "Pane Background Colour", - desc = "Change the colour of the Itemlist background" - ) - @ConfigEditorColour - public String backgroundColour = "15:6:0:0:255"; - } - - public static class Toolbar { - @Expose - @ConfigOption( - name = "Edit Toolbar Positions", - desc = "Edit the position of the QuickCommands / Search Bar" - ) - @ConfigEditorButton(runnableId = 6, buttonText = "Edit") - public boolean positionButton = true; - - @Expose - @ConfigOption( - name = "Show Quick Commands", - desc = "Show QuickCommands\u2122 in the NEU toolbar" - ) - @ConfigEditorBoolean - public boolean quickCommands = false; - - @Expose - @ConfigOption( - name = "Show Search Bar", - desc = "Show Itemlist search bar in the NEU toolbar" - ) - @ConfigEditorBoolean - public boolean searchBar = true; - - @Expose - @ConfigOption( - name = "Search Bar Width", - desc = "Change the width of the search bar" - ) - @ConfigEditorSlider( - minValue = 50f, - maxValue = 300f, - minStep = 10f - ) - public int searchBarWidth = 200; - - @Expose - @ConfigOption( - name = "Search Bar Height", - desc = "Change the height of the search bar" - ) - @ConfigEditorSlider( - minValue = 15f, - maxValue = 50f, - minStep = 1f - ) - public int searchBarHeight = 40; - - @Expose - @ConfigOption( - name = "Quick Commands Click Type", - desc = "Change the click type needed to trigger quick commands" - ) - @ConfigEditorDropdown( - values = {"Mouse Up", "Mouse Down"} - ) - public int quickCommandsClickType = 0; - } - - public static class InventoryButtons { - @Expose - @ConfigOption( - name = "Open Button Editor", - desc = "Open button editor GUI (/neubuttons)" - ) - @ConfigEditorButton(runnableId = 7, buttonText = "Open") - public boolean openEditorButton = true; - - @Expose - @ConfigOption( - name = "Always Hide \"Crafting\" Text", - desc = "Hide crafting text in inventory, even when no button is there" - ) - @ConfigEditorBoolean - public boolean hideCrafting = false; - - @Expose - @ConfigOption( - name = "Button Click Type", - desc = "Change the click type needed to trigger commands" - ) - @ConfigEditorDropdown( - values = {"Mouse Down", "Mouse Up"} - ) - public int clickType = 0; - } - - public static class SlotLocking { - @Expose - @ConfigOption( - name = "Enable Slot Locking", - desc = "Allows you to lock slots and create slot bindings" - ) - @ConfigEditorBoolean - public boolean enableSlotLocking = false; - - @Expose - @ConfigOption( - name = "Enable Slot Binding", - desc = "Allows you to create slot bindings\nNote: \"Enable Slot Locking\" must be on" - ) - @ConfigEditorBoolean - public boolean enableSlotBinding = true; - - @Expose - @ConfigOption( - name = "Don't Drop Bound Slots", - desc = "Slot bindings also act as locked slots (prevents dropping / moving in inventory)" - ) - @ConfigEditorBoolean - public boolean bindingAlsoLocks = false; - - @Expose - @ConfigOption( - name = "Slot Lock Key", - desc = "Click this key to LOCK a slot\n" + - "Hold this key and drag to BIND a slot" - ) - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_L) - public int slotLockKey = Keyboard.KEY_L; - - @Expose - @ConfigOption( - name = "Lock Slots in Trade", - desc = "Prevents trading locked items in the custom trade windows" - ) - @ConfigEditorBoolean - public boolean lockSlotsInTrade = true; - - @Expose - @ConfigOption( - name = "Slot Lock Sound", - desc = "Play a ding when locking/unlocking slots" - ) - @ConfigEditorBoolean - public boolean slotLockSound = true; - - @Expose - @ConfigOption( - name = "Slot Lock Sound Vol.", - desc = "Set the volume of the ding sound" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 100, - minStep = 1 - ) - public float slotLockSoundVol = 20; - } - - public static class TooltipTweaks { - @ConfigOption( - name = "Tooltip Price Information", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean priceInfoAccordion = false; - - @Expose - @ConfigOption( - name = "Price Info (Auc)", - desc = "\u00a7rSelect what price information you would like to see on auctionable item tooltips\n" + - "\u00a7eDrag text to rearrange" - ) - @ConfigEditorDraggableList( - exampleText = {"\u00a7eLowest BIN", - "\u00a7eAH Price", - "\u00a7eAH Sales", - "\u00a7eRaw Craft Cost", - "\u00a7eAVG Lowest BIN", - "\u00a7eDungeon Costs"} - ) - @ConfigAccordionId(id = 0) - public List<Integer> priceInfoAuc = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 5)); - - @Expose - @ConfigOption( - name = "Price Info (Baz)", - desc = "\u00a7rSelect what price information you would like to see on bazaar item tooltips\n" + - "\u00a7eDrag text to rearrange" - ) - @ConfigEditorDraggableList( - exampleText = {"\u00a7eBuy", "\u00a7eSell", "\u00a7eBuy (Insta)", "\u00a7eSell (Insta)", "\u00a7eRaw Craft Cost"} - ) - @ConfigAccordionId(id = 0) - public List<Integer> priceInfoBaz = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4)); - - @Expose - @ConfigOption( - name = "Price Info (Inv)", - desc = "Show price information for items in your inventory" - ) - @ConfigEditorBoolean - public boolean showPriceInfoInvItem = true; - - @Expose - @ConfigOption( - name = "Price Info (AH)", - desc = "Show price information for auctioned items" - ) - @ConfigEditorBoolean - public boolean showPriceInfoAucItem = true; - - @Expose - @ConfigOption( - name = "Missing Enchant List", - desc = "Show which enchants are missing on an item when pressing LSHIFT" - ) - @ConfigEditorBoolean - public boolean missingEnchantList = true; - - @Expose - @ConfigOption( - name = "Tooltip Border Colours", - desc = "Make the borders of tooltips match the rarity of the item (NEU Tooltips Only)" - ) - @ConfigEditorBoolean - public boolean tooltipBorderColours = true; - - @Expose - @ConfigOption( - name = "Tooltip Border Opacity", - desc = "Change the opacity of the rarity highlight (NEU Tooltips Only)" - ) - @ConfigEditorSlider( - minValue = 0f, - maxValue = 255f, - minStep = 1f - ) - public int tooltipBorderOpacity = 200; - } - - public static class ItemOverlays { - @ConfigOption( - name = "Treecapitator Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean treecapAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Treecap Overlay", - desc = "Show which blocks will be broken when using a Jungle Axe or Treecapitator" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean enableTreecapOverlay = true; - - @Expose - @ConfigOption( - name = "Overlay Colour", - desc = "Change the colour of the overlay" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 0) - public String treecapOverlayColour = "00:50:64:224:208"; - - @Expose - @ConfigOption( - name = "Enable Monkey Pet Check", - desc = "Will check use the API to check what pet you're using\nto determine the cooldown based off of if you have monkey pet." - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean enableMonkeyCheck = true; - - @ConfigOption( - name = "Builder's Wand Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 1) - public boolean wandAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Wand Overlay", - desc = "Show which blocks will be placed when using the Builder's Wand" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean enableWandOverlay = true; - - @Expose - @ConfigOption( - name = "Wand Block Count", - desc = "Shows the total count of a block in your inventory" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean wandBlockCount = true; - - @Expose - @ConfigOption( - name = "Overlay Colour", - desc = "Change the colour of the ghost block outline" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 1) - public String wandOverlayColour = "00:50:64:224:208"; - - @ConfigOption( - name = "Block Zapper Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 6) - public boolean zapperAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Zapper Overlay", - desc = "Show which blocks will be destroyed when using the Block Zapper" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 6) - public boolean enableZapperOverlay = true; - - @Expose - @ConfigOption( - name = "Overlay Colour", - desc = "Change the colour of the ghost block outline" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 6) - public String zapperOverlayColour = "0:102:171:5:0"; - - @ConfigOption( - name = "Smooth AOTE", - desc = "" - ) - @ConfigEditorAccordion(id = 2) - public boolean aoteAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Smooth AOTE", - desc = "Teleport smoothly to your destination when using AOTE" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean enableSmoothAOTE = true; - - @Expose - @ConfigOption( - name = "Enable Smooth Hyperion", - desc = "Teleport smoothly to your destination when using Hyperion" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean enableSmoothHyperion = true; - - @Expose - @ConfigOption( - name = "Smooth TP Time", - desc = "Change the amount of time (milliseconds) taken to teleport" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 500, - minStep = 25 - ) - @ConfigAccordionId(id = 2) - public int smoothTpMillis = 175; - - @Expose - @ConfigOption( - name = "Disable Hyperion Particles", - desc = "Remove the explosion effect when using a hyperion" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean disableHyperionParticles = true; - - @ConfigOption( - name = "Bonemerang Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 3) - public boolean bonemerangAccordion = false; - - @Expose - @ConfigOption( - name = "Highlight Targeted Entities", - desc = "Highlight entities that will be hit by your bonemerang" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean highlightTargeted = true; - - @Expose - @ConfigOption( - name = "Break Warning", - desc = "Show a warning below your crosshair if the bonemerang will break on a block" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean showBreak = true; - - @ConfigOption( - name = "Minion Crystal Radius Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 5) - public boolean crystalAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Crystal Overlay", - desc = "Show a block overlay for the effective radius of minion crystals (farming, mining, etc)" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 5) - public boolean enableCrystalOverlay = true; - - @Expose - @ConfigOption( - name = "Always Show Crystal Overlay", - desc = "Show the crystal overlay, even when a minion crystal is not being held" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 5) - public boolean alwaysShowCrystal = false; - } - - public static class SkillOverlays { - @Expose - @ConfigOption( - name = "Enable Farming Overlay", - desc = "Show an overlay while farming with useful information" - ) - @ConfigEditorBoolean - public boolean farmingOverlay = true; - - @Expose - @ConfigOption( - name = "Farming Text", - desc = "\u00a7eDrag text to change the appearance of the overlay\n" + - "\u00a7rHold a mathematical hoe or use an axe while gaining farming xp to show the overlay" - ) - @ConfigEditorDraggableList( - exampleText = {"\u00a7bCounter: \u00a7e37,547,860", - "\u00a7bCrops/m: \u00a7e38.29", - "\u00a7bFarm: \u00a7e12\u00a77 [\u00a7e|||||||||||||||||\u00a78||||||||\u00a77] \u00a7e67%", - "\u00a7bCurrent XP: \u00a7e6,734", - "\u00a7bRemaining XP: \u00a7e3,265", - "\u00a7bXP/h: \u00a7e238,129", - "\u00a7bYaw: \u00a7e68.25\u00a7l\u1D52", - "\u00a7bETA: 13h12m"} - ) - public List<Integer> farmingText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 7, 6)); - - @Expose - @ConfigOption( - name = "Farming Position", - desc = "Change the position of the Farming overlay" - ) - @ConfigEditorButton( - runnableId = 3, - buttonText = "Edit" - ) - public Position farmingPosition = new Position(10, 200); - - @Expose - @ConfigOption( - name = "Farming Style", - desc = "Change the style of the Farming overlay" - ) - @ConfigEditorDropdown( - values = {"Background", "No Shadow", "Shadow", "Full Shadow"} - ) - public int farmingStyle = 0; - } - - public static class Dungeons { - @ConfigOption( - name = "Dungeon Map", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean dungeonMapAccordion = false; - - @Expose - @ConfigOption( - name = "Edit Dungeon Map", - desc = "The NEU dungeon map has it's own editor (/neumap).\n" + - "Click the button on the left to open it" - ) - @ConfigEditorButton( - runnableId = 0, - buttonText = "Edit" - ) - @ConfigAccordionId(id = 0) - public int editDungeonMap = 0; - - @Expose - @ConfigOption( - name = "Show Own Head As Marker", - desc = "If you have the \"Head\" icon style selected, don't replace your green marker with a head" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean showOwnHeadAsMarker = false; - - @ConfigOption( - name = "Dungeon Profit", - desc = "" - ) - @ConfigEditorAccordion(id = 1) - public boolean dungeonProfitAccordion = false; - - @Expose - @ConfigOption( - name = "Profit Type", - desc = "Set the price dataset used for calculating profit" - ) - @ConfigEditorDropdown( - values = {"Lowest BIN", "24 AVG Lowest Bin", "Auction AVG"} - ) - @ConfigAccordionId(id = 1) - public int profitType = 0; - - @Expose - @ConfigOption( - name = "Profit Display Location", - desc = "Set where the profit information is displayed\n" + - "Overlay = Overlay on right side of inventory\n" + - "GUI Title = Text displayed next to the inventory title\n" + - "Lore = Inside the \"Open Reward Chest\" item" - ) - @ConfigEditorDropdown( - values = {"Overlay", "GUI Title", "Lore", "Off"} - ) - @ConfigAccordionId(id = 1) - public int profitDisplayLoc = 0; - - - @ConfigOption( - name = "Dungeon Win Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 3) - public boolean dungeonWinAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Dungeon Win", - desc = "Show a fancy win screen and stats when completing a dungeon" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean enableDungeonWin = true; - - @Expose - @ConfigOption( - name = "Dungeon Win Time", - desc = "Change the amount of time (milliseconds) that the win screen shows for" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 20000, - minStep = 500 - ) - @ConfigAccordionId(id = 3) - public int dungeonWinMillis = 8000; - - @ConfigOption( - name = "Dungeon Block Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 2) - public boolean dungeonBlocksAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Block Overlay", - desc = "Change the colour of certain blocks / entities while inside dungeons, but keeps the normal texture outside of dungeons" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean enableDungBlockOverlay = true; - - @Expose - @ConfigOption( - name = "Show Overlay Everywhere", - desc = "Show the dungeon block overlay even when not inside dungeons. Should only be used for testing." - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean dungeonBlocksEverywhere = false; - - @Expose - @ConfigOption( - name = "Slow Update", - desc = "Updates the colour every second instead of every tick.\n" + - "\u00A7cWARNING: This will cause all texture animations (eg. flowing water) to update slowly.\n" + - "This should only be used on low-end machines" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean slowDungeonBlocks = false; - - @Expose - @ConfigOption( - name = "Cracked Bricks", - desc = "Change the colour of: Cracked Bricks" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String dungCrackedColour = "0:255:7:255:217"; - - @Expose - @ConfigOption( - name = "Dispensers", - desc = "Change the colour of: Dispensers" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String dungDispenserColour = "0:255:255:76:0"; - - @Expose - @ConfigOption( - name = "Levers", - desc = "Change the colour of: Levers" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String dungLeverColour = "0:252:24:249:255"; - - @Expose - @ConfigOption( - name = "Tripwire String", - desc = "Change the colour of: Tripwire String" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String dungTripWireColour = "0:255:255:0:0"; - - @Expose - @ConfigOption( - name = "Normal Chests", - desc = "Change the colour of: Normal Chests" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String dungChestColour = "0:255:0:163:36"; - - @Expose - @ConfigOption( - name = "Trapped Chests", - desc = "Change the colour of: Trapped Chests" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String dungTrappedChestColour = "0:255:0:163:36"; - - @Expose - @ConfigOption( - name = "Bats", - desc = "Change the colour of: Bats" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String dungBatColour = "0:255:12:255:0"; - } - - public static class MiscOverlays { - @ConfigOption( - name = "Todo Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean todoAccordion = true; - - @Expose - @ConfigOption( - name = "Enable Todo Overlay", - desc = "Show an overlay that reminds you to do important tasks" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean todoOverlay = false; - - @Expose - @ConfigOption( - name = "Todo Text", - desc = "\u00a7eDrag text to change the appearance of the overlay\n" + - "\u00a7rIf you want to see the time until something is available, click \"Add\" and then the respective timer" - ) - @ConfigEditorDraggableList( - exampleText = { - "\u00a73Cakes: \u00a7eInactive!", - "\u00a73Cookie Buff: \u00a7eInactive!", - "\u00a73Godpot: \u00a7eInactive!", - "\u00a73Puzzler: \u00a7eReady!", - "\u00a73Fetchur: \u00a7eReady!", - "\u00a73Commissions: \u00a7eReady!", - "\u00a73Experiments: \u00a7eReady!", - "\u00a73Cakes: \u00a7e1d21h", - "\u00a73Cookie Buff: \u00a7e2d23h", - "\u00a73Godpot: \u00a7e19h", - "\u00a73Puzzler: \u00a7e13h", - "\u00a73Fetchur: \u00a7e3h38m", - "\u00a73Commissions: \u00a7e3h38m", - "\u00a73Experiments: \u00a7e3h38m"} - ) - @ConfigAccordionId(id = 0) - public List<Integer> todoText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6)); - - @Expose - @ConfigOption( - name = "Todo Position", - desc = "Change the position of the Todo overlay" - ) - @ConfigEditorButton( - runnableId = 5, - buttonText = "Edit" - ) - @ConfigAccordionId(id = 0) - public Position todoPosition = new Position(100, 0); - - - @Expose - @ConfigOption( - name = "Todo Style", - desc = "Change the style of the todo overlay" - ) - @ConfigEditorDropdown( - values = {"Background", "No Shadow", "Shadow", "Full Shadow"} - ) - @ConfigAccordionId(id = 0) - public int todoStyle = 0; - - @Expose - @ConfigOption( - name = "Todo Icons", - desc = "Add little item icons next to the lines in the todo overlay" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean todoIcons = true; - } - - public static class StorageGUI { - @ConfigOption( - name = "Storage Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 1) - public boolean storageOverlayAccordion = true; - - @Expose - public int selectedIndex = 0; - - @Expose - @ConfigOption( - name = "Enable Storage GUI", - desc = "Show a custom storage overlay when accessing /storage. " + - "Makes switching between pages much easier and also allows for searching through all storages" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean enableStorageGUI2 = true; - - @Expose - @ConfigOption( - name = "Storage Height", - desc = "Change the height of the storage preview section. Increasing this allows more storages to be seen at once" - ) - @ConfigEditorSlider( - minValue = 104, - maxValue = 312, - minStep = 26 - ) - @ConfigAccordionId(id = 1) - public int storageHeight = 208; - - @Expose - @ConfigOption( - name = "Storage Style", - desc = "Change the visual style of the overlay" - ) - @ConfigEditorDropdown( - values = {"Transparent", "Minecraft", "Dark", "Custom"} - ) - @ConfigAccordionId(id = 1) - public int displayStyle = 0; - - @Expose - @ConfigOption( - name = "Enderchest Preview", - desc = "Preview Enderchest pages when hovering over the selector on the left side" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean enderchestPreview = true; - - @Expose - @ConfigOption( - name = "Backpack Preview", - desc = "Preview Backpacks when hovering over the selector on the left side" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean backpackPreview = true; - - @Expose - @ConfigOption( - name = "Compact Vertically", - desc = "Remove the space between backpacks when there is a size discrepancy" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean masonryMode = false; - - @Expose - @ConfigOption( - name = "Fancy Glass Panes", - desc = "Replace the glass pane textures in your storage containers with a fancy connected texture" - ) - @ConfigEditorDropdown( - values = {"On", "Locked", "Off"} - ) - @ConfigAccordionId(id = 1) - public int fancyPanes = 0; - - @Expose - @ConfigOption( - name = "Search Bar Autofocus", - desc = "Automatically focus the search bar when pressing keys" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean searchBarAutofocus = true; - - @Expose - @ConfigOption( - name = "Selected Storage Colour", - desc = "Change the colour used to draw the selected backpack border" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 1) - public String selectedStorageColour = "0:255:255:223:0"; - - @Expose - @ConfigOption( - name = "Scrollable Tooltips", - desc = "Support for scrolling tooltips for users with small monitors\n" + - "This will prevent the menu from scrolling while holding the key, allowing you to scroll tooltips" - ) - @ConfigEditorKeybind(defaultKey = 0) - @ConfigAccordionId(id = 1) - public int cancelScrollKey = 0; - - @ConfigOption( - name = "Inventory Backpacks", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean inventorySlotAccordion = false; - - @Expose - @ConfigOption( - name = "Inventory Backpacks", - desc = "Add a \"10th slot\" to your inventory which allows you to quickly access your backpacks" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean showInvBackpack = false; - - @Expose - @ConfigOption( - name = "Scroll to Backpack", - desc = "Allow scrolling to the backpack using the mouse wheel.\n" + - "\"Scroll (Key)\" = Allow scrolling to 10th slot only while 'Backpack Scroll Key' (default: SHIFT) is pressed" - ) - @ConfigEditorDropdown( - values = {"Scroll (Key)", "Scroll (Always)", "Don't Scroll"} - ) - @ConfigAccordionId(id = 0) - public int scrollToBackpack2 = 0; - - @Expose - @ConfigOption( - name = "Backpack Side", - desc = "Set which side of the hotbar the backpack slot shows" - ) - @ConfigEditorDropdown( - values = {"Left", "Right"} - ) - @ConfigAccordionId(id = 0) - public int backpackHotbarSide = 0; - - @Expose - @ConfigOption( - name = "Backpack Peeking", - desc = "When the backpack is selected, show it's contents on your screen" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean showInvBackpackPreview = true; - - @Expose - @ConfigOption( - name = "Backpack Opacity%", - desc = "Change the opacity of the backpack preview background" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 100, - minStep = 5 - ) - @ConfigAccordionId(id = 0) - public int backpackOpacity = 50; - - @Expose - @ConfigOption( - name = "Backpack Scroll Key", - desc = "Change the key which needs to be pressed in order to allow backpacks to be scrolled between" - ) - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_LSHIFT) - @ConfigAccordionId(id = 0) - public int backpackScrollKey = Keyboard.KEY_LSHIFT; - - @Expose - @ConfigOption( - name = "Backpack Hotkey", - desc = "Hotkey to quickly switch to the backpack slot" - ) - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_GRAVE) - @ConfigAccordionId(id = 0) - public int backpackHotkey = Keyboard.KEY_GRAVE; + public DungeonMapConfig dungeonMap = new DungeonMapConfig(); + public static class Hidden { @Expose - @ConfigOption( - name = "Arrow Key Backpacks", - desc = "Use arrow keys [LEFT],[RIGHT] to move between backpacks and [DOWN] to navigate backpack even when the slot is not selected. Keys are customizable below" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean arrowKeyBackpacks = false; - - @ConfigOption( - name = "Arrow Key Backpack Keybinds", - desc = "" - ) - @ConfigEditorAccordion(id = 2) - @ConfigAccordionId(id = 0) - public boolean backpackArrowAccordion = false; - - @Expose - @ConfigOption( - name = "Backpack Left", - desc = "Select the backpack to the left" - ) - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_LEFT) - @ConfigAccordionId(id = 2) - public int arrowLeftKey = Keyboard.KEY_LEFT; - - @Expose - @ConfigOption( - name = "Backpack Right", - desc = "Select the backpack to the right" - ) - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_RIGHT) - @ConfigAccordionId(id = 2) - public int arrowRightKey = Keyboard.KEY_RIGHT; - - @Expose - @ConfigOption( - name = "Backpack Open", - desc = "Open the selected backpack" - ) - @ConfigEditorKeybind(defaultKey = Keyboard.KEY_DOWN) - @ConfigAccordionId(id = 2) - public int arrowDownKey = Keyboard.KEY_DOWN; - } - - public static class EnchSolvers { - @ConfigOption( - name = "Solvers", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean solversAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Solvers", - desc = "Turn on solvers for the experimentation table" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean enableEnchantingSolvers = true; - - /*@Expose - @ConfigOption( - name = "Prevent Misclicks", - desc = "Prevent accidentally failing the Chronomatron and Ultrasequencer experiments" - ) - @ConfigEditorBoolean - public boolean preventMisclicks = true;*/ - - @Expose - @ConfigOption( - name = "Hide Tooltips", - desc = "Hide the tooltip of items in the Chronomatron and Ultrasequencer experiments" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean hideTooltips = true; - - @Expose - @ConfigOption( - name = "Ultrasequencer Numbers", - desc = "Replace the items in the supersequencer with only numbers" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean seqNumbers = false; - - @Expose - @ConfigOption( - name = "Ultrasequencer Next", - desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is next" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - @ConfigAccordionId(id = 0) - public int seqNext = 6; - - @Expose - @ConfigOption( - name = "Ultrasequencer Upcoming", - desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is coming after \"next\"" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - @ConfigAccordionId(id = 0) - public int seqUpcoming = 5; - - @Expose - @ConfigOption( - name = "Superpairs Matched", - desc = "Set the colour of the glass pane shown behind successfully matched pairs" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - @ConfigAccordionId(id = 0) - public int supMatched = 6; - - @Expose - @ConfigOption( - name = "Superpairs Possible", - desc = "Set the colour of the glass pane shown behind pairs which can be matched, but have not yet" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - @ConfigAccordionId(id = 0) - public int supPossible = 2; - - @Expose - @ConfigOption( - name = "Superpairs Unmatched", - desc = "Set the colour of the glass pane shown behind pairs which have been previously uncovered" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - @ConfigAccordionId(id = 0) - public int supUnmatched = 5; - - @Expose - @ConfigOption( - name = "Superpairs Powerups", - desc = "Set the colour of the glass pane shown behind powerups" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - @ConfigAccordionId(id = 0) - public int supPower = 11; - - @ConfigOption( - name = "Enchant Table GUI", - desc = "" - ) - @ConfigEditorAccordion(id = 1) - public boolean tableGUIAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Enchant Table GUI", - desc = "Show a custom GUI when using the Enchant Table" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean enableTableGUI = true; - - @Expose - @ConfigOption( - name = "Incompatible Enchants", - desc = "Handle enchants that are incompatible with your current item, eg. Smite on a sword with Sharpness" - ) - @ConfigEditorDropdown( - values = {"Highlight", "Hide"} - ) - @ConfigAccordionId(id = 1) - public int incompatibleEnchants = 0; - - @Expose - @ConfigOption( - name = "Enchant Sorting", - desc = "Change the method of sorting enchants in the GUI" - ) - @ConfigEditorDropdown( - values = {"By Cost", "Alphabetical"} - ) - @ConfigAccordionId(id = 1) - public int enchantSorting = 0; - - @Expose - @ConfigOption( - name = "Enchant Ordering", - desc = "Change the method of ordered used by the sort" - ) - @ConfigEditorDropdown( - values = {"Ascending", "Descending"} - ) - @ConfigAccordionId(id = 1) - public int enchantOrdering = 0; - } - - public static class Mining { - @ConfigOption( - name = "Waypoints", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean waypointsAccordion = false; - - @Expose - @ConfigOption( - name = "Mines Waypoints", - desc = "Show waypoints in the Dwarven mines to the various locations\n" + - "Use \"Commissions Only\" to only show active commission locations" - ) - @ConfigEditorDropdown( - values = {"Hide", "Commissions Only", "Always"}, - initialIndex = 1 - ) - @ConfigAccordionId(id = 0) - public int locWaypoints = 1; - - @Expose - @ConfigOption( - name = "Emissary Waypoints", - desc = "Show waypoints in the Dwarven mines to emissaries\n" + - "Use \"Commission End\" to only show after finishing commissions" - ) - @ConfigEditorDropdown( - values = {"Hide", "Commission End", "Always"}, - initialIndex = 1 - ) - @ConfigAccordionId(id = 0) - public int emissaryWaypoints = 1; - - @ConfigOption( - name = "Drill Fuel Bar", - desc = "" - ) - @ConfigEditorAccordion(id = 1) - public boolean drillAccordion = false; - - @Expose - @ConfigOption( - name = "Drill Fuel Bar", - desc = "Show a fancy drill fuel bar when holding a drill in mining areas" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean drillFuelBar = true; - - @Expose - @ConfigOption( - name = "Fuel Bar Width", - desc = "Change the width of the drill fuel bar" - ) - @ConfigEditorSlider( - minValue = 50, - maxValue = 400, - minStep = 10 - ) - @ConfigAccordionId(id = 1) - public int drillFuelBarWidth = 200; - - @Expose - @ConfigOption( - name = "Fuel Bar Position", - desc = "Set the position of the drill fuel bar" - ) - @ConfigEditorButton( - runnableId = 2, - buttonText = "Edit" - ) - @ConfigAccordionId(id = 1) - public Position drillFuelBarPosition = new Position(0, -100, true, false); - - @ConfigOption( - name = "Dwarven Overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 2) - public boolean overlayAccordion = false; - - @Expose - @ConfigOption( - name = "Dwarven Overlay", - desc = "Show an overlay with useful information on the screen while in Dwarven Mines" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean dwarvenOverlay = true; - - @Expose - @ConfigOption( - name = "Dwarven Text", - desc = "\u00a7eDrag text to change the appearance of the overlay\n" + - "\u00a7rGo to the Dwarven Mines to show this overlay with useful information" - ) - @ConfigEditorDraggableList( - exampleText = {"\u00a73Goblin Slayer: \u00a7626.5%\n\u00a73Lucky Raffle: \u00a7c0.0%", - "\u00a73Mithril Powder: \u00a726,243", - "\u00a73Forge 1) \u00a79Diamonite\u00a77: \u00a7aReady!", - "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY", - "\u00a73Pickaxe CD: \u00a7a78s"} - ) - @ConfigAccordionId(id = 2) - public List<Integer> dwarvenText = new ArrayList<>(Arrays.asList(0, 1, 4, 2, 3)); - - @Expose - @ConfigOption( - name = "Overlay Position", - desc = "Change the position of the Dwarven Mines information overlay (commisions, powder & forge statuses)" - ) - @ConfigEditorButton( - runnableId = 1, - buttonText = "Edit" - ) - @ConfigAccordionId(id = 2) - public Position overlayPosition = new Position(10, 100); - - @Expose - @ConfigOption( - name = "Overlay Style", - desc = "Change the style of the Dwarven Mines information overlay" - ) - @ConfigEditorDropdown( - values = {"Background", "No Shadow", "Shadow", "Full Shadow"} - ) - @ConfigAccordionId(id = 2) - public int overlayStyle = 0; - - @Expose - @ConfigOption( - name = "Puzzler Solver", - desc = "Show the correct block to mine for the puzzler puzzle in Dwarven Mines" - ) - @ConfigEditorBoolean - public boolean puzzlerSolver = true; - - @Expose - @ConfigOption( - name = "Titanium Alert", - desc = "Show an alert whenever titanium appears nearby" - ) - @ConfigEditorBoolean - public boolean titaniumAlert = true; - - - @Expose - @ConfigOption( - name = "Dwarven Mines Textures", - desc = "Allows texture packs to retexture blocks in the Dwarven Mines. If you don't have a texturepack that does this, you should leave this off" - ) - @ConfigEditorBoolean - public boolean dwarvenTextures = false; - - /*@Expose - @ConfigOption( - name = "Don't Mine Stone", - desc = "Prevent mining stone blocks in mining areas" - ) - @ConfigEditorBoolean - public boolean dontMineStone = true; - - @Expose - @ConfigOption( - name = "Reveal Mist Creepers", - desc = "Make the creepers in the Dwarven Mines mist visible" - ) - @ConfigEditorBoolean - public boolean revealMistCreepers = true;*/ - } - - public static class Fishing { - @Expose - @ConfigOption( - name = "Hide Other Players Fishing", - desc = "Convenience option to easily hide \u00a7lother players'\u00a7r bobbers, rod lines and fishing particles\n" + - "The advanced options below allow you to set the precise colour, particles, etc." - ) - @ConfigEditorBoolean - public boolean hideOtherPlayerAll = false; - - @ConfigOption( - name = "Incoming Fish Warning", - desc = "" - ) - @ConfigEditorAccordion(id = 3) - public boolean incomingFishAccordion = false; - - @Expose - @ConfigOption( - name = "Fish Warning (R)", - desc = "Display a red '!' when you need to pull the fish up. The warning takes your ping into account" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean incomingFishWarningR = true; - - @Expose - @ConfigOption( - name = "Fish Warning (Y)", - desc = "Display a yellow '!' when a fish is approaching your bobber" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean incomingFishWarning = true; - - @Expose - @ConfigOption( - name = "Hooked Sound", - desc = "Play a high-pitched ding sound when the '!' turns red" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean incomingFishHookedSounds = true; - - @Expose - @ConfigOption( - name = "Approach Sound", - desc = "Play low-pitched ding sounds while the yellow '!' is visible" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean incomingFishIncSounds = false; - - @ConfigOption( - name = "Volumes", - desc = "" - ) - @ConfigAccordionId(id = 3) - @ConfigEditorAccordion(id = 5) - public boolean incomingFishVolumeAccordion = false; - - @Expose - @ConfigOption( - name = "Hooked Sound Vol.", - desc = "Set the volume of the hooked sound" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 100, - minStep = 1 - ) - @ConfigAccordionId(id = 5) - public float incomingFishHookedSoundsVol = 25; - - @Expose - @ConfigOption( - name = "Approach Sound Vol.", - desc = "Set the volume of the approaching sound" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 100, - minStep = 1 - ) - @ConfigAccordionId(id = 5) - public float incomingFishIncSoundsVol = 10; - - @ConfigOption( - name = "Fishing Particles", - desc = "" - ) - @ConfigEditorAccordion(id = 0) - public boolean particleAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Custom Particles", - desc = "Allow you to modify the particles that appear when a fish is incoming for you and other players" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean enableCustomParticles = false; - - @ConfigOption( - name = "Your Particles", - desc = "" - ) - @ConfigEditorAccordion(id = 1) - @ConfigAccordionId(id = 0) - public boolean yourParticlesAccordion = false; - - @Expose - @ConfigOption( - name = "Particle Type", - desc = "Change the type of the particle that is spawned\n" + - "Particle types with (RGB) support custom colours\n" + - "Set to 'NONE' to disable particles" - ) - @ConfigEditorDropdown( - values = {"Default", "None", "Spark (RGB)", "Swirl (RGB)", "Dust (RGB)", "Flame", "Crit", "Magic Crit"} - ) - @ConfigAccordionId(id = 1) - public int yourParticleType = 0; - - @Expose - @ConfigOption( - name = "Custom Colour", - desc = "Set a custom colour for the particle\n" + - "Only works for particle types with (RGB)" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 1) - public String yourParticleColour = "0:255:255:255:255"; - - @ConfigOption( - name = "Other Players' Particles", - desc = "" - ) - @ConfigEditorAccordion(id = 2) - @ConfigAccordionId(id = 0) - public boolean otherParticlesAccordion = false; - - @Expose - @ConfigOption( - name = "Particle Type", - desc = "Change the type of the particle that is spawned\n" + - "Particle types with (RGB) support custom colours\n" + - "Set to 'NONE' to disable particles" - ) - @ConfigEditorDropdown( - values = {"Default", "None", "Spark (RGB)", "Swirl (RGB)", "Dust (RGB)", "Flame", "Crit", "Magic Crit"} - ) - @ConfigAccordionId(id = 2) - public int otherParticleType = 0; - - @Expose - @ConfigOption( - name = "Custom Colour", - desc = "Set a custom colour for the particle\n" + - "Only works for particle types with (RGB)" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String otherParticleColour = "0:255:255:255:255"; - - @ConfigOption( - name = "Rod Line Colours", - desc = "" - ) - @ConfigEditorAccordion(id = 4) - public boolean rodAccordion = false; - - @Expose - @ConfigOption( - name = "Enable Rod Line Colours", - desc = "Change the colour of your and other players' rod lines\n" + - "Also fixes the position of the rod line" - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 4) - public boolean enableRodColours = true; - - @Expose - @ConfigOption( - name = "Own Rod Colour", - desc = "Change the colour of your own rod lines\n" + - "You can set the opacity to '0' to HIDE" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 4) - public String ownRodColour = "0:255:0:0:0"; - - @Expose - @ConfigOption( - name = "Other Rod Colour", - desc = "Change the colour of other players' rod lines\n" + - "You can set the opacity to '0' to HIDE" - ) - @ConfigEditorColour - @ConfigAccordionId(id = 4) - public String otherRodColour = "0:255:0:0:0"; - } - - public static class NeuAuctionHouse { - @Expose - @ConfigOption( - name = "Enable NeuAH", - desc = "Turn on the NEU Auction House. \u00A7cWARNING: May negatively impact performance on low-end machines" - ) - @ConfigEditorBoolean - public boolean enableNeuAuctionHouse = false; - - @Expose - @ConfigOption( - name = "Disable AH Scroll", - desc = "Disable scrolling using the scroll wheel inside NeuAH.\n" + - "This should be used if you want to be able to scroll through tooltips" - ) - @ConfigEditorBoolean - public boolean disableAhScroll = false; - - @Expose - @ConfigOption( - name = "AH Notification (Mins)", - desc = "Change the amount of time (in minutes) before the \"Ending Soon\" notification for an auction you have bid on" - ) - @ConfigEditorSlider( - minValue = 1f, - maxValue = 10f, - minStep = 1f - ) - public int ahNotification = 5; - - @Expose - @ConfigOption( - name = "Price Filtering in NEU AH", - desc = "The ability to filter the price of items and their respective average BIN values" - ) - @ConfigEditorBoolean - public boolean priceFiltering = false; - } - - public static class ImprovedSBMenu { - @Expose - @ConfigOption( - name = "Enable Improved SB Menus", - desc = "Change the way that skyblock menus (eg. /sbmenu) look" - ) - @ConfigEditorBoolean - public boolean enableSbMenus = true; - - @Expose - @ConfigOption( - name = "Menu Background Style", - desc = "Change the style of the background of skyblock menus" - ) - @ConfigEditorDropdown( - values = {"Dark 1", "Dark 2", "Transparent", "Light 1", "Light 2", "Light 3", - "Unused 1", "Unused 2", "Unused 3", "Unused 4"} - ) - public int backgroundStyle = 0; - - @Expose - @ConfigOption( - name = "Button Background Style", - desc = "Change the style of the foreground elements in skyblock menus" - ) - @ConfigEditorDropdown( - values = {"Dark 1", "Dark 2", "Transparent", "Light 1", "Light 2", "Light 3", - "Unused 1", "Unused 2", "Unused 3", "Unused 4"} - ) - public int buttonStyle = 0; - - @Expose - @ConfigOption( - name = "Hide Empty Tooltips", - desc = "Hide the tooltips of glass panes with no text" - ) - @ConfigEditorBoolean - public boolean hideEmptyPanes = true; - } - - public static class Calendar { - @Expose - @ConfigOption( - name = "Event Notifications", - desc = "Display notifications for skyblock calendar events" - ) - @ConfigEditorBoolean - public boolean eventNotifications = true; - - @Expose - @ConfigOption( - name = "Starting Soon Time", - desc = "Display a notification before events start, time in seconds.\n" + - "0 = No prior notification" - ) - @ConfigEditorSlider( - minValue = 0f, - maxValue = 600f, - minStep = 30f - ) - public int startingSoonTime = 300; - - @Expose - @ConfigOption( - name = "Timer In Inventory", - desc = "Displays the time until the next event at the top of your screen when in inventories" - ) - @ConfigEditorBoolean - public boolean showEventTimerInInventory = true; - - @Expose - @ConfigOption( - name = "Notification Sounds", - desc = "Play a sound whenever events start" - ) - @ConfigEditorBoolean - public boolean eventNotificationSounds = true; - - @Expose - @ConfigOption( - name = "Spooky Night Notification", - desc = "Send a notification during spooky event when the time reaches 7pm" - ) - @ConfigEditorBoolean - public boolean spookyNightNotification = true; - } - - public static class TradeMenu { - @Expose - @ConfigOption( - name = "Enable Custom Trade Menu", - desc = "When trading with other players in skyblock, display a special GUI designed to prevent scamming" - ) - @ConfigEditorBoolean - public boolean enableCustomTrade = true; - - - @Expose - @ConfigOption( - name = "Price Information", - desc = "Show the price of items in the trade window on both sides" - ) - @ConfigEditorBoolean - public boolean customTradePrices = true; - - @Expose - public boolean customTradePriceStyle = true; - } - - public static class PetOverlay { - @Expose - @ConfigOption( - name = "Enable Pet Info Overlay", - desc = "Shows current active pet and pet exp on screen." - ) - @ConfigEditorBoolean - public boolean enablePetInfo = false; - - @Expose - @ConfigOption( - name = "Pet Info Position", - desc = "The position of the pet info." - ) - @ConfigEditorButton( - runnableId = 4, - buttonText = "Edit" - ) - public Position petInfoPosition = new Position(-1, -1); - - @Expose - @ConfigOption( - name = "Pet Overlay Text", - desc = "\u00a7eDrag text to change the appearance of the overlay\n" + - "\u00a7rEquip a pet to show the overlay" - ) - @ConfigEditorDraggableList( - exampleText = {"\u00a7a[Lvl 37] \u00a7fRock", - "\u00a7b2,312.9/2,700\u00a7e (85.7%)", - "\u00a7b2.3k/2.7k\u00a7e (85.7%)", - "\u00a7bXP/h: \u00a7e27,209", - "\u00a7bTotal XP: \u00a7e30,597.9", - "\u00a7bHeld Item: \u00a7fMining Exp Boost", - "\u00a7bUntil L38: \u00a7e5m13s", - "\u00a7bUntil L100: \u00a7e2d13h"} - ) - public List<Integer> petOverlayText = new ArrayList<>(Arrays.asList(0, 2, 3, 6, 4)); - - @Expose - @ConfigOption( - name = "Pet Overlay Icon", - desc = "Show the icon of the pet you have equiped in the overlay" - ) - @ConfigEditorBoolean - public boolean petOverlayIcon = true; - - @Expose - @ConfigOption( - name = "Pet Info Overlay Style", - desc = "Change the style of the Pet Info overlay" - ) - @ConfigEditorDropdown( - values = {"Background", "No Shadow", "Shadow Only", "Full Shadow"} - ) - public int petInfoOverlayStyle = 0; - - @Expose - @ConfigOption( - name = "Show Last Pet", - desc = "Show 2 pets on the overlay\nUseful if training two pets at once with autopet" - ) - @ConfigEditorBoolean - public boolean dualPets = false; - } - - public static class AuctionHouseSearch { - @Expose - @ConfigOption( - name = "Enable Search GUI", - desc = "Use the advanced search GUI with autocomplete and history instead of the normal sign GUI\n\u00a7eStar Selection Texture: Johnny#4567" - ) - @ConfigEditorBoolean - public boolean enableSearchOverlay = true; - - @Expose - @ConfigOption( - name = "Keep Previous Search", - desc = "Don't clear the search bar after closing the GUI" - ) - @ConfigEditorBoolean - public boolean keepPreviousSearch = false; - - @Expose - @ConfigOption( - name = "Past Searches", - desc = "Show past searches below the autocomplete box" - ) - @ConfigEditorBoolean - public boolean showPastSearches = true; - - @Expose - @ConfigOption( - name = "ESC to Full Close", - desc = "Make pressing ESCAPE close the search GUI without opening up the AH again\n" + - "ENTER can still be used to search" - ) - @ConfigEditorBoolean - public boolean escFullClose = true; - } - - public static class AccessoryBag { - @Expose - @ConfigOption( - name = "Enable Accessory Bag Overlay", - desc = "Show an overlay on the accessory bag screen which gives useful information about your accessories" - ) - @ConfigEditorBoolean - public boolean enableOverlay = true; - } + public HashMap<String, NEUConfig.HiddenProfileSpecific> profileSpecific = new HashMap<>(); + @Expose public List<NEUConfig.InventoryButton> inventoryButtons = createDefaultInventoryButtons(); - public static class ApiKey { - @Expose - @ConfigOption( - name = "Api Key", - desc = "Hypixel api key" - ) - @ConfigEditorText - public String apiKey = ""; + @Expose public boolean enableItemEditing = false; + @Expose public boolean cacheRenderedItempane = true; + @Expose public boolean autoupdate = true; + @Expose public String overlaySearchBar = ""; + @Expose public String overlayQuickCommand = ""; + @Expose public boolean dev = false; + @Expose public boolean loadedModBefore = false; + @Expose public String selectedCape = null; + @Expose public int compareMode = 0; + @Expose public int sortMode = 0; + @Expose public ArrayList<Boolean> compareAscending = Lists.newArrayList(true, true, true); + @Expose public ArrayList<String> favourites = new ArrayList<>(); + @Expose public ArrayList<String> previousAuctionSearches = new ArrayList<>(); + @Expose public ArrayList<String> eventFavourites = new ArrayList<>(); + @Expose public ArrayList<String> quickCommands = createDefaultQuickCommands(); + @Expose public ArrayList<String> enchantColours = Lists.newArrayList( + "[a-zA-Z\\- ]+:\u003e:9:6:0", + "[a-zA-Z\\- ]+:\u003e:6:c:0", + "[a-zA-Z\\- ]+:\u003e:5:5:0", + "Experience:\u003e:3:5:0", + "Life Steal:\u003e:3:5:0", + "Scavenger:\u003e:3:5:0", + "Looting:\u003e:3:5:0"); } private static ArrayList<String> createDefaultQuickCommands() { @@ -2263,7 +308,8 @@ public class NEUConfig extends Config { } public static class HiddenProfileSpecific { - @Expose public long godPotionDrunk = 0L; + + @Expose public long godPotionDuration = 0l; @Expose public long puzzlerCompleted = 0L; @Expose public long firstCakeAte = 0L; @Expose public long fetchurCompleted = 0L; @@ -2274,35 +320,6 @@ public class NEUConfig extends Config { @Expose public int commissionMilestone = 0; } - public static class Hidden { - @Expose public HashMap<String, HiddenProfileSpecific> profileSpecific = new HashMap<>(); - @Expose public List<InventoryButton> inventoryButtons = createDefaultInventoryButtons(); - - @Expose public boolean enableItemEditing = false; - @Expose public boolean cacheRenderedItempane = true; - @Expose public boolean autoupdate = true; - @Expose public String overlaySearchBar = ""; - @Expose public String overlayQuickCommand = ""; - @Expose public boolean dev = false; - @Expose public boolean loadedModBefore = false; - @Expose public String selectedCape = null; - @Expose public int compareMode = 0; - @Expose public int sortMode = 0; - @Expose public ArrayList<Boolean> compareAscending = Lists.newArrayList(true, true, true); - @Expose public ArrayList<String> favourites = new ArrayList<>(); - @Expose public ArrayList<String> previousAuctionSearches = new ArrayList<>(); - @Expose public ArrayList<String> eventFavourites = new ArrayList<>(); - @Expose public ArrayList<String> quickCommands = createDefaultQuickCommands(); - @Expose public ArrayList<String> enchantColours = Lists.newArrayList( - "[a-zA-Z\\- ]+:\u003e:9:6:0", - "[a-zA-Z\\- ]+:\u003e:6:c:0", - "[a-zA-Z\\- ]+:\u003e:5:5:0", - "Experience:\u003e:3:5:0", - "Life Steal:\u003e:3:5:0", - "Scavenger:\u003e:3:5:0", - "Looting:\u003e:3:5:0"); - } - public static List<InventoryButton> createDefaultInventoryButtons() { List<InventoryButton> buttons = new ArrayList<>(); //Below crafting @@ -2392,140 +409,4 @@ public class NEUConfig extends Config { } } - public static class DungeonMap { - @Expose - @ConfigOption( - name = "Border Size", - desc = "Changes the size of the map border, without changing the size of the contents" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 5, - minStep = 0.25f - ) - public float dmBorderSize = 1; - - @Expose - @ConfigOption( - name = "Room Size", - desc = "Changes the size of rooms. Useful for higher dungeons with larger maps" - ) - @ConfigEditorSlider( - minValue = 0, - maxValue = 5, - minStep = 0.25f - ) - public float dmRoomSize = 1; - - @Expose - @ConfigOption( - name = "Icon Size", - desc = "Changes the scale of room indicators and player icons" - ) - @ConfigEditorSlider( - minValue = 0.5f, - maxValue = 3f, - minStep = 0.25f - ) - public float dmIconScale = 1.0f; - - @Expose - @ConfigOption( - name = "Border Style", - desc = "Various custom borders from various talented artists.\nUse 'custom' if your texture pack has a custom border" - ) - public int dmBorderStyle = 0; - - @Expose - @ConfigOption( - name = "Show Dungeon Map", - desc = "Show/hide the NEU dungeon map" - ) - public boolean dmEnable = true; - - @Expose - @ConfigOption( - name = "Map Center", - desc = "Center on rooms, or center on your player" - ) - public boolean dmCenterPlayer = true; - - @Expose - @ConfigOption( - name = "Rotate with Player", - desc = "Rotate the map to face the same direction as your player" - ) - public boolean dmRotatePlayer = true; - - @Expose - @ConfigOption( - name = "Orient Checkmarks", - desc = "Checkmarks will always show vertically, regardless of rotation" - ) - public boolean dmOrientCheck = true; - - @Expose - @ConfigOption( - name = "Center Checkmarks", - desc = "Checkmarks will show closer to the center of rooms" - ) - public boolean dmCenterCheck = false; - - @Expose - @ConfigOption( - name = "Player Icon Style", - desc = "Various player icon styles" - ) - public int dmPlayerHeads = 0; - - @Expose - @ConfigOption( - name = "Interpolate Far Players", - desc = "Will make players far away move smoothly" - ) - public boolean dmPlayerInterp = true; - - @Expose - @ConfigOption( - name = "OpenGL Compatibility", - desc = "Compatiblity options for people with bad computers. ONLY use this if you know what you are doing, otherwise the map will look worse" - ) - public int dmCompat = 0; - - @Expose - @ConfigOption( - name = "Background Colour", - desc = "Colour of the map background. Supports opacity & chroma" - ) - public String dmBackgroundColour = "00:170:75:75:75"; - - @Expose - @ConfigOption( - name = "Border Colour", - desc = "Colour of the map border. Supports opacity & chroma. Turn off custom borders to see" - ) - public String dmBorderColour = "00:0:0:0:0"; - - @Expose - @ConfigOption( - name = "Chroma Border Mode", - desc = "Applies a hue offset around the map border" - ) - public boolean dmChromaBorder = false; - - @Expose - @ConfigOption( - name = "Background Blur Factor", - desc = "Changes the blur factor behind the map. Set to 0 to disable blur" - ) - public float dmBackgroundBlur = 0; - - @Expose - @ConfigOption( - name = "Position", - desc = "The position of the map" - ) - public Position dmPosition = new Position(10, 10); - } - } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AccessoryBag.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AccessoryBag.java new file mode 100644 index 00000000..57bae5db --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AccessoryBag.java @@ -0,0 +1,15 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class AccessoryBag {
+ @Expose
+ @ConfigOption(
+ name = "Enable Accessory Bag Overlay",
+ desc = "Show an overlay on the accessory bag screen which gives useful information about your accessories"
+ )
+ @ConfigEditorBoolean
+ public boolean enableOverlay = true;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiKey.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiKey.java new file mode 100644 index 00000000..18786446 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiKey.java @@ -0,0 +1,15 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorText;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class ApiKey {
+ @Expose
+ @ConfigOption(
+ name = "Api Key",
+ desc = "Hypixel api key"
+ )
+ @ConfigEditorText
+ public String apiKey = "";
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AuctionHouseSearch.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AuctionHouseSearch.java new file mode 100644 index 00000000..89e25222 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AuctionHouseSearch.java @@ -0,0 +1,40 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class AuctionHouseSearch {
+ @Expose
+ @ConfigOption(
+ name = "Enable Search GUI",
+ desc = "Use the advanced search GUI with autocomplete and history instead of the normal sign GUI\n\u00a7eStar Selection Texture: Johnny#4567"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSearchOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Keep Previous Search",
+ desc = "Don't clear the search bar after closing the GUI"
+ )
+ @ConfigEditorBoolean
+ public boolean keepPreviousSearch = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Past Searches",
+ desc = "Show past searches below the autocomplete box"
+ )
+ @ConfigEditorBoolean
+ public boolean showPastSearches = true;
+
+ @Expose
+ @ConfigOption(
+ name = "ESC to Full Close",
+ desc = "Make pressing ESCAPE close the search GUI without opening up the AH again\n" +
+ "ENTER can still be used to search"
+ )
+ @ConfigEditorBoolean
+ public boolean escFullClose = true;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Calendar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Calendar.java new file mode 100644 index 00000000..fea9853a --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Calendar.java @@ -0,0 +1,53 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class Calendar {
+ @Expose
+ @ConfigOption(
+ name = "Event Notifications",
+ desc = "Display notifications for skyblock calendar events"
+ )
+ @ConfigEditorBoolean
+ public boolean eventNotifications = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Starting Soon Time",
+ desc = "Display a notification before events start, time in seconds.\n" +
+ "0 = No prior notification"
+ )
+ @ConfigEditorSlider(
+ minValue = 0f,
+ maxValue = 600f,
+ minStep = 30f
+ )
+ public int startingSoonTime = 300;
+
+ @Expose
+ @ConfigOption(
+ name = "Timer In Inventory",
+ desc = "Displays the time until the next event at the top of your screen when in inventories"
+ )
+ @ConfigEditorBoolean
+ public boolean showEventTimerInInventory = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Notification Sounds",
+ desc = "Play a sound whenever events start"
+ )
+ @ConfigEditorBoolean
+ public boolean eventNotificationSounds = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Spooky Night Notification",
+ desc = "Send a notification during spooky event when the time reaches 7pm"
+ )
+ @ConfigEditorBoolean
+ public boolean spookyNightNotification = true;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java new file mode 100644 index 00000000..367a6eae --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java @@ -0,0 +1,142 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Position;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class DungeonMapConfig {
+ @Expose
+ @ConfigOption(
+ name = "Border Size",
+ desc = "Changes the size of the map border, without changing the size of the contents"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 5,
+ minStep = 0.25f
+ )
+ public float dmBorderSize = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Room Size",
+ desc = "Changes the size of rooms. Useful for higher dungeons with larger maps"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 5,
+ minStep = 0.25f
+ )
+ public float dmRoomSize = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Icon Size",
+ desc = "Changes the scale of room indicators and player icons"
+ )
+ @ConfigEditorSlider(
+ minValue = 0.5f,
+ maxValue = 3f,
+ minStep = 0.25f
+ )
+ public float dmIconScale = 1.0f;
+
+ @Expose
+ @ConfigOption(
+ name = "Border Style",
+ desc = "Various custom borders from various talented artists.\nUse 'custom' if your texture pack has a custom border"
+ )
+ public int dmBorderStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Dungeon Map",
+ desc = "Show/hide the NEU dungeon map"
+ )
+ public boolean dmEnable = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Map Center",
+ desc = "Center on rooms, or center on your player"
+ )
+ public boolean dmCenterPlayer = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Rotate with Player",
+ desc = "Rotate the map to face the same direction as your player"
+ )
+ public boolean dmRotatePlayer = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Orient Checkmarks",
+ desc = "Checkmarks will always show vertically, regardless of rotation"
+ )
+ public boolean dmOrientCheck = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Center Checkmarks",
+ desc = "Checkmarks will show closer to the center of rooms"
+ )
+ public boolean dmCenterCheck = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Player Icon Style",
+ desc = "Various player icon styles"
+ )
+ public int dmPlayerHeads = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Interpolate Far Players",
+ desc = "Will make players far away move smoothly"
+ )
+ public boolean dmPlayerInterp = true;
+
+ @Expose
+ @ConfigOption(
+ name = "OpenGL Compatibility",
+ desc = "Compatiblity options for people with bad computers. ONLY use this if you know what you are doing, otherwise the map will look worse"
+ )
+ public int dmCompat = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Background Colour",
+ desc = "Colour of the map background. Supports opacity & chroma"
+ )
+ public String dmBackgroundColour = "00:170:75:75:75";
+
+ @Expose
+ @ConfigOption(
+ name = "Border Colour",
+ desc = "Colour of the map border. Supports opacity & chroma. Turn off custom borders to see"
+ )
+ public String dmBorderColour = "00:0:0:0:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Chroma Border Mode",
+ desc = "Applies a hue offset around the map border"
+ )
+ public boolean dmChromaBorder = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Background Blur Factor",
+ desc = "Changes the blur factor behind the map. Set to 0 to disable blur"
+ )
+ public float dmBackgroundBlur = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Position",
+ desc = "The position of the map"
+ )
+ public Position dmPosition = new Position(10, 10);
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java new file mode 100644 index 00000000..a1b34a6d --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java @@ -0,0 +1,199 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import org.lwjgl.input.Keyboard;
+
+public class Dungeons {
+ @ConfigOption(
+ name = "Dungeon Map",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean dungeonMapAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Edit Dungeon Map",
+ desc = "The NEU dungeon map has it's own editor (/neumap).\n" +
+ "Click the button on the left to open it"
+ )
+ @ConfigEditorButton(
+ runnableId = 0,
+ buttonText = "Edit"
+ )
+ @ConfigAccordionId(id = 0)
+ public int editDungeonMap = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Own Head As Marker",
+ desc = "If you have the \"Head\" icon style selected, don't replace your green marker with a head"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean showOwnHeadAsMarker = false;
+
+ @ConfigOption(
+ name = "Dungeon Profit",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 1)
+ public boolean dungeonProfitAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Profit Type",
+ desc = "Set the price dataset used for calculating profit"
+ )
+ @ConfigEditorDropdown(
+ values = {"Lowest BIN", "24 AVG Lowest Bin", "Auction AVG"}
+ )
+ @ConfigAccordionId(id = 1)
+ public int profitType = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Profit Display Location",
+ desc = "Set where the profit information is displayed\n" +
+ "Overlay = Overlay on right side of inventory\n" +
+ "GUI Title = Text displayed next to the inventory title\n" +
+ "Lore = Inside the \"Open Reward Chest\" item"
+ )
+ @ConfigEditorDropdown(
+ values = {"Overlay", "GUI Title", "Lore", "Off"}
+ )
+ @ConfigAccordionId(id = 1)
+ public int profitDisplayLoc = 0;
+
+
+ @ConfigOption(
+ name = "Dungeon Win Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 3)
+ public boolean dungeonWinAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Dungeon Win",
+ desc = "Show a fancy win screen and stats when completing a dungeon"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean enableDungeonWin = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Dungeon Win Time",
+ desc = "Change the amount of time (milliseconds) that the win screen shows for"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 20000,
+ minStep = 500
+ )
+ @ConfigAccordionId(id = 3)
+ public int dungeonWinMillis = 8000;
+
+ @ConfigOption(
+ name = "Dungeon Block Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 2)
+ public boolean dungeonBlocksAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Block Overlay",
+ desc = "Change the colour of certain blocks / entities while inside dungeons, but keeps the normal texture outside of dungeons"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean enableDungBlockOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Overlay Everywhere",
+ desc = "Show the dungeon block overlay even when not inside dungeons. Should only be used for testing."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean dungeonBlocksEverywhere = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Slow Update",
+ desc = "Updates the colour every second instead of every tick.\n" +
+ "\u00A7cWARNING: This will cause all texture animations (eg. flowing water) to update slowly.\n" +
+ "This should only be used on low-end machines"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean slowDungeonBlocks = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Cracked Bricks",
+ desc = "Change the colour of: Cracked Bricks"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String dungCrackedColour = "0:255:7:255:217";
+
+ @Expose
+ @ConfigOption(
+ name = "Dispensers",
+ desc = "Change the colour of: Dispensers"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String dungDispenserColour = "0:255:255:76:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Levers",
+ desc = "Change the colour of: Levers"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String dungLeverColour = "0:252:24:249:255";
+
+ @Expose
+ @ConfigOption(
+ name = "Tripwire String",
+ desc = "Change the colour of: Tripwire String"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String dungTripWireColour = "0:255:255:0:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Normal Chests",
+ desc = "Change the colour of: Normal Chests"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String dungChestColour = "0:255:0:163:36";
+
+ @Expose
+ @ConfigOption(
+ name = "Trapped Chests",
+ desc = "Change the colour of: Trapped Chests"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String dungTrappedChestColour = "0:255:0:163:36";
+
+ @Expose
+ @ConfigOption(
+ name = "Bats",
+ desc = "Change the colour of: Bats"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String dungBatColour = "0:255:12:255:0";
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java new file mode 100644 index 00000000..a505f8b7 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java @@ -0,0 +1,172 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections; + +import com.google.gson.annotations.Expose; +import io.github.moulberry.notenoughupdates.core.config.annotations.*; + +public class Enchanting { + @ConfigOption( + name = "Enchant Table GUI", + desc = "" + ) + @ConfigEditorAccordion(id = 1) + public boolean tableGUIAccordion = false; + + @Expose + @ConfigOption( + name = "Enable Enchant Table GUI", + desc = "Show a custom GUI when using the Enchant Table" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean enableTableGUI = true; + + @Expose + @ConfigOption( + name = "Incompatible Enchants", + desc = "Handle enchants that are incompatible with your current item, eg. Smite on a sword with Sharpness" + ) + @ConfigEditorDropdown( + values = {"Highlight", "Hide"} + ) + @ConfigAccordionId(id = 1) + public int incompatibleEnchants = 0; + + @Expose + @ConfigOption( + name = "Enchant Sorting", + desc = "Change the method of sorting enchants in the GUI" + ) + @ConfigEditorDropdown( + values = {"By Cost", "Alphabetical"} + ) + @ConfigAccordionId(id = 1) + public int enchantSorting = 0; + + @Expose + @ConfigOption( + name = "Enchant Ordering", + desc = "Change the method of ordered used by the sort" + ) + @ConfigEditorDropdown( + values = {"Ascending", "Descending"} + ) + @ConfigAccordionId(id = 1) + public int enchantOrdering = 0; + + + @ConfigOption( + name = "Enchanting Solvers", + desc = "" + ) + @ConfigEditorAccordion(id = 0) + public boolean enchantingSolversAccordion = false; + + + @Expose + @ConfigOption( + name = "Enable Solvers", + desc = "Turn on solvers for the experimentation table" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableEnchantingSolvers = true; + + /*@Expose + @ConfigOption( + name = "Prevent Misclicks", + desc = "Prevent accidentally failing the Chronomatron and Ultrasequencer experiments" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean preventMisclicks = true;*/ + + @Expose + @ConfigOption( + name = "Hide Tooltips", + desc = "Hide the tooltip of items in the Chronomatron and Ultrasequencer experiments" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean hideTooltips = true; + + @Expose + @ConfigOption( + name = "Ultrasequencer Numbers", + desc = "Replace the items in the supersequencer with only numbers" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean seqNumbers = false; + + @Expose + @ConfigOption( + name = "Ultrasequencer Next", + desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is next" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int seqNext = 6; + + @Expose + @ConfigOption( + name = "Ultrasequencer Upcoming", + desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is coming after \"next\"" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int seqUpcoming = 5; + + @Expose + @ConfigOption( + name = "Superpairs Matched", + desc = "Set the colour of the glass pane shown behind successfully matched pairs" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supMatched = 6; + + @Expose + @ConfigOption( + name = "Superpairs Possible", + desc = "Set the colour of the glass pane shown behind pairs which can be matched, but have not yet" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supPossible = 2; + + @Expose + @ConfigOption( + name = "Superpairs Unmatched", + desc = "Set the colour of the glass pane shown behind pairs which have been previously uncovered" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supUnmatched = 5; + + @Expose + @ConfigOption( + name = "Superpairs Powerups", + desc = "Set the colour of the glass pane shown behind powerups" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supPower = 11; +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java new file mode 100644 index 00000000..61fcc559 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java @@ -0,0 +1,207 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+public class Fishing {
+ @Expose
+ @ConfigOption(
+ name = "Hide Other Players Fishing",
+ desc = "Convenience option to easily hide \u00a7lother players'\u00a7r bobbers, rod lines and fishing particles\n" +
+ "The advanced options below allow you to set the precise colour, particles, etc."
+ )
+ @ConfigEditorBoolean
+ public boolean hideOtherPlayerAll = false;
+
+ @ConfigOption(
+ name = "Incoming Fish Warning",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 3)
+ public boolean incomingFishAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Fish Warning (R)",
+ desc = "Display a red '!' when you need to pull the fish up. The warning takes your ping into account"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean incomingFishWarningR = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Fish Warning (Y)",
+ desc = "Display a yellow '!' when a fish is approaching your bobber"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean incomingFishWarning = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Hooked Sound",
+ desc = "Play a high-pitched ding sound when the '!' turns red"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean incomingFishHookedSounds = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Approach Sound",
+ desc = "Play low-pitched ding sounds while the yellow '!' is visible"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean incomingFishIncSounds = false;
+
+ @ConfigOption(
+ name = "Volumes",
+ desc = ""
+ )
+ @ConfigAccordionId(id = 3)
+ @ConfigEditorAccordion(id = 5)
+ public boolean incomingFishVolumeAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Hooked Sound Vol.",
+ desc = "Set the volume of the hooked sound"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 100,
+ minStep = 1
+ )
+ @ConfigAccordionId(id = 5)
+ public float incomingFishHookedSoundsVol = 25;
+
+ @Expose
+ @ConfigOption(
+ name = "Approach Sound Vol.",
+ desc = "Set the volume of the approaching sound"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 100,
+ minStep = 1
+ )
+ @ConfigAccordionId(id = 5)
+ public float incomingFishIncSoundsVol = 10;
+
+ @ConfigOption(
+ name = "Fishing Particles",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean particleAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Custom Particles",
+ desc = "Allow you to modify the particles that appear when a fish is incoming for you and other players"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean enableCustomParticles = false;
+
+ @ConfigOption(
+ name = "Your Particles",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 1)
+ @ConfigAccordionId(id = 0)
+ public boolean yourParticlesAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Particle Type",
+ desc = "Change the type of the particle that is spawned\n" +
+ "Particle types with (RGB) support custom colours\n" +
+ "Set to 'NONE' to disable particles"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "None", "Spark (RGB)", "Swirl (RGB)", "Dust (RGB)", "Flame", "Crit", "Magic Crit"}
+ )
+ @ConfigAccordionId(id = 1)
+ public int yourParticleType = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Custom Colour",
+ desc = "Set a custom colour for the particle\n" +
+ "Only works for particle types with (RGB)"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 1)
+ public String yourParticleColour = "0:255:255:255:255";
+
+ @ConfigOption(
+ name = "Other Players' Particles",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 2)
+ @ConfigAccordionId(id = 0)
+ public boolean otherParticlesAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Particle Type",
+ desc = "Change the type of the particle that is spawned\n" +
+ "Particle types with (RGB) support custom colours\n" +
+ "Set to 'NONE' to disable particles"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "None", "Spark (RGB)", "Swirl (RGB)", "Dust (RGB)", "Flame", "Crit", "Magic Crit"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int otherParticleType = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Custom Colour",
+ desc = "Set a custom colour for the particle\n" +
+ "Only works for particle types with (RGB)"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String otherParticleColour = "0:255:255:255:255";
+
+ @ConfigOption(
+ name = "Rod Line Colours",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 4)
+ public boolean rodAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Rod Line Colours",
+ desc = "Change the colour of your and other players' rod lines\n" +
+ "Also fixes the position of the rod line"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 4)
+ public boolean enableRodColours = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Own Rod Colour",
+ desc = "Change the colour of your own rod lines\n" +
+ "You can set the opacity to '0' to HIDE"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 4)
+ public String ownRodColour = "0:255:0:0:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Other Rod Colour",
+ desc = "Change the colour of other players' rod lines\n" +
+ "You can set the opacity to '0' to HIDE"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 4)
+ public String otherRodColour = "0:255:0:0:0";
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ImprovedSBMenu.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ImprovedSBMenu.java new file mode 100644 index 00000000..6a4cb65c --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ImprovedSBMenu.java @@ -0,0 +1,46 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class ImprovedSBMenu {
+ @Expose
+ @ConfigOption(
+ name = "Enable Improved SB Menus",
+ desc = "Change the way that skyblock menus (eg. /sbmenu) look"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSbMenus = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Menu Background Style",
+ desc = "Change the style of the background of skyblock menus"
+ )
+ @ConfigEditorDropdown(
+ values = {"Dark 1", "Dark 2", "Transparent", "Light 1", "Light 2", "Light 3",
+ "Unused 1", "Unused 2", "Unused 3", "Unused 4"}
+ )
+ public int backgroundStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Button Background Style",
+ desc = "Change the style of the foreground elements in skyblock menus"
+ )
+ @ConfigEditorDropdown(
+ values = {"Dark 1", "Dark 2", "Transparent", "Light 1", "Light 2", "Light 3",
+ "Unused 1", "Unused 2", "Unused 3", "Unused 4"}
+ )
+ public int buttonStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Empty Tooltips",
+ desc = "Hide the tooltips of glass panes with no text"
+ )
+ @ConfigEditorBoolean
+ public boolean hideEmptyPanes = true;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/InventoryButtons.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/InventoryButtons.java new file mode 100644 index 00000000..a4b0616b --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/InventoryButtons.java @@ -0,0 +1,35 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class InventoryButtons {
+ @Expose
+ @ConfigOption(
+ name = "Open Button Editor",
+ desc = "Open button editor GUI (/neubuttons)"
+ )
+ @ConfigEditorButton(runnableId = 7, buttonText = "Open")
+ public boolean openEditorButton = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Always Hide \"Crafting\" Text",
+ desc = "Hide crafting text in inventory, even when no button is there"
+ )
+ @ConfigEditorBoolean
+ public boolean hideCrafting = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Button Click Type",
+ desc = "Change the click type needed to trigger commands"
+ )
+ @ConfigEditorDropdown(
+ values = {"Mouse Down", "Mouse Up"}
+ )
+ public int clickType = 0;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java new file mode 100644 index 00000000..92e9ca27 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java @@ -0,0 +1,196 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+public class ItemOverlays {
+ @ConfigOption(
+ name = "Treecapitator Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean treecapAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Treecap Overlay",
+ desc = "Show which blocks will be broken when using a Jungle Axe or Treecapitator"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean enableTreecapOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Colour",
+ desc = "Change the colour of the overlay"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 0)
+ public String treecapOverlayColour = "00:50:64:224:208";
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Monkey Pet Check",
+ desc = "Will check use the API to check what pet you're using\nto determine the cooldown based off of if you have monkey pet."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean enableMonkeyCheck = true;
+
+ @ConfigOption(
+ name = "Builder's Wand Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 1)
+ public boolean wandAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Wand Overlay",
+ desc = "Show which blocks will be placed when using the Builder's Wand"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean enableWandOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Wand Block Count",
+ desc = "Shows the total count of a block in your inventory"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean wandBlockCount = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Colour",
+ desc = "Change the colour of the ghost block outline"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 1)
+ public String wandOverlayColour = "00:50:64:224:208";
+
+ @ConfigOption(
+ name = "Block Zapper Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 6)
+ public boolean zapperAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Zapper Overlay",
+ desc = "Show which blocks will be destroyed when using the Block Zapper"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 6)
+ public boolean enableZapperOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Colour",
+ desc = "Change the colour of the ghost block outline"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 6)
+ public String zapperOverlayColour = "0:102:171:5:0";
+
+ @ConfigOption(
+ name = "Smooth AOTE",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 2)
+ public boolean aoteAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Smooth AOTE",
+ desc = "Teleport smoothly to your destination when using AOTE or AOTV"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean enableSmoothAOTE = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Smooth Hyperion",
+ desc = "Teleport smoothly to your destination when using Hyperion"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean enableSmoothHyperion = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Smooth TP Time",
+ desc = "Change the amount of time (milliseconds) taken to teleport"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 500,
+ minStep = 25
+ )
+ @ConfigAccordionId(id = 2)
+ public int smoothTpMillis = 175;
+
+ @Expose
+ @ConfigOption(
+ name = "Disable Hyperion Particles",
+ desc = "Remove the explosion effect when using a hyperion"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean disableHyperionParticles = true;
+
+ @ConfigOption(
+ name = "Bonemerang Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 3)
+ public boolean bonemerangAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Highlight Targeted Entities",
+ desc = "Highlight entities that will be hit by your bonemerang"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean highlightTargeted = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Break Warning",
+ desc = "Show a warning below your crosshair if the bonemerang will break on a block"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean showBreak = true;
+
+ @ConfigOption(
+ name = "Minion Crystal Radius Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 5)
+ public boolean crystalAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Crystal Overlay",
+ desc = "Show a block overlay for the effective radius of minion crystals (farming, mining, etc)"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 5)
+ public boolean enableCrystalOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Always Show Crystal Overlay",
+ desc = "Show the crystal overlay, even when a minion crystal is not being held"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 5)
+ public boolean alwaysShowCrystal = false;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Itemlist.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Itemlist.java new file mode 100644 index 00000000..db078353 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Itemlist.java @@ -0,0 +1,110 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+public class Itemlist {
+ @Expose
+ @ConfigOption(
+ name = "Show Vanilla Items",
+ desc = "Vanilla items are included in the item list"
+ )
+ @ConfigEditorBoolean
+ public boolean showVanillaItems = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Open Itemlist Arrow",
+ desc = "Creates an arrow on the right-side to open the item list when hovered"
+ )
+ @ConfigEditorBoolean
+ public boolean tabOpen = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Keep Open",
+ desc = "Keeps the Itemlist open after the inventory is closed"
+ )
+ @ConfigEditorBoolean
+ public boolean keepopen = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Item Style",
+ desc = "Sets the style of the background behind items"
+ )
+ @ConfigEditorDropdown(
+ values = {"Round", "Square"}
+ )
+ public int itemStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Gui Scale",
+ desc = "Change the gui scale of the Itemlist"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "Small", "Medium", "Large", "Auto"}
+ )
+ public int paneGuiScale = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Background Blur",
+ desc = "Change the blur amount behind the Itemlist. 0 = off"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 20,
+ minStep = 1
+ )
+ public int bgBlurFactor = 5;
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Width Multiplier",
+ desc = "Change the width of the Itemlist"
+ )
+ @ConfigEditorSlider(
+ minValue = 0.5f,
+ maxValue = 1.5f,
+ minStep = 0.1f
+ )
+ public float paneWidthMult = 1.0f;
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Padding",
+ desc = "Change the padding around the Itemlist"
+ )
+ @ConfigEditorSlider(
+ minValue = 0f,
+ maxValue = 20f,
+ minStep = 1f
+ )
+ public int panePadding = 10;
+
+ @Expose
+ @ConfigOption(
+ name = "Foreground Colour",
+ desc = "Change the colour of foreground elements in the Itemlist"
+ )
+ @ConfigEditorColour
+ public String foregroundColour = "00:255:100:100:100";
+
+ @Expose
+ @ConfigOption(
+ name = "Favourite Colour",
+ desc = "Change the colour of favourited elements in the Itemlist"
+ )
+ @ConfigEditorColour
+ public String favouriteColour = "00:255:200:150:50";
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Background Colour",
+ desc = "Change the colour of the Itemlist background"
+ )
+ @ConfigEditorColour
+ public String backgroundColour = "15:6:0:0:255";
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java new file mode 100644 index 00000000..157da202 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -0,0 +1,190 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Position;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Mining {
+ @ConfigOption(
+ name = "Waypoints",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean waypointsAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Mines Waypoints",
+ desc = "Show waypoints in the Dwarven mines to the various locations\n" +
+ "Use \"Commissions Only\" to only show active commission locations"
+ )
+ @ConfigEditorDropdown(
+ values = {"Hide", "Commissions Only", "Always"},
+ initialIndex = 1
+ )
+ @ConfigAccordionId(id = 0)
+ public int locWaypoints = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Emissary Waypoints",
+ desc = "Show waypoints in the Dwarven mines to emissaries\n" +
+ "Use \"Commission End\" to only show after finishing commissions"
+ )
+ @ConfigEditorDropdown(
+ values = {"Hide", "Commission End", "Always"},
+ initialIndex = 1
+ )
+ @ConfigAccordionId(id = 0)
+ public int emissaryWaypoints = 1;
+
+ @ConfigOption(
+ name = "Drill Fuel Bar",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 1)
+ public boolean drillAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Drill Fuel Bar",
+ desc = "Show a fancy drill fuel bar when holding a drill in mining areas"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean drillFuelBar = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Fuel Bar Width",
+ desc = "Change the width of the drill fuel bar"
+ )
+ @ConfigEditorSlider(
+ minValue = 50,
+ maxValue = 400,
+ minStep = 10
+ )
+ @ConfigAccordionId(id = 1)
+ public int drillFuelBarWidth = 200;
+
+ @Expose
+ @ConfigOption(
+ name = "Fuel Bar Position",
+ desc = "Set the position of the drill fuel bar"
+ )
+ @ConfigEditorButton(
+ runnableId = 2,
+ buttonText = "Edit"
+ )
+ @ConfigAccordionId(id = 1)
+ public Position drillFuelBarPosition = new Position(0, -100, true, false);
+
+ @ConfigOption(
+ name = "Dwarven Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 2)
+ public boolean overlayAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Dwarven Overlay",
+ desc = "Show an overlay with useful information on the screen while in Dwarven Mines"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean dwarvenOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Dwarven Text",
+ desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
+ "\u00a7rGo to the Dwarven Mines to show this overlay with useful information"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a73Goblin Slayer: \u00a7626.5%\n\u00a73Lucky Raffle: \u00a7c0.0%",
+ "\u00a73Mithril Powder: \u00a726,243",
+ "\u00a73Gemstone Powder: \u00a7d6,243",
+ "\u00a73Forge 1) \u00a79Diamonite\u00a77: \u00a7aReady!",
+ "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY",
+ "\u00a73Pickaxe CD: \u00a7a78s"}
+ )
+ @ConfigAccordionId(id = 2)
+ public List<Integer> dwarvenText = new ArrayList<>(Arrays.asList(0, 1, 4, 2, 3, 5));
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Position",
+ desc = "Change the position of the Dwarven Mines information overlay (commisions, powder & forge statuses)"
+ )
+ @ConfigEditorButton(
+ runnableId = 1,
+ buttonText = "Edit"
+ )
+ @ConfigAccordionId(id = 2)
+ public Position overlayPosition = new Position(10, 100);
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Style",
+ desc = "Change the style of the Dwarven Mines information overlay"
+ )
+ @ConfigEditorDropdown(
+ values = {"Background", "No Shadow", "Shadow", "Full Shadow"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int overlayStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Puzzler Solver",
+ desc = "Show the correct block to mine for the puzzler puzzle in Dwarven Mines"
+ )
+ @ConfigEditorBoolean
+ public boolean puzzlerSolver = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Titanium Alert",
+ desc = "Show an alert whenever titanium appears nearby"
+ )
+ @ConfigEditorBoolean
+ public boolean titaniumAlert = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Titanium must touch air",
+ desc = "Only show an alert if the Titanium touches air. (kinda sus)"
+ )
+ @ConfigEditorBoolean
+ public boolean titaniumAlertMustBeVisible = false;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Dwarven Mines Textures",
+ desc = "Allows texture packs to retexture blocks in the Dwarven Mines. If you don't have a texturepack that does this, you should leave this off"
+ )
+ @ConfigEditorBoolean
+ public boolean dwarvenTextures = false;
+
+ /*@Expose
+ @ConfigOption(
+ name = "Don't Mine Stone",
+ desc = "Prevent mining stone blocks in mining areas"
+ )
+ @ConfigEditorBoolean
+ public boolean dontMineStone = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Reveal Mist Creepers",
+ desc = "Make the creepers in the Dwarven Mines mist visible"
+ )
+ @ConfigEditorBoolean
+ public boolean revealMistCreepers = true;*/
+}
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 new file mode 100644 index 00000000..37c75d28 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java @@ -0,0 +1,70 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+public class Misc {
+ @Expose
+ @ConfigOption(
+ name = "Only Show on Skyblock",
+ desc = "The item list and some other GUI elements will only show on skyblock"
+ )
+ @ConfigEditorBoolean
+ public boolean onlyShowOnSkyblock = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Potion Effects",
+ desc = "Hide the potion effects inside your inventory while on skyblock"
+ )
+ @ConfigEditorBoolean
+ public boolean hidePotionEffect = true;
+
+
+
+ @Expose
+ @ConfigOption(
+ name = "Streamer Mode",
+ desc = "Randomize lobby names in the scoreboard and chat messages to help prevent stream sniping"
+ )
+ @ConfigEditorBoolean
+ public boolean streamerMode = false;
+
+ @Expose
+ @ConfigOption(
+ name = "GUI Click Sounds",
+ desc = "Play click sounds in various NEU-related GUIs when pressing buttons"
+ )
+ @ConfigEditorBoolean
+ public boolean guiButtonClicks = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Damage Indicator Style",
+ desc = "Change the style of Skyblock damage indicators to be easier to read"
+ )
+ @ConfigEditorDropdown(
+ values = {"Off", "Commas", "Shortened"}
+ )
+ public int damageIndicatorStyle = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Edit Enchant Colours",
+ desc = "Change the colours of certain skyblock enchants"
+ )
+ @ConfigEditorButton(runnableId = 8, buttonText = "Open")
+ public boolean editEnchantColoursButton = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Chroma Text Speed",
+ desc = "Change the speed of chroma text for items names (/neucustomize) and enchant colours (/neuec) with the chroma colour code (&z)"
+ )
+ @ConfigEditorSlider(
+ minValue = 10,
+ maxValue = 500,
+ minStep = 10
+ )
+ public int chromaSpeed = 100;
+}
\ No newline at end of file diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java new file mode 100644 index 00000000..db36b111 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java @@ -0,0 +1,256 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Position;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class MiscOverlays {
+ @ConfigOption(
+ name = "Todo Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean todoAccordion = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Todo Overlay",
+ desc = "Show an overlay that reminds you to do important tasks"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean todoOverlay = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Todo Text",
+ desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
+ "\u00a7rIf you want to see the time until something is available, click \"Add\" and then the respective timer"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {
+ "\u00a73Cakes: \u00a7e1d21h",
+ "\u00a73Cookie Buff: \u00a7e2d23h",
+ "\u00a73Godpot: \u00a7e19h",
+ "\u00a73Puzzler: \u00a7e13h",
+ "\u00a73Fetchur: \u00a7e3h38m",
+ "\u00a73Commissions: \u00a7e3h38m",
+ "\u00a73Experiments: \u00a7e3h38m"}
+ )
+ @ConfigAccordionId(id = 0)
+ public List<Integer> todoText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6));
+
+ @ConfigOption(
+ name = "Show Only If Soon",
+ desc = ""
+ )
+ @ConfigAccordionId(id = 0)
+ @ConfigEditorAccordion(id = 1)
+ public boolean TodoAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Experimentation Display",
+ desc = "Change the way the experimentation timer displays\n" +
+ "Only when ready, When very Soon, When soon, When kinda soon or always."
+ )
+ @ConfigAccordionId(id =1)
+ @ConfigEditorDropdown(
+ values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"}
+ )
+ public int experimentationDisplay = 0;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Puzzler Reset Display",
+ desc = "Change the way the puzzler reset timer displays\n" +
+ "Only when ready, When very Soon, When soon, When kinda soon or always."
+ )
+ @ConfigAccordionId(id =1)
+ @ConfigEditorDropdown(
+ values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"}
+ )
+ public int puzzlerDisplay = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Fetchur Reset Display",
+ desc = "Change the way the fetchur reset timer displays\n" +
+ "Only when ready, When very Soon, When soon, When kinda soon or always."
+ )
+ @ConfigAccordionId(id =1)
+ @ConfigEditorDropdown(
+ values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"}
+ )
+ public int fetchurDisplay = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Commission timer Display",
+ desc = "Change the way the Commission timer displays\n" +
+ "Only when ready, When very Soon, When soon, When kinda soon or always."
+ )
+ @ConfigAccordionId(id =1)
+ @ConfigEditorDropdown(
+ values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"}
+ )
+ public int commissionDisplay = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Cake Buff Display",
+ desc = "Change the way the cake buff timer displays\n" +
+ "Only when ready, When very Soon, When soon, When kinda soon or always."
+ )
+ @ConfigAccordionId(id =1)
+ @ConfigEditorDropdown(
+ values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"}
+ )
+ public int cakesDisplay = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Cookie Buff Display",
+ desc = "Change the way the cookie buff displays\n" +
+ "Only when ready, When very Soon, When soon, When kinda soon or always."
+ )
+ @ConfigAccordionId(id =1)
+ @ConfigEditorDropdown(
+ values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"}
+ )
+ public int cookieBuffDisplay = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "God Pot Display",
+ desc = "Change the way the god pot displays\n" +
+ "Only when ready, When very Soon, When soon, When kinda soon or always."
+ )
+ @ConfigAccordionId(id =1)
+ @ConfigEditorDropdown(
+ values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"}
+ )
+ public int godpotDisplay = 0;
+
+ @ConfigOption(
+ name = "Colours",
+ desc = ""
+ )
+
+ @ConfigEditorAccordion(id = 2)
+ @ConfigAccordionId(id = 0)
+ public boolean TodoColourAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Ready colour",
+ desc = "Change the colour of when the timer is ready"
+
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int readyColour = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Gone colour",
+ desc = "Change the colour of when the timer is gone"
+
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int goneColour = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Very soon colour",
+ desc = "Change the colour of when the timer is almost ready/gone"
+
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int verySoonColour = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Soon Colour",
+ desc = "Change the colour of when the timer is soon ready/gone"
+
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int soonColour = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Kinda Soon Colour",
+ desc = "Change the colour of when the timer is kinda soon ready/gone"
+
+ )
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int kindaSoonColour = 0;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Default Colour",
+ desc = "Change the default colour of the timers"
+
+ )
+
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int defaultColour = 0;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Todo Position",
+ desc = "Change the position of the Todo overlay"
+ )
+ @ConfigEditorButton(
+ runnableId = 5,
+ buttonText = "Edit"
+ )
+ @ConfigAccordionId(id = 0)
+ public Position todoPosition = new Position(100, 0);
+
+
+ @Expose
+ @ConfigOption(
+ name = "Todo Style",
+ desc = "Change the style of the todo overlay"
+ )
+ @ConfigEditorDropdown(
+ values = {"Background", "No Shadow", "Shadow", "Full Shadow"}
+ )
+ @ConfigAccordionId(id = 0)
+ public int todoStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Todo Icons",
+ desc = "Add little item icons next to the lines in the todo overlay"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean todoIcons = true;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java new file mode 100644 index 00000000..d410d996 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java @@ -0,0 +1,45 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class NeuAuctionHouse {
+ @Expose
+ @ConfigOption(
+ name = "Enable NeuAH",
+ desc = "Turn on the NEU Auction House. \u00A7cWARNING: May negatively impact performance on low-end machines"
+ )
+ @ConfigEditorBoolean
+ public boolean enableNeuAuctionHouse = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Disable AH Scroll",
+ desc = "Disable scrolling using the scroll wheel inside NeuAH.\n" +
+ "This should be used if you want to be able to scroll through tooltips"
+ )
+ @ConfigEditorBoolean
+ public boolean disableAhScroll = false;
+
+ @Expose
+ @ConfigOption(
+ name = "AH Notification (Mins)",
+ desc = "Change the amount of time (in minutes) before the \"Ending Soon\" notification for an auction you have bid on"
+ )
+ @ConfigEditorSlider(
+ minValue = 1f,
+ maxValue = 10f,
+ minStep = 1f
+ )
+ public int ahNotification = 5;
+
+ @Expose
+ @ConfigOption(
+ name = "Price Filtering in NEU AH",
+ desc = "The ability to filter the price of items and their respective average BIN values"
+ )
+ @ConfigEditorBoolean
+ public boolean priceFiltering = false;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Notifications.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Notifications.java new file mode 100644 index 00000000..b6c12077 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Notifications.java @@ -0,0 +1,32 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class Notifications {
+ @Expose
+ @ConfigOption(
+ name = "Update Messages",
+ desc = "Give a notification in chat whenever a new version of NEU is released"
+ )
+ @ConfigEditorBoolean
+ public boolean showUpdateMsg = true;
+
+ @Expose
+ @ConfigOption(
+ name = "RAM Warning",
+ desc = "Warning when game starts with lots of RAM allocated\n"+
+ "\u00a7cBefore disabling this, please seriously read the message. If you complain about FPS issues without listening to the warning, that's your fault."
+ )
+ @ConfigEditorBoolean
+ public boolean doRamNotif = true;
+
+ /*@Expose
+ @ConfigOption(
+ name = "Wrong Pet",
+ desc = "Gives a notification in chat whenever you're using a pet that doesnt match the same xp you're gathering."
+ )
+ @ConfigEditorBoolean
+ public boolean showWrongPetMsg = false;*/
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java new file mode 100644 index 00000000..f37280fa --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java @@ -0,0 +1,74 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Position;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class PetOverlay {
+ @Expose
+ @ConfigOption(
+ name = "Enable Pet Info Overlay",
+ desc = "Shows current active pet and pet exp on screen."
+ )
+ @ConfigEditorBoolean
+ public boolean enablePetInfo = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Info Position",
+ desc = "The position of the pet info."
+ )
+ @ConfigEditorButton(
+ runnableId = 4,
+ buttonText = "Edit"
+ )
+ public Position petInfoPosition = new Position(-1, -1);
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Overlay Text",
+ desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
+ "\u00a7rEquip a pet to show the overlay"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a7a[Lvl 37] \u00a7fRock",
+ "\u00a7b2,312.9/2,700\u00a7e (85.7%)",
+ "\u00a7b2.3k/2.7k\u00a7e (85.7%)",
+ "\u00a7bXP/h: \u00a7e27,209",
+ "\u00a7bTotal XP: \u00a7e30,597.9",
+ "\u00a7bHeld Item: \u00a7fMining Exp Boost",
+ "\u00a7bUntil L38: \u00a7e5m13s",
+ "\u00a7bUntil L100: \u00a7e2d13h"}
+ )
+ public List<Integer> petOverlayText = new ArrayList<>(Arrays.asList(0, 2, 3, 6, 4));
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Overlay Icon",
+ desc = "Show the icon of the pet you have equiped in the overlay"
+ )
+ @ConfigEditorBoolean
+ public boolean petOverlayIcon = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Info Overlay Style",
+ desc = "Change the style of the Pet Info overlay"
+ )
+ @ConfigEditorDropdown(
+ values = {"Background", "No Shadow", "Shadow Only", "Full Shadow"}
+ )
+ public int petInfoOverlayStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Last Pet",
+ desc = "Show 2 pets on the overlay\nUseful if training two pets at once with autopet"
+ )
+ @ConfigEditorBoolean
+ public boolean dualPets = false;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java new file mode 100644 index 00000000..ba83fc0c --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java @@ -0,0 +1,58 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Position;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class SkillOverlays {
+ @Expose
+ @ConfigOption(
+ name = "Enable Farming Overlay",
+ desc = "Show an overlay while farming with useful information"
+ )
+ @ConfigEditorBoolean
+ public boolean farmingOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Farming Text",
+ desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
+ "\u00a7rHold a mathematical hoe or use an axe while gaining farming xp to show the overlay"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a7bCounter: \u00a7e37,547,860",
+ "\u00a7bCrops/m: \u00a7e38.29",
+ "\u00a7bFarm: \u00a7e12\u00a77 [\u00a7e|||||||||||||||||\u00a78||||||||\u00a77] \u00a7e67%",
+ "\u00a7bCurrent XP: \u00a7e6,734",
+ "\u00a7bRemaining XP: \u00a7e3,265",
+ "\u00a7bXP/h: \u00a7e238,129",
+ "\u00a7bYaw: \u00a7e68.25\u00a7l\u1D52",
+ "\u00a7bETA: 13h12m"}
+ )
+ public List<Integer> farmingText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 7, 6));
+
+ @Expose
+ @ConfigOption(
+ name = "Farming Position",
+ desc = "Change the position of the Farming overlay"
+ )
+ @ConfigEditorButton(
+ runnableId = 3,
+ buttonText = "Edit"
+ )
+ public Position farmingPosition = new Position(10, 200);
+
+ @Expose
+ @ConfigOption(
+ name = "Farming Style",
+ desc = "Change the style of the Farming overlay"
+ )
+ @ConfigEditorDropdown(
+ values = {"Background", "No Shadow", "Shadow", "Full Shadow"}
+ )
+ public int farmingStyle = 0;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java new file mode 100644 index 00000000..3da885a0 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java @@ -0,0 +1,71 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorKeybind;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+import org.lwjgl.input.Keyboard;
+
+public class SlotLocking {
+ @Expose
+ @ConfigOption(
+ name = "Enable Slot Locking",
+ desc = "Allows you to lock slots and create slot bindings"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSlotLocking = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Slot Binding",
+ desc = "Allows you to create slot bindings\nNote: \"Enable Slot Locking\" must be on"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSlotBinding = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Don't Drop Bound Slots",
+ desc = "Slot bindings also act as locked slots (prevents dropping / moving in inventory)"
+ )
+ @ConfigEditorBoolean
+ public boolean bindingAlsoLocks = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot Lock Key",
+ desc = "Click this key to LOCK a slot\n" +
+ "Hold this key and drag to BIND a slot"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_L)
+ public int slotLockKey = Keyboard.KEY_L;
+
+ @Expose
+ @ConfigOption(
+ name = "Lock Slots in Trade",
+ desc = "Prevents trading locked items in the custom trade windows"
+ )
+ @ConfigEditorBoolean
+ public boolean lockSlotsInTrade = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot Lock Sound",
+ desc = "Play a ding when locking/unlocking slots"
+ )
+ @ConfigEditorBoolean
+ public boolean slotLockSound = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot Lock Sound Vol.",
+ desc = "Set the volume of the ding sound"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 100,
+ minStep = 1
+ )
+ public float slotLockSoundVol = 20;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java new file mode 100644 index 00000000..07e4ef86 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java @@ -0,0 +1,242 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import org.lwjgl.input.Keyboard;
+
+public class StorageGUI {
+ @ConfigOption(
+ name = "Storage Overlay",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 1)
+ public boolean storageOverlayAccordion = false;
+
+ @Expose
+ public int selectedIndex = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Storage GUI",
+ desc = "Show a custom storage overlay when accessing /storage. " +
+ "Makes switching between pages much easier and also allows for searching through all storages"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean enableStorageGUI2 = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Storage Height",
+ desc = "Change the height of the storage preview section. Increasing this allows more storages to be seen at once"
+ )
+ @ConfigEditorSlider(
+ minValue = 104,
+ maxValue = 312,
+ minStep = 26
+ )
+ @ConfigAccordionId(id = 1)
+ public int storageHeight = 208;
+
+ @Expose
+ @ConfigOption(
+ name = "Storage Style",
+ desc = "Change the visual style of the overlay"
+ )
+ @ConfigEditorDropdown(
+ values = {"Transparent", "Minecraft", "Dark", "Custom"}
+ )
+ @ConfigAccordionId(id = 1)
+ public int displayStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Enderchest Preview",
+ desc = "Preview Enderchest pages when hovering over the selector on the left side"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean enderchestPreview = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Preview",
+ desc = "Preview Backpacks when hovering over the selector on the left side"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean backpackPreview = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Compact Vertically",
+ desc = "Remove the space between backpacks when there is a size discrepancy"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean masonryMode = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Fancy Glass Panes",
+ desc = "Replace the glass pane textures in your storage containers with a fancy connected texture"
+ )
+ @ConfigEditorDropdown(
+ values = {"On", "Locked", "Off"}
+ )
+ @ConfigAccordionId(id = 1)
+ public int fancyPanes = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Search Bar Autofocus",
+ desc = "Automatically focus the search bar when pressing keys"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean searchBarAutofocus = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Selected Storage Colour",
+ desc = "Change the colour used to draw the selected backpack border"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 1)
+ public String selectedStorageColour = "0:255:255:223:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Scrollable Tooltips",
+ desc = "Support for scrolling tooltips for users with small monitors\n" +
+ "This will prevent the menu from scrolling while holding the key, allowing you to scroll tooltips"
+ )
+ @ConfigEditorKeybind(defaultKey = 0)
+ @ConfigAccordionId(id = 1)
+ public int cancelScrollKey = 0;
+
+
+ @ConfigOption(
+ name = "Inventory Backpacks",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean inventorySlotAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Inventory Backpacks",
+ desc = "Add a \"10th slot\" to your inventory which allows you to quickly access your backpacks"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean showInvBackpack = false;
+
+ //public boolean showInvBackpack = false;
+ @Expose
+ @ConfigOption(
+ name = "Scroll to Backpack",
+ desc = "Allow scrolling to the backpack using the mouse wheel.\n" +
+ "\"Scroll (Key)\" = Allow scrolling to 10th slot only while 'Backpack Scroll Key' (default: SHIFT) is pressed"
+ )
+ @ConfigEditorDropdown(
+ values = {"Scroll (Key)", "Scroll (Always)", "Don't Scroll"}
+ )
+ @ConfigAccordionId(id = 0)
+ public int scrollToBackpack2 = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Side",
+ desc = "Set which side of the hotbar the backpack slot shows"
+ )
+ @ConfigEditorDropdown(
+ values = {"Left", "Right"}
+ )
+ @ConfigAccordionId(id = 0)
+ public int backpackHotbarSide = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Peeking",
+ desc = "When the backpack is selected, show it's contents on your screen"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean showInvBackpackPreview = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Opacity%",
+ desc = "Change the opacity of the backpack preview background"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 100,
+ minStep = 5
+ )
+ @ConfigAccordionId(id = 0)
+ public int backpackOpacity = 50;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Scroll Key",
+ desc = "Change the key which needs to be pressed in order to allow backpacks to be scrolled between"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_LSHIFT)
+ @ConfigAccordionId(id = 0)
+ public int backpackScrollKey = Keyboard.KEY_LSHIFT;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Hotkey",
+ desc = "Hotkey to quickly switch to the backpack slot"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_GRAVE)
+ @ConfigAccordionId(id = 0)
+ public int backpackHotkey = Keyboard.KEY_GRAVE;
+
+ @Expose
+ @ConfigOption(
+ name = "Arrow Key Backpacks",
+ desc = "Use arrow keys [LEFT],[RIGHT] to move between backpacks and [DOWN] to navigate backpack even when the slot is not selected. Keys are customizable below"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean arrowKeyBackpacks = false;
+
+ @ConfigOption(
+ name = "Arrow Key Backpack Keybinds",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 2)
+ @ConfigAccordionId(id = 0)
+ public boolean backpackArrowAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Left",
+ desc = "Select the backpack to the left"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_LEFT)
+ @ConfigAccordionId(id = 2)
+ public int arrowLeftKey = Keyboard.KEY_LEFT;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Right",
+ desc = "Select the backpack to the right"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_RIGHT)
+ @ConfigAccordionId(id = 2)
+ public int arrowRightKey = Keyboard.KEY_RIGHT;
+
+ @Expose
+ @ConfigOption(
+ name = "Backpack Open",
+ desc = "Open the selected backpack"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_DOWN)
+ @ConfigAccordionId(id = 2)
+ public int arrowDownKey = Keyboard.KEY_DOWN;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java new file mode 100644 index 00000000..3719e120 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java @@ -0,0 +1,64 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+public class Toolbar {
+ @Expose
+ @ConfigOption(
+ name = "Edit Toolbar Positions",
+ desc = "Edit the position of the QuickCommands / Search Bar"
+ )
+ @ConfigEditorButton(runnableId = 6, buttonText = "Edit")
+ public boolean positionButton = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Quick Commands",
+ desc = "Show QuickCommands\u2122 in the NEU toolbar"
+ )
+ @ConfigEditorBoolean
+ public boolean quickCommands = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Search Bar",
+ desc = "Show Itemlist search bar in the NEU toolbar"
+ )
+ @ConfigEditorBoolean
+ public boolean searchBar = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Search Bar Width",
+ desc = "Change the width of the search bar"
+ )
+ @ConfigEditorSlider(
+ minValue = 50f,
+ maxValue = 300f,
+ minStep = 10f
+ )
+ public int searchBarWidth = 200;
+
+ @Expose
+ @ConfigOption(
+ name = "Search Bar Height",
+ desc = "Change the height of the search bar"
+ )
+ @ConfigEditorSlider(
+ minValue = 15f,
+ maxValue = 50f,
+ minStep = 1f
+ )
+ public int searchBarHeight = 40;
+
+ @Expose
+ @ConfigOption(
+ name = "Quick Commands Click Type",
+ desc = "Change the click type needed to trigger quick commands"
+ )
+ @ConfigEditorDropdown(
+ values = {"Mouse Up", "Mouse Down"}
+ )
+ public int quickCommandsClickType = 0;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java new file mode 100644 index 00000000..e1b9780a --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java @@ -0,0 +1,90 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class TooltipTweaks {
+ @ConfigOption(
+ name = "Tooltip Price Information",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean priceInfoAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Price Info (Auc)",
+ desc = "\u00a7rSelect what price information you would like to see on auctionable item tooltips\n" +
+ "\u00a7eDrag text to rearrange"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a7eLowest BIN",
+ "\u00a7eAH Price",
+ "\u00a7eAH Sales",
+ "\u00a7eRaw Craft Cost",
+ "\u00a7eAVG Lowest BIN",
+ "\u00a7eDungeon Costs"}
+ )
+ @ConfigAccordionId(id = 0)
+ public List<Integer> priceInfoAuc = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 5));
+
+ @Expose
+ @ConfigOption(
+ name = "Price Info (Baz)",
+ desc = "\u00a7rSelect what price information you would like to see on bazaar item tooltips\n" +
+ "\u00a7eDrag text to rearrange"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a7eBuy", "\u00a7eSell", "\u00a7eBuy (Insta)", "\u00a7eSell (Insta)", "\u00a7eRaw Craft Cost"}
+ )
+ @ConfigAccordionId(id = 0)
+ public List<Integer> priceInfoBaz = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4));
+
+ @Expose
+ @ConfigOption(
+ name = "Price Info (Inv)",
+ desc = "Show price information for items in your inventory"
+ )
+ @ConfigEditorBoolean
+ public boolean showPriceInfoInvItem = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Price Info (AH)",
+ desc = "Show price information for auctioned items"
+ )
+ @ConfigEditorBoolean
+ public boolean showPriceInfoAucItem = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Missing Enchant List",
+ desc = "Show which enchants are missing on an item when pressing LSHIFT"
+ )
+ @ConfigEditorBoolean
+ public boolean missingEnchantList = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Tooltip Border Colours",
+ desc = "Make the borders of tooltips match the rarity of the item (NEU Tooltips Only)"
+ )
+ @ConfigEditorBoolean
+ public boolean tooltipBorderColours = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Tooltip Border Opacity",
+ desc = "Change the opacity of the rarity highlight (NEU Tooltips Only)"
+ )
+ @ConfigEditorSlider(
+ minValue = 0f,
+ maxValue = 255f,
+ minStep = 1f
+ )
+ public int tooltipBorderOpacity = 200;
+}
\ No newline at end of file diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TradeMenu.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TradeMenu.java new file mode 100644 index 00000000..930316be --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TradeMenu.java @@ -0,0 +1,27 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class TradeMenu {
+ @Expose
+ @ConfigOption(
+ name = "Enable Custom Trade Menu",
+ desc = "When trading with other players in skyblock, display a special GUI designed to prevent scamming"
+ )
+ @ConfigEditorBoolean
+ public boolean enableCustomTrade = true;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Price Information",
+ desc = "Show the price of items in the trade window on both sides"
+ )
+ @ConfigEditorBoolean
+ public boolean customTradePrices = true;
+
+ @Expose
+ public boolean customTradePriceStyle = true;
+}
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 f9853cb1..6ce5bb8c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -157,13 +157,14 @@ public class MiningOverlay extends TextOverlay { if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) return; if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("mining_3")) return; + if(!SBInfo.getInstance().getLocation().equals("mining_3") && !SBInfo.getInstance().getLocation().equals("crystal_hollows")) return; overlayStrings = new ArrayList<>(); commissionProgress.clear(); List<String> forgeStrings = new ArrayList<>(); List<String> forgeStringsEmpty = new ArrayList<>(); String mithrilPowder = null; + String gemstonePowder = null; boolean commissions = false; boolean forges = false; @@ -173,6 +174,9 @@ public class MiningOverlay extends TextOverlay { if(name.contains("Mithril Powder:")) { mithrilPowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); } + if(name.contains("Gemstone Powder:")) { + gemstonePowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); + } if(name.equals(RESET.toString()+BLUE+BOLD+"Forges"+RESET)) { commissions = false; forges = true; @@ -268,10 +272,12 @@ public class MiningOverlay extends TextOverlay { case 1: overlayStrings.add(mithrilPowder); break; case 2: - overlayStrings.addAll(forgeStrings); break; + overlayStrings.add(gemstonePowder); break; case 3: - overlayStrings.addAll(forgeStringsEmpty); break; + overlayStrings.addAll(forgeStrings); break; case 4: + overlayStrings.addAll(forgeStringsEmpty); break; + case 5: overlayStrings.add(pickaxeCooldown); break; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 64b27351..357815b7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -2,7 +2,6 @@ package io.github.moulberry.notenoughupdates.overlays; import com.google.common.collect.Lists; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay; import java.util.ArrayList; @@ -36,7 +35,7 @@ public class OverlayManager { "\u00a73Experiments: \u00a7e3h38m"); textOverlays.add(timersOverlay = new TimersOverlay(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoPosition, () -> { List<String> strings = new ArrayList<>(); - for(int i : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText) { + for(int i : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) { if(i >= 0 && i < todoDummy.size()) strings.add(todoDummy.get(i)); } return strings; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java index 0b6d1740..e9338f94 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -1,7 +1,5 @@ package io.github.moulberry.notenoughupdates.overlays; -import com.google.common.collect.ComparisonChain; -import com.google.common.collect.Ordering; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.options.NEUConfig; @@ -9,22 +7,20 @@ import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.world.WorldSettings; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.util.vector.Vector2f; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.util.*; import java.util.function.Supplier; import java.util.regex.Matcher; @@ -34,7 +30,7 @@ import static net.minecraft.util.EnumChatFormatting.*; public class TimersOverlay extends TextOverlay { - private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile("\u00a77You have \u00a7r\u00a7e(\\d+) \u00a7r\u00a77active effects."); + private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile("\u00a7r\u00a7r\u00a77You have a \u00a7r\u00a7cGod Potion \u00a7r\u00a77active! \u00a7r\u00a7d([0-9]*?:?[0-9]*?:?[0-9]*)\u00a7r"); public TimersOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { super(position, dummyStrings, styleSupplier); @@ -44,8 +40,7 @@ public class TimersOverlay extends TextOverlay { private static final Pattern PUZZLER_PATTERN = Pattern.compile("\u00a7r\u00a7dPuzzler\u00a7r\u00a76 gave you .+ \u00a7r\u00a76for solving the puzzle!\u00a7r"); private static final Pattern FETCHUR_PATTERN = Pattern.compile("\u00a7e\\[NPC] Fetchur\u00a7f: \u00a7rthanks thats probably what i needed\u00a7r"); private static final Pattern FETCHUR2_PATTERN = Pattern.compile("\u00a7e\\[NPC] Fetchur\u00a7f: \u00a7rcome back another time, maybe tmrw\u00a7r"); - private static final Pattern GODPOT_PATTERN = Pattern.compile("\u00a7r\u00a7a\u00a7lGULP! \u00a7r\u00a7eThe \u00a7r\u00a7cGod Potion \u00a7r\u00a7egrants you" + - " powers for \u00a7r\u00a7924 hours\u00a7r\u00a7e!\u00a7r"); + private boolean hideGodpot = false; @@ -81,11 +76,7 @@ public class TimersOverlay extends TextOverlay { return; } - Matcher godpotMatcher = GODPOT_PATTERN.matcher(event.message.getFormattedText()); - if(godpotMatcher.matches()) { - hidden.godPotionDrunk = currentTime; - return; - } + } } @@ -136,7 +127,9 @@ public class TimersOverlay extends TextOverlay { } long currentTime = System.currentTimeMillis(); - long fetchurIndex = (currentTime-18000000)/86400000 % 13 - 4; + ZonedDateTime currentTimeEST = ZonedDateTime.now(ZoneId.of("America/Atikokan")); + + long fetchurIndex = (currentTimeEST.getDayOfMonth() % 13)-1; if(fetchurIndex < 0) fetchurIndex += 13; icon = FETCHUR_ICONS[(int)fetchurIndex]; @@ -162,43 +155,40 @@ public class TimersOverlay extends TextOverlay { @Override public void update() { - if(true) { - overlayStrings = null; - return; - } + long currentTime = System.currentTimeMillis(); NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); - if(hidden == null) return; + if (hidden == null) return; - if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest container = (ContainerChest) chest.inventorySlots; IInventory lower = container.getLowerChestInventory(); String containerName = lower.getDisplayName().getUnformattedText(); - if(containerName.equals("Commissions") && lower.getSizeInventory() >= 18) { - if(hidden.commissionsCompleted == 0) { + if (containerName.equals("Commissions") && lower.getSizeInventory() >= 18) { + if (hidden.commissionsCompleted == 0) { hidden.commissionsCompleted = currentTime; } - for(int i=9; i<18; i++) { + for (int i = 9; i < 18; i++) { ItemStack stack = lower.getStackInSlot(i); - if(stack != null && stack.hasTagCompound()) { + if (stack != null && stack.hasTagCompound()) { String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); - for(String line : lore) { - if(line.contains("(Daily")) { + for (String line : lore) { + if (line.contains("(Daily")) { hidden.commissionsCompleted = 0; break; } } } } - } else if(containerName.equals("Experimentation Table") && lower.getSizeInventory() >= 36) { + } else if (containerName.equals("Experimentation Table") && lower.getSizeInventory() >= 36) { ItemStack stack = lower.getStackInSlot(31); - if(stack != null) { - if(stack.getItem() == Items.blaze_powder) { - if(hidden.experimentsCompleted == 0) { + if (stack != null) { + if (stack.getItem() == Items.blaze_powder) { + if (hidden.experimentsCompleted == 0) { hidden.experimentsCompleted = currentTime; } } else { @@ -209,44 +199,76 @@ public class TimersOverlay extends TextOverlay { } boolean foundCookieBuffText = false; - if(SBInfo.getInstance().getLocation() != null && !SBInfo.getInstance().getLocation().equals("dungeon") && SBInfo.getInstance().footer != null) { + boolean foundGodPotText = false; + if (SBInfo.getInstance().getLocation() != null && !SBInfo.getInstance().getLocation().equals("dungeon") && SBInfo.getInstance().footer != null) { String formatted = SBInfo.getInstance().footer.getFormattedText(); - for(String line : formatted.split("\n")) { + for (String line : formatted.split("\n")) { Matcher activeEffectsMatcher = PATTERN_ACTIVE_EFFECTS.matcher(line); - if(activeEffectsMatcher.find()) { - String numEffectsS = activeEffectsMatcher.group(1); + if (activeEffectsMatcher.matches()) { + foundGodPotText = true; + String[] godpotRemaingTimeUnformatted = activeEffectsMatcher.group(1).split(":"); + long godPotDuration = 0; try { - int numEffects = Integer.parseInt(numEffectsS); - hideGodpot = numEffects > 25; - } catch(NumberFormatException ignored) {} - } else if(line.contains("\u00a7d\u00a7lCookie Buff")) { + int i = 0; + if (godpotRemaingTimeUnformatted.length == 4) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 24 * 60 * 60 * 1000; + i++; + } + if (godpotRemaingTimeUnformatted.length >= 3) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 60 * 60 * 1000; + i++; + } + if (godpotRemaingTimeUnformatted.length >= 2) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 60 * 1000; + i++; + } + if (godpotRemaingTimeUnformatted.length >= 1) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 1000; + + } + } catch (Exception ignored) { + } + + hidden.godPotionDuration = godPotDuration; + + } else if (line.contains("\u00a7d\u00a7lCookie Buff")) { foundCookieBuffText = true; - } else if(foundCookieBuffText) { + } else if (foundCookieBuffText) { String cleanNoSpace = line.replaceAll("(\u00a7.| )", ""); hidden.cookieBuffRemaining = 0; StringBuilder number = new StringBuilder(); - for(int i=0; i<cleanNoSpace.length(); i++) { + for (int i = 0; i < cleanNoSpace.length(); i++) { char c = cleanNoSpace.charAt(i); - if(c >= '0' && c <= '9') { + if (c >= '0' && c <= '9') { number.append(c); } else { - if(number.length() == 0) { + if (number.length() == 0) { hidden.cookieBuffRemaining = 0; break; } - if("ydhms".contains(""+c)) { + if ("ydhms".contains("" + c)) { try { long val = Integer.parseInt(number.toString()); - switch(c) { - case 'y': hidden.cookieBuffRemaining += val*365*24*60*60*1000; break; - case 'd': hidden.cookieBuffRemaining += val*24*60*60*1000; break; - case 'h': hidden.cookieBuffRemaining += val*60*60*1000; break; - case 'm': hidden.cookieBuffRemaining += val*60*1000; break; - case 's': hidden.cookieBuffRemaining += val*1000; break; + switch (c) { + case 'y': + hidden.cookieBuffRemaining += val * 365 * 24 * 60 * 60 * 1000; + break; + case 'd': + hidden.cookieBuffRemaining += val * 24 * 60 * 60 * 1000; + break; + case 'h': + hidden.cookieBuffRemaining += val * 60 * 60 * 1000; + break; + case 'm': + hidden.cookieBuffRemaining += val * 60 * 1000; + break; + case 's': + hidden.cookieBuffRemaining += val * 1000; + break; } - } catch(NumberFormatException e) { + } catch (NumberFormatException e) { hidden.cookieBuffRemaining = 0; break; } @@ -264,71 +286,145 @@ public class TimersOverlay extends TextOverlay { } } - if(!NotEnoughUpdates.INSTANCE.config.miscOverlays.todoOverlay) { + if (!foundGodPotText) { + hidden.godPotionDuration = 0; + } + + + if (!NotEnoughUpdates.INSTANCE.config.miscOverlays.todoOverlay) { overlayStrings = null; return; } HashMap<Integer, String> map = new HashMap<>(); - long cakeEnd = hidden.firstCakeAte + 1000*60*60*48 - currentTime; - if(cakeEnd < 0) { - map.put(0, DARK_AQUA+"Cakes: "+YELLOW+"Inactive!"); - map.put(0+7, DARK_AQUA+"Cakes: "+YELLOW+"Inactive!"); - } else { - map.put(0+7, DARK_AQUA+"Cakes: "+YELLOW+Utils.prettyTime(cakeEnd)); + long cakeEnd = hidden.firstCakeAte + 1000 * 60 * 60 * 48 - currentTime; + + //Cake Display + if (cakeEnd <= 0) { + map.put(0, DARK_AQUA + "Cakes: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.goneColour] + "Inactive!"); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + cakeEnd < TimeEnums.HOUR.time) { + map.put(0, DARK_AQUA + "Cakes: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] + Utils.prettyTime(cakeEnd)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.SOON.ordinal() && + cakeEnd < TimeEnums.HALFDAY.time) { + map.put(0, DARK_AQUA + "Cakes: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] + Utils.prettyTime(cakeEnd)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + cakeEnd < TimeEnums.DAY.time) { + map.put(0, DARK_AQUA + "Cakes: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] + Utils.prettyTime(cakeEnd)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.ALWAYS.ordinal()) { + map.put(0, DARK_AQUA + "Cakes: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + Utils.prettyTime(cakeEnd)); } - if(hidden.cookieBuffRemaining <= 0) { - map.put(1, DARK_AQUA+"Cookie Buff: "+YELLOW+"Inactive!"); - map.put(1+7, DARK_AQUA+"Cookie Buff: "+YELLOW+"Inactive!"); - } else { - map.put(1+7, DARK_AQUA+"Cookie Buff: "+YELLOW+Utils.prettyTime(hidden.cookieBuffRemaining)); + //CookieBuff Display + if (hidden.cookieBuffRemaining <= 0) { + map.put(1, DARK_AQUA + "Cookie Buff: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.goneColour] + "Inactive!"); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + hidden.cookieBuffRemaining < TimeEnums.HOUR.time) { + map.put(1, DARK_AQUA + "Cookie Buff: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] + Utils.prettyTime(hidden.cookieBuffRemaining)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.SOON.ordinal() && + hidden.cookieBuffRemaining < TimeEnums.HALFDAY.time) { + map.put(1, DARK_AQUA + "Cookie Buff: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] + Utils.prettyTime(hidden.cookieBuffRemaining)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + hidden.cookieBuffRemaining < TimeEnums.DAY.time) { + map.put(1, DARK_AQUA + "Cookie Buff: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] + Utils.prettyTime(hidden.cookieBuffRemaining)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.ALWAYS.ordinal()) { + map.put(1, DARK_AQUA + "Cookie Buff: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + Utils.prettyTime(hidden.cookieBuffRemaining)); } - long godpotEnd = hidden.godPotionDrunk + 1000*60*60*24 - currentTime; - if(godpotEnd < 0) { - if(!hideGodpot) { - map.put(2, DARK_AQUA+"Godpot: "+YELLOW+"Inactive!"); - map.put(2+7, DARK_AQUA+"Godpot: "+YELLOW+"Inactive!"); + + long godpotEnd = hidden.godPotionDuration; + //Godpot Display + //do not display in dungeons due to dungeons not having + if (!(SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("dungeon"))){ + if (hidden.godPotionDuration <= 0) { + map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.goneColour] + "Inactive!"); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + hidden.godPotionDuration < TimeEnums.HOUR.time) { + map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] + Utils.prettyTime(hidden.godPotionDuration)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.SOON.ordinal() && + hidden.godPotionDuration < TimeEnums.HALFDAY.time) { + map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] + Utils.prettyTime(hidden.godPotionDuration)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + hidden.godPotionDuration < TimeEnums.DAY.time) { + map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] + Utils.prettyTime(hidden.godPotionDuration)); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.ALWAYS.ordinal()) { + map.put(2, DARK_AQUA + "Godpotf: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + Utils.prettyTime(hidden.godPotionDuration)); } - } else { - map.put(2+7, DARK_AQUA+"Godpot: "+YELLOW+Utils.prettyTime(godpotEnd)); - } + } long puzzlerEnd = hidden.puzzlerCompleted + 1000*60*60*24 - currentTime; - if(puzzlerEnd < 0) { - map.put(3, DARK_AQUA+"Puzzler: "+YELLOW+"Ready!"); - map.put(3+7, DARK_AQUA+"Puzzler: "+YELLOW+"Ready!"); - } else { - map.put(3+7, DARK_AQUA+"Puzzler: "+YELLOW+Utils.prettyTime(puzzlerEnd)); + //Puzzler Display + if((hidden.puzzlerCompleted + TimeEnums.DAY.time) < currentTime) { + map.put(3, DARK_AQUA+"Puzzler: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (hidden.puzzlerCompleted + (TimeEnums.DAY.time - TimeEnums.HALFANHOUR.time)) < currentTime){ + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(puzzlerEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.SOON.ordinal() && + (hidden.puzzlerCompleted + (TimeEnums.DAY.time - TimeEnums.HOUR.time)) < currentTime){ + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(puzzlerEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (hidden.puzzlerCompleted + (TimeEnums.DAY.time - (TimeEnums.HOUR.time)*3)) < currentTime) { + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(puzzlerEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(puzzlerEnd)); } long midnightReset = (currentTime-18000000)/86400000*86400000+18000000; long fetchurComplete = hidden.fetchurCompleted; + + long timeDiffMidnightNow = midnightReset + 86400000 - currentTime; + + //Fetchur Display if(fetchurComplete < midnightReset) { - map.put(4, DARK_AQUA+"Fetchur: "+YELLOW+"Ready!"); - map.put(4+7, DARK_AQUA+"Fetchur: "+YELLOW+"Ready!"); - } else { - map.put(4+7, DARK_AQUA+"Fetchur: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(4, DARK_AQUA+"Fetchur: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (fetchurComplete < (midnightReset-TimeEnums.HALFANHOUR.time))){ + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.SOON.ordinal() && + (fetchurComplete < (midnightReset-TimeEnums.HOUR.time))){ + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (fetchurComplete < (midnightReset-(TimeEnums.HOUR.time*3)))) { + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(timeDiffMidnightNow)); } + //Commissions Display if(hidden.commissionsCompleted < midnightReset) { - map.put(5, DARK_AQUA+"Commissions: "+YELLOW+"Ready!"); - map.put(5+7, DARK_AQUA+"Commissions: "+YELLOW+"Ready!"); - } else { - map.put(5+7, DARK_AQUA+"Commissions: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(5, DARK_AQUA+"Commissions: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (hidden.commissionsCompleted < (midnightReset-TimeEnums.HALFANHOUR.time))){ + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.SOON.ordinal() && + (hidden.commissionsCompleted < (midnightReset-TimeEnums.HOUR.time))){ + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (hidden.commissionsCompleted < (midnightReset-(TimeEnums.HOUR.time*3)))) { + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(timeDiffMidnightNow)); } + //Experiment Display if(hidden.experimentsCompleted < midnightReset) { - map.put(6, DARK_AQUA+"Experiments: "+YELLOW+"Ready!"); - map.put(6+7, DARK_AQUA+"Experiments: "+YELLOW+"Ready!"); - } else { - map.put(6+7, DARK_AQUA+"Experiments: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(6, DARK_AQUA+"Experiments: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (hidden.experimentsCompleted < (midnightReset-TimeEnums.HALFANHOUR.time))){ + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.SOON.ordinal() && + (hidden.experimentsCompleted < (midnightReset-TimeEnums.HOUR.time))){ + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (hidden.experimentsCompleted < (midnightReset-(TimeEnums.HOUR.time*3)))) { + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(timeDiffMidnightNow)); } overlayStrings = new ArrayList<>(); - for(int index : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText) { + for(int index : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) { if(map.containsKey(index)) { overlayStrings.add(map.get(index)); } @@ -336,4 +432,28 @@ public class TimersOverlay extends TextOverlay { if(overlayStrings.isEmpty()) overlayStrings = null; } + + private enum TimeEnums { + DAY (86400000), + HALFDAY(43200000), + HOUR(3600000), + HALFANHOUR(1800000); + + TimeEnums(long time) { + this.time = time; + } + + public final long time; + } + + private enum DISPLAYTYPE { + NOW, + VERYSOON, + SOON, + KINDASOON, + ALWAYS, + + } + } + diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index 3fe7d9d3..acd1f99d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1,2926 +1,2979 @@ -package io.github.moulberry.notenoughupdates.profileviewer; - -import com.google.common.base.Splitter; -import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager; -import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; -import io.github.moulberry.notenoughupdates.util.SBInfo; -import io.github.moulberry.notenoughupdates.util.Constants; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.*; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.DefaultPlayerSkin; -import net.minecraft.client.resources.SkinManager; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.client.shader.Shader; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EnumPlayerModelParts; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.*; -import net.minecraft.util.*; -import org.apache.commons.lang3.text.WordUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; -import org.lwjgl.opengl.GL20; - -import java.awt.*; -import java.io.IOException; -import java.text.NumberFormat; -import java.util.*; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class GuiProfileViewer extends GuiScreen { - - private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png"); - public static final ResourceLocation pv_basic = new ResourceLocation("notenoughupdates:pv_basic.png"); - public static final ResourceLocation pv_dung = new ResourceLocation("notenoughupdates:pv_dung.png"); - public static final ResourceLocation pv_extra = new ResourceLocation("notenoughupdates:pv_extra.png"); - public static final ResourceLocation pv_invs = new ResourceLocation("notenoughupdates:pv_invs.png"); - public static final ResourceLocation pv_cols = new ResourceLocation("notenoughupdates:pv_cols.png"); - public static final ResourceLocation pv_pets = new ResourceLocation("notenoughupdates:pv_pets.png"); - public static final ResourceLocation pv_dropdown = new ResourceLocation("notenoughupdates:pv_dropdown.png"); - public static final ResourceLocation pv_bg = new ResourceLocation("notenoughupdates:pv_bg.png"); - public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png"); - public static final ResourceLocation resource_packs = new ResourceLocation("minecraft:textures/gui/resource_packs.png"); - public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); - - private static final NumberFormat numberFormat = NumberFormat.getInstance(Locale.US); - - private final ProfileViewer.Profile profile; - public static ProfileViewerPage currentPage = ProfileViewerPage.BASIC; - private int sizeX; - private int sizeY; - private int guiLeft; - private int guiTop; - - private float backgroundRotation = 0; - - private long currentTime = 0; - private long lastTime = 0; - private long startTime = 0; - - private List<String> tooltipToDisplay = null; - - private String profileId = null; - private boolean profileDropdownSelected = false; - - public enum ProfileViewerPage { - LOADING(null), - INVALID_NAME(null), - NO_SKYBLOCK(null), - BASIC(new ItemStack(Items.paper)), - DUNG(new ItemStack(Item.getItemFromBlock(Blocks.deadbush))), - EXTRA(new ItemStack(Items.book)), - INVS(new ItemStack(Item.getItemFromBlock(Blocks.ender_chest))), - COLS(new ItemStack(Items.painting)), - PETS(new ItemStack(Items.bone)); - - public final ItemStack stack; - - ProfileViewerPage(ItemStack stack) { - this.stack = stack; - } - } - - public GuiProfileViewer(ProfileViewer.Profile profile) { - this.profile = profile; - String name = ""; - if(profile != null && profile.getHypixelProfile() != null) { - name = profile.getHypixelProfile().get("displayname").getAsString(); - } - playerNameTextField = new GuiElementTextField(name, - GuiElementTextField.SCALE_TEXT); - playerNameTextField.setSize(100, 20); - - if(currentPage == ProfileViewerPage.LOADING) { - currentPage = ProfileViewerPage.BASIC; - } - } - - private GuiElementTextField playerNameTextField; - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - currentTime = System.currentTimeMillis(); - if(startTime == 0) startTime = currentTime; - - ProfileViewerPage page = currentPage; - if(profile == null) { - page = ProfileViewerPage.INVALID_NAME; - } else if(profile.getPlayerInformation(null) == null) { - page = ProfileViewerPage.LOADING; - } else if(profile.getLatestProfile() == null) { - page = ProfileViewerPage.NO_SKYBLOCK; - } - - if(profileId == null && profile != null && profile.getLatestProfile() != null) { - profileId = profile.getLatestProfile(); - } - - this.sizeX = 431; - this.sizeY = 202; - this.guiLeft = (this.width-this.sizeX)/2; - this.guiTop = (this.height-this.sizeY)/2; - - super.drawScreen(mouseX, mouseY, partialTicks); - drawDefaultBackground(); - - blurBackground(); - renderBlurredBackground(width, height, guiLeft+2, guiTop+2, sizeX-4, sizeY-4); - - GlStateManager.enableDepth(); - GlStateManager.translate(0, 0, 5); - renderTabs(true); - GlStateManager.translate(0, 0, -3); - - GlStateManager.disableDepth(); - GlStateManager.translate(0, 0, -2); - renderTabs(false); - GlStateManager.translate(0, 0, 2); - - GlStateManager.disableLighting(); - GlStateManager.enableDepth(); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_bg); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - - if(!(page == ProfileViewerPage.LOADING)) { - playerNameTextField.render(guiLeft+sizeX-100, guiTop+sizeY+5); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - - if(profile != null) { - renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+3+2, 100-4, 20-4); - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); - Utils.drawTexturedRect(guiLeft, guiTop+sizeY+3, 100, 20, - 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST); - Utils.drawStringCenteredScaledMaxWidth(profileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, - guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB()); - - if(profileDropdownSelected && !profile.getProfileIds().isEmpty() && scaledResolution.getScaleFactor() != 4) { - int dropdownOptionSize = scaledResolution.getScaleFactor()==3?10:20; - - int numProfiles = profile.getProfileIds().size(); - int sizeYDropdown = numProfiles*dropdownOptionSize; - renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+23, 100-4, sizeYDropdown-2); - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); - Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23-3, 100, 3, - 100/200f, 1, 0, 3/185f, GL11.GL_NEAREST); - Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23+sizeYDropdown-4, 100, 4, - 100/200f, 1, 181/185f, 1, GL11.GL_NEAREST); - Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23, 100, sizeYDropdown-4, - 100/200f, 1, (181-sizeYDropdown)/185f, 181/185f, GL11.GL_NEAREST); - - for(int yIndex = 0; yIndex<profile.getProfileIds().size(); yIndex++) { - String otherProfileId = profile.getProfileIds().get(yIndex); - Utils.drawStringCenteredScaledMaxWidth(otherProfileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, - guiTop+sizeY+23+dropdownOptionSize/2f+dropdownOptionSize*yIndex, true, 90, new Color(33, 112, 104, 255).getRGB()); - } - - } - } - } - - GlStateManager.color(1, 1, 1, 1); - switch (page) { - case BASIC: - drawBasicPage(mouseX, mouseY, partialTicks); - break; - case DUNG: - drawDungPage(mouseX, mouseY, partialTicks); - break; - case EXTRA: - drawExtraPage(mouseX, mouseY, partialTicks); - break; - case INVS: - drawInvsPage(mouseX, mouseY, partialTicks); - break; - case COLS: - drawColsPage(mouseX, mouseY, partialTicks); - break; - case PETS: - drawPetsPage(mouseX, mouseY, partialTicks); - break; - case LOADING: - String str = EnumChatFormatting.YELLOW+"Loading player profiles."; - long currentTimeMod = System.currentTimeMillis() % 1000; - if(currentTimeMod > 333) { - if(currentTimeMod < 666) { - str += "."; - } else { - str += ".."; - } - } - - Utils.drawStringCentered(str, Minecraft.getMinecraft().fontRendererObj, - guiLeft+sizeX/2f, guiTop+101, true, 0); - break; - case INVALID_NAME: - Utils.drawStringCentered(EnumChatFormatting.RED+"Invalid name or API is down!", Minecraft.getMinecraft().fontRendererObj, - guiLeft+sizeX/2f, guiTop+101, true, 0); - break; - case NO_SKYBLOCK: - Utils.drawStringCentered(EnumChatFormatting.RED+"No skyblock data found!", Minecraft.getMinecraft().fontRendererObj, - guiLeft+sizeX/2f, guiTop+101, true, 0); - break; - } - - lastTime = currentTime; - - if(tooltipToDisplay != null) { - List<String> grayTooltip = new ArrayList<>(tooltipToDisplay.size()); - for(String line : tooltipToDisplay) { - grayTooltip.add(EnumChatFormatting.GRAY + line); - } - Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); - tooltipToDisplay = null; - } - } - - private void renderTabs(boolean renderPressed) { - int ignoredTabs = 0; - for(int i=0; i<ProfileViewerPage.values().length; i++) { - ProfileViewerPage page = ProfileViewerPage.values()[i]; - if(page.stack == null) { - ignoredTabs++; - continue; - } - boolean pressed = page == currentPage; - if(pressed == renderPressed) { - renderTab(page.stack, i-ignoredTabs, pressed); - } - } - } - - private void renderTab(ItemStack stack, int xIndex, boolean pressed) { - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - - int x = guiLeft+xIndex*28; - int y = guiTop-28; - - float uMin = 0; - float uMax = 28/256f; - float vMin = 20/256f; - float vMax = 51/256f; - if(pressed) { - vMin = 52/256f; - vMax = 84/256f; - - if(xIndex != 0) { - uMin = 28/256f; - uMax = 56/256f; - } - - renderBlurredBackground(width, height, x+2, y+2, 28-4, 28-4); - } else { - renderBlurredBackground(width, height, x+2, y+4, 28-4, 28-4); - } - - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - Utils.drawTexturedRect(x, y, 28, pressed?32:31, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); - - GlStateManager.enableDepth(); - Utils.drawItemStack(stack, x+6, y+9); - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - if(currentPage != ProfileViewerPage.LOADING && currentPage != ProfileViewerPage.INVALID_NAME) { - int ignoredTabs = 0; - for(int i=0; i<ProfileViewerPage.values().length; i++) { - ProfileViewerPage page = ProfileViewerPage.values()[i]; - if(page.stack == null) { - ignoredTabs++; - continue; - } - int i2 = i - ignoredTabs; - int x = guiLeft+i2*28; - int y = guiTop-28; - - if(mouseX > x && mouseX < x+28) { - if(mouseY > y && mouseY < y+32) { - if(currentPage != page) Utils.playPressSound(); - currentPage = page; - inventoryTextField.otherComponentClick(); - playerNameTextField.otherComponentClick(); - return; - } - } - } - } - switch (currentPage) { - case DUNG: - mouseClickedDung(mouseX, mouseY, mouseButton); - break; - case INVS: - inventoryTextField.setSize(88, 20); - if(mouseX > guiLeft+19 && mouseX < guiLeft+19+88) { - if(mouseY > guiTop+sizeY-26-20 && mouseY < guiTop+sizeY-26) { - inventoryTextField.mouseClicked(mouseX, mouseY, mouseButton); - playerNameTextField.otherComponentClick(); - return; - } - } - break; - case PETS: - if(sortedPets == null) break; - for(int i=petsPage*20; i<Math.min(petsPage*20+20, sortedPets.size()); i++) { - int xIndex = (i%20) % COLLS_XCOUNT; - int yIndex = (i%20) / COLLS_XCOUNT; - - float x = 5 + COLLS_XPADDING + (COLLS_XPADDING + 20) * xIndex; - float y = 7 + COLLS_YPADDING + (COLLS_YPADDING + 20) * yIndex; - - if(mouseX > guiLeft+x && mouseX < guiLeft+x+20) { - if(mouseY > guiTop+y && mouseY < guiTop+y+20) { - selectedPet = i; - return; - } - } - } - break; - } - if(mouseX > guiLeft+sizeX-100 && mouseX < guiLeft+sizeX) { - if(mouseY > guiTop+sizeY+5 && mouseY < guiTop+sizeY+25) { - playerNameTextField.mouseClicked(mouseX, mouseY, mouseButton); - inventoryTextField.otherComponentClick(); - return; - } - } - if(mouseX > guiLeft && mouseX < guiLeft+100 && profile != null && !profile.getProfileIds().isEmpty()) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - if(mouseY > guiTop+sizeY+3 && mouseY < guiTop+sizeY+23) { - if(scaledResolution.getScaleFactor() == 4) { - profileDropdownSelected = false; - int profileNum = 0; - for(int index = 0; index<profile.getProfileIds().size(); index++) { - if(profile.getProfileIds().get(index).equals(profileId)) { - profileNum = index; - break; - } - } - if(mouseButton == 0) { - profileNum++; - } else { - profileNum--; - } - if(profileNum >= profile.getProfileIds().size()) profileNum = 0; - if(profileNum < 0) profileNum = profile.getProfileIds().size()-1; - - String newProfileId = profile.getProfileIds().get(profileNum); - if(profileId != null && !profileId.equals(newProfileId)) { - resetCache(); - } - profileId = newProfileId; - } else { - profileDropdownSelected = !profileDropdownSelected; - } - } else if(scaledResolution.getScaleFactor() != 4 && profileDropdownSelected) { - int dropdownOptionSize = scaledResolution.getScaleFactor()==3?10:20; - int extraY = mouseY - (guiTop+sizeY+23); - int index = extraY/dropdownOptionSize; - if(index >= 0 && index < profile.getProfileIds().size()) { - String newProfileId = profile.getProfileIds().get(index); - if(profileId != null && !profileId.equals(newProfileId)) { - resetCache(); - } - profileId = newProfileId; - } - } - playerNameTextField.otherComponentClick(); - inventoryTextField.otherComponentClick(); - return; - } - profileDropdownSelected = false; - playerNameTextField.otherComponentClick(); - inventoryTextField.otherComponentClick(); - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - switch (currentPage) { - case INVS: - keyTypedInvs(typedChar, keyCode); - inventoryTextField.keyTyped(typedChar, keyCode); - break; - case COLS: - keyTypedCols(typedChar, keyCode); - break; - case DUNG: - keyTypedDung(typedChar, keyCode); - break; - } - if(playerNameTextField.getFocus() && !(currentPage == ProfileViewerPage.LOADING)) { - if(keyCode == Keyboard.KEY_RETURN) { - currentPage = ProfileViewerPage.LOADING; - NotEnoughUpdates.profileViewer.getProfileByName(playerNameTextField.getText(), profile -> { //todo: invalid name - if(profile != null) profile.resetCache(); - Minecraft.getMinecraft().displayGuiScreen(new GuiProfileViewer(profile)); - }); - } - playerNameTextField.keyTyped(typedChar, keyCode); - } - } - - @Override - protected void mouseReleased(int mouseX, int mouseY, int mouseButton) { - super.mouseReleased(mouseX, mouseY, mouseButton); - - switch (currentPage) { - case INVS: - mouseReleasedInvs(mouseX, mouseY, mouseButton); - break; - case COLS: - mouseReleasedCols(mouseX, mouseY, mouseButton); - break; - case PETS: - mouseReleasedPets(mouseX, mouseY, mouseButton); - } - } - - protected void mouseClickedDung(int mouseX, int mouseY, int mouseButton) { - if(mouseX >= guiLeft+50 && mouseX <= guiLeft+70 && - mouseY >= guiTop+54 && mouseY <= guiTop+64) { - dungeonLevelTextField.mouseClicked(mouseX, mouseY, mouseButton); - } else { - dungeonLevelTextField.otherComponentClick(); - } - - int cW = fontRendererObj.getStringWidth("Calculate"); - if(mouseX >= guiLeft+23+110-17-cW && mouseX <= guiLeft+23+110-17 && - mouseY >= guiTop+55 && mouseY <= guiTop+65) { - calculateFloorLevelXP(); - } - - int y = guiTop+142; - - if(mouseY >= y-2 && mouseY <= y+9) { - for(int i=1; i<=7; i++) { - int w = fontRendererObj.getStringWidth(""+i); - - int x = guiLeft+23+110*i/8-w/2; - - if(mouseX >= x-2 && mouseX <= x+7) { - floorTime = i; - return; - } - } - } - } - - protected void keyTypedDung(char typedChar, int keyCode) { - dungeonLevelTextField.keyTyped(typedChar, keyCode); - } - - protected void keyTypedInvs(char typedChar, int keyCode) throws IOException { - switch(keyCode) { - case Keyboard.KEY_1: - case Keyboard.KEY_NUMPAD1: - selectedInventory = "inv_contents"; break; - case Keyboard.KEY_2: - case Keyboard.KEY_NUMPAD2: - selectedInventory = "ender_chest_contents"; break; - case Keyboard.KEY_3: - case Keyboard.KEY_NUMPAD3: - selectedInventory = "talisman_bag"; break; - case Keyboard.KEY_4: - case Keyboard.KEY_NUMPAD4: - selectedInventory = "wardrobe_contents"; break; - case Keyboard.KEY_5: - case Keyboard.KEY_NUMPAD5: - selectedInventory = "fishing_bag"; break; - case Keyboard.KEY_6: - case Keyboard.KEY_NUMPAD6: - selectedInventory = "potion_bag"; break; - } - Utils.playPressSound(); - } - - protected void keyTypedCols(char typedChar, int keyCode) throws IOException { - ItemStack stack = null; - Iterator<ItemStack> items = ProfileViewer.getCollectionCatToCollectionMap().keySet().iterator(); - switch(keyCode) { - case Keyboard.KEY_5: - case Keyboard.KEY_NUMPAD5: - stack = items.next(); - case Keyboard.KEY_4: - case Keyboard.KEY_NUMPAD4: - stack = items.next(); - case Keyboard.KEY_3: - case Keyboard.KEY_NUMPAD3: - stack = items.next(); - case Keyboard.KEY_2: - case Keyboard.KEY_NUMPAD2: - stack = items.next(); - case Keyboard.KEY_1: - case Keyboard.KEY_NUMPAD1: - stack = items.next(); - } - if(stack != null) { - selectedCollectionCategory = stack; - } - Utils.playPressSound(); - } - - private void mouseReleasedPets(int mouseX, int mouseY, int mouseButton) { - if(mouseY > guiTop+6 && mouseY < guiTop+22) { - if(mouseX > guiLeft+100-15-12 && mouseX < guiLeft+100-20) { - if(petsPage > 0) { - petsPage--; - } - return; - } else if(mouseX > guiLeft+100+15 && mouseX < guiLeft+100+20+12) { - if(sortedPets != null && petsPage < Math.ceil(sortedPets.size()/20f)-1) { - petsPage++; - } - return; - } - } - } - - private void mouseReleasedInvs(int mouseX, int mouseY, int mouseButton) { - if(mouseButton == 0) { - int i=0; - for(Map.Entry<String, ItemStack> entry : invNameToDisplayMap.entrySet()) { - int xIndex = i%3; - int yIndex = i/3; - - int x = guiLeft+19+34*xIndex; - int y = guiTop+26+34*yIndex; - - if(mouseX >= x && mouseX <= x+16) { - if(mouseY >= y && mouseY <= y+16) { - if(selectedInventory != entry.getKey()) Utils.playPressSound(); - selectedInventory = entry.getKey(); - return; - } - } - - i++; - } - - JsonObject inventoryInfo = profile.getInventoryInfo(profileId); - if(inventoryInfo == null) return; - - ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, selectedInventory); - if(currentInventoryIndex >= inventories.length) currentInventoryIndex = inventories.length-1; - if(currentInventoryIndex < 0) currentInventoryIndex = 0; - - ItemStack[][] inventory = inventories[currentInventoryIndex]; - if(inventory == null) return; - - int inventoryRows = inventory.length; - int invSizeY = inventoryRows*18+17+7; - - int y = guiTop+101-invSizeY/2; - - if(mouseY > y+invSizeY && mouseY < y+invSizeY+16) { - if(mouseX > guiLeft+320-12 && mouseX < guiLeft+320+12) { - if(mouseX < guiLeft+320) { - currentInventoryIndex--; - } else { - currentInventoryIndex++; - } - } - } - } - } - - private ItemStack selectedCollectionCategory = null; - - private void mouseReleasedCols(int mouseX, int mouseY, int mouseButton) { - int collectionCatSize = ProfileViewer.getCollectionCatToCollectionMap().size(); - int collectionCatYSize = (int)(162f/(collectionCatSize-1+0.0000001f)); - int yIndex = 0; - for(ItemStack stack : ProfileViewer.getCollectionCatToCollectionMap().keySet()) { - if(mouseX > guiLeft+7 && mouseX < guiLeft+7+20) { - if(mouseY > guiTop+10+collectionCatYSize*yIndex && mouseY < guiTop+10+collectionCatYSize*yIndex+20) { - selectedCollectionCategory = stack; - Utils.playPressSound(); - return; - } - } - yIndex++; - } - } - - private static final ItemStack DEADBUSH = new ItemStack(Item.getItemFromBlock(Blocks.deadbush)); - private static final ItemStack[] BOSS_HEADS = new ItemStack[7]; - - private HashMap<String, ProfileViewer.Level> levelObjCatas = new HashMap<>(); - private HashMap<String, HashMap<String, ProfileViewer.Level>> levelObjClasseses = new HashMap<>(); - - private GuiElementTextField dungeonLevelTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT); - - private static final String[] dungSkillsName = {"Healer", "Mage", "Berserk", "Archer", "Tank"}; - private static final ItemStack[] dungSkillsStack = { new ItemStack(Items.potionitem, 1, 16389), - new ItemStack(Items.blaze_rod), new ItemStack(Items.iron_sword), new ItemStack(Items.bow), new ItemStack(Items.leather_chestplate)}; - private static final String[] bossFloorArr = {"Bonzo", "Scarf", "Professor", "Thorn", "Livid", "Sadan", "Necron"}; - private static final String[] bossFloorHeads = { - "12716ecbf5b8da00b05f316ec6af61e8bd02805b21eb8e440151468dc656549c", - "7de7bbbdf22bfe17980d4e20687e386f11d59ee1db6f8b4762391b79a5ac532d", - "9971cee8b833a62fc2a612f3503437fdf93cad692d216b8cf90bbb0538c47dd8", - "8b6a72138d69fbbd2fea3fa251cabd87152e4f1c97e5f986bf685571db3cc0", - "c1007c5b7114abec734206d4fc613da4f3a0e99f71ff949cedadc99079135a0b", - "fa06cb0c471c1c9bc169af270cd466ea701946776056e472ecdaeb49f0f4a4dc", - "a435164c05cea299a3f016bbbed05706ebb720dac912ce4351c2296626aecd9a" - }; - private static int floorTime = 7; - private int floorLevelTo = -1; - private int floorLevelToXP = -1; - - private void calculateFloorLevelXP() { - JsonObject leveling = Constants.LEVELING; - if(leveling == null) return; - ProfileViewer.Level levelObjCata = levelObjCatas.get(profileId); - if(levelObjCata == null) return; - - try { - dungeonLevelTextField.setCustomBorderColour(0xffffffff); - floorLevelTo = Integer.parseInt(dungeonLevelTextField.getText()); - - JsonArray levelingArray = Utils.getElement(leveling, "catacombs").getAsJsonArray(); - - float remaining = -((levelObjCata.level % 1) * levelObjCata.maxXpForLevel); - - for(int level=0; level<Math.min(floorLevelTo, levelingArray.size()); level++) { - if(level < Math.floor(levelObjCata.level)) { - continue; - } - remaining += levelingArray.get(level).getAsFloat(); - } - - if(remaining < 0) { - remaining = 0; - } - floorLevelToXP = (int) remaining; - } catch(Exception e) { - dungeonLevelTextField.setCustomBorderColour(0xffff0000); - } - } - - private void drawDungPage(int mouseX, int mouseY, float partialTicks) { - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dung); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - - JsonObject hypixelInfo = profile.getHypixelProfile(); - if(hypixelInfo == null) return; - JsonObject profileInfo = profile.getProfileInformation(profileId); - if(profileInfo == null) return; - - JsonObject leveling = Constants.LEVELING; - if(leveling == null) return; - - int sectionWidth = 110; - - ProfileViewer.Level levelObjCata = levelObjCatas.get(profileId); - //Catacombs level thingy - { - if(levelObjCata == null) { - float cataXp = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.experience"), 0); - levelObjCata = ProfileViewer.getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(), - cataXp, 50, false); - levelObjCatas.put(profileId, levelObjCata); - } - - String skillName = EnumChatFormatting.RED+"Catacombs"; - float level = levelObjCata.level; - int levelFloored = (int)Math.floor(level); - - if(floorLevelTo == -1 && levelFloored >= 0) { - dungeonLevelTextField.setText(""+(levelFloored+1)); - calculateFloorLevelXP(); - } - - int x = guiLeft+23; - int y = guiTop+25; - - renderXpBar(skillName, DEADBUSH, x, y, sectionWidth, levelObjCata, mouseX, mouseY); - - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Until Cata "+floorLevelTo+": ", - EnumChatFormatting.WHITE.toString()+shortNumberFormat(floorLevelToXP, 0), x, y+16, sectionWidth); - - if(mouseX > x && mouseX < x + sectionWidth && - mouseY > y+16 && mouseY < y+24) { - float xpF5 = 2000; - float xpF6 = 4000; - float xpF7 = 20000; - if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - xpF5 *= 1.1; - xpF6 *= 1.1; - xpF7 *= 1.1; - } - - long runsF5 = (int)Math.ceil(floorLevelToXP/xpF5); - long runsF6 = (int)Math.ceil(floorLevelToXP/xpF6); - long runsF7 = (int)Math.ceil(floorLevelToXP/xpF7); - - float timeF5 = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s_plus.5"), 0); - float timeF6 = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s_plus.6"), 0); - float timeF7 = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s_plus.7"), 0); - - tooltipToDisplay = Lists.newArrayList( - String.format("# F5 Runs (%s xp) : %d", shortNumberFormat(xpF5, 0), runsF5), - String.format("# F6 Runs (%s xp) : %d", shortNumberFormat(xpF6, 0), runsF6), - String.format("# F7 Runs (%s xp) : %d", shortNumberFormat(xpF7, 0), runsF7), - "" - ); - boolean hasTime = false; - if(timeF5 > 1000) { - tooltipToDisplay.add(String.format("Expected Time (F5) : %s", Utils.prettyTime(runsF5*(long)(timeF5*1.2)))); - hasTime = true; - } - if(timeF6 > 1000) { - tooltipToDisplay.add(String.format("Expected Time (F6) : %s", Utils.prettyTime(runsF6*(long)(timeF6*1.2)))); - hasTime = true; - } - if(timeF7 > 1000) { - tooltipToDisplay.add(String.format("Expected Time (F7) : %s", Utils.prettyTime(runsF7*(long)(timeF7*1.2)))); - hasTime = true; - } - if(hasTime) { - tooltipToDisplay.add(""); - } - if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - tooltipToDisplay.add("[Hold "+EnumChatFormatting.YELLOW+"SHIFT"+EnumChatFormatting.GRAY+" to show without Expert Ring]"); - } - if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) { - if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) tooltipToDisplay.add(""); - tooltipToDisplay.add("Number of runs is calculated as [Remaining XP]/[XP per Run]."); - tooltipToDisplay.add("The [XP per Run] is the average xp gained from an S+ run"); - tooltipToDisplay.add("The "+EnumChatFormatting.DARK_PURPLE+"Catacombs Expert Ring"+EnumChatFormatting.GRAY+ - " is assumed to be used, unless "+EnumChatFormatting.YELLOW+"SHIFT"+EnumChatFormatting.GRAY+" is held."); - tooltipToDisplay.add("[Time per run] is calculated using fastestSPlus x 120%"); - } else { - tooltipToDisplay.add("[Hold "+EnumChatFormatting.YELLOW+"CTRL"+EnumChatFormatting.GRAY+" to see details]"); - } - } - - dungeonLevelTextField.setSize(20, 10); - dungeonLevelTextField.render(x+22, y+29); - int calcLen = fontRendererObj.getStringWidth("Calculate"); - Utils.renderShadowedString(EnumChatFormatting.WHITE+"Calculate", x+sectionWidth-17-calcLen/2f, - y+30, 100); - - //Random stats - - float secrets = Utils.getElementAsFloat(Utils.getElement(hypixelInfo, - "achievements.skyblock_treasure_hunter"), 0); - - float totalRuns = 0; - float totalRunsF5 = 0; - for(int i=1; i<=7; i++) { - float runs = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.tier_completions."+i), 0); - totalRuns += runs; - if(i >= 5) { - totalRunsF5 += runs; - } - } - - float mobKills = 0; - float mobKillsF5 = 0; - for(int i=1; i<=7; i++) { - float kills = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.mobs_killed."+i), 0); - mobKills += kills; - if(i >= 5) { - mobKillsF5 += kills; - } - } - - int miscTopY = y+55; - - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs ", - EnumChatFormatting.WHITE.toString()+((int)(totalRuns)), x, miscTopY, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs (F5-7) ", - EnumChatFormatting.WHITE.toString()+((int)(totalRunsF5)), x, miscTopY+10, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (Total) ", - EnumChatFormatting.WHITE.toString()+shortNumberFormat(secrets, 0), x, miscTopY+20, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (/Run) ", - EnumChatFormatting.WHITE.toString()+(Math.round(secrets/Math.max(1, totalRuns)*100)/100f), x, miscTopY+30, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Mob Kills (Total) ", - EnumChatFormatting.WHITE.toString()+shortNumberFormat(mobKills, 0), x, miscTopY+40, sectionWidth); - - int y3 = y+117; - - for(int i=1; i<=7; i++) { - int w = fontRendererObj.getStringWidth(""+i); - - int bx = x+sectionWidth*i/8-w/2; - - boolean invert = i == floorTime; - float uMin = 20/256f; - float uMax = 29/256f; - float vMin = 0/256f; - float vMax = 11/256f; - - GlStateManager.color(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - Utils.drawTexturedRect(bx-2, y3-2, 9, 11, - invert ? uMax : uMin, invert ? uMin : uMax, - invert ? vMax : vMin, invert ? vMin : vMax, GL11.GL_NEAREST); - - Utils.renderShadowedString(EnumChatFormatting.WHITE.toString()+i, bx+w/2, y3, 10); - } - - float timeNorm = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time."+floorTime), 0); - float timeS = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s."+floorTime), 0); - float timeSPLUS = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s_plus."+floorTime), 0); - String timeNormStr = timeNorm <= 0 ? "N/A" : Utils.prettyTime((long)timeNorm); - String timeSStr = timeS <= 0 ? "N/A" : Utils.prettyTime((long)timeS); - String timeSPlusStr = timeSPLUS <= 0 ? "N/A" : Utils.prettyTime((long)timeSPLUS); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Floor "+floorTime+" ", - EnumChatFormatting.WHITE.toString()+timeNormStr, x, y3+10, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Floor "+floorTime+" S", - EnumChatFormatting.WHITE.toString()+timeSStr, x, y3+20, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Floor "+floorTime+" S+", - EnumChatFormatting.WHITE.toString()+timeSPlusStr, x, y3+30, sectionWidth); - } - - //Completions - { - int x = guiLeft+161; - int y = guiTop+27; - - Utils.renderShadowedString(EnumChatFormatting.RED+"Boss Collections", - x+sectionWidth/2, y, sectionWidth); - for(int i=1; i<=7; i++) { - float compl = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.tier_completions."+i), 0); - - if(BOSS_HEADS[i-1] == null) { - String textureLink = bossFloorHeads[i-1]; - - String b64Decoded = "{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + textureLink + "\"}}}"; - String b64Encoded = new String(Base64.getEncoder().encode(b64Decoded.getBytes())); - - ItemStack stack = new ItemStack(Items.skull, 1, 3); - NBTTagCompound nbt = new NBTTagCompound(); - NBTTagCompound skullOwner = new NBTTagCompound(); - NBTTagCompound properties = new NBTTagCompound(); - NBTTagList textures = new NBTTagList(); - NBTTagCompound textures_0 = new NBTTagCompound(); - - String uuid = UUID.nameUUIDFromBytes(b64Encoded.getBytes()).toString(); - skullOwner.setString("Id", uuid); - skullOwner.setString("Name", uuid); - - textures_0.setString("Value", b64Encoded); - textures.appendTag(textures_0); - - properties.setTag("textures", textures); - skullOwner.setTag("Properties", properties); - nbt.setTag("SkullOwner", skullOwner); - stack.setTagCompound(nbt); - - BOSS_HEADS[i-1] = stack; - } - - GlStateManager.pushMatrix(); - GlStateManager.translate(x-4, y+10+20*(i-1), 0); - GlStateManager.scale(1.3f, 1.3f, 1); - Utils.drawItemStack(BOSS_HEADS[i-1], 0, 0); - GlStateManager.popMatrix(); - - Utils.renderAlignedString(String.format(EnumChatFormatting.YELLOW+"%s (F%d) ", bossFloorArr[i-1], i), - EnumChatFormatting.WHITE.toString()+(int)compl, - x+16, y+18+20*(i-1), sectionWidth-15); - - } - } - - //Skills - { - int x = guiLeft+298; - int y = guiTop+27; - - //Gui.drawRect(x, y, x+120, y+147, 0xffffffff); - - Utils.renderShadowedString(EnumChatFormatting.DARK_PURPLE+"Class Levels", - x+sectionWidth/2, y, sectionWidth); - - JsonElement activeClassElement = Utils.getElement(profileInfo, "dungeons.selected_dungeon_class"); - String activeClass = null; - if(activeClassElement instanceof JsonPrimitive && ((JsonPrimitive) activeClassElement).isString()) { - activeClass = activeClassElement.getAsString(); - } - - for(int i=0; i<dungSkillsName.length; i++) { - String skillName = dungSkillsName[i]; - - - HashMap<String, ProfileViewer.Level> levelObjClasses = levelObjClasseses.computeIfAbsent(profileId, k->new HashMap<>()); - if(!levelObjClasses.containsKey(skillName)) { - float cataXp = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.player_classes."+skillName.toLowerCase()+".experience"), 0); - ProfileViewer.Level levelObj = ProfileViewer.getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(), - cataXp, 50, false); - levelObjClasses.put(skillName, levelObj); - } - - String colour = EnumChatFormatting.WHITE.toString(); - if(skillName.toLowerCase().equals(activeClass)) { - colour = EnumChatFormatting.GREEN.toString(); - } - - ProfileViewer.Level levelObj = levelObjClasses.get(skillName); - - renderXpBar(colour+skillName, dungSkillsStack[i], x, y+20+29*i, sectionWidth, levelObj, mouseX, mouseY); - } - } - } - - private void renderXpBar(String skillName, ItemStack stack, int x, int y, int xSize, ProfileViewer.Level levelObj, int mouseX, int mouseY) { - float level = levelObj.level; - int levelFloored = (int)Math.floor(level); - - Utils.renderAlignedString(skillName, EnumChatFormatting.WHITE.toString()+levelFloored, x+14, y-4, xSize-20); - - if(levelObj.maxed) { - renderGoldBar(x, y+6, xSize); - } else { - renderBar(x, y+6, xSize, level%1); - } - - if(mouseX > x && mouseX < x+120) { - if(mouseY > y-4 && mouseY < y+13) { - String levelStr; - if(levelObj.maxed) { - levelStr = EnumChatFormatting.GOLD+"MAXED!"; - } else { - int maxXp = (int)levelObj.maxXpForLevel; - levelStr = EnumChatFormatting.DARK_PURPLE.toString() + shortNumberFormat(Math.round((level%1)*maxXp), - 0) + "/" + shortNumberFormat(maxXp, 0); - } - - tooltipToDisplay = Utils.createList(levelStr); - } - } - - GL11.glTranslatef((x), (y-6f), 0); - GL11.glScalef(0.7f, 0.7f, 1); - Utils.drawItemStackLinear(stack, 0, 0); - GL11.glScalef(1/0.7f, 1/0.7f, 1); - GL11.glTranslatef(-(x), -(y-6f), 0); - } - - public static class PetLevel { - public float level; - public float currentLevelRequirement; - public float maxXP; - public float levelPercentage; - public float levelXp; - public float totalXp; - } - - public static PetLevel getPetLevel(JsonArray levels, int offset, float exp) { - float xpTotal = 0; - float level = 1; - float currentLevelRequirement = 0; - float currentLevelProgress = 0; - - boolean addLevel = true; - - for(int i=offset; i<offset+99; i++) { - if(addLevel) { - currentLevelRequirement = levels.get(i).getAsFloat(); - xpTotal += currentLevelRequirement; - if(xpTotal > exp) { - currentLevelProgress = (exp-(xpTotal-currentLevelRequirement)); - addLevel = false; - } else { - level += 1; - } - } else { - xpTotal += levels.get(i).getAsFloat(); - } - } - - level += currentLevelProgress/currentLevelRequirement; - if(level <= 0) { - level = 1; - } else if(level > 100) { - level = 100; - } - PetLevel levelObj = new PetLevel(); - levelObj.level = level; - levelObj.currentLevelRequirement = currentLevelRequirement; - levelObj.maxXP = xpTotal; - levelObj.levelPercentage = currentLevelProgress/currentLevelRequirement; - levelObj.levelXp = currentLevelProgress; - levelObj.totalXp = exp; - return levelObj; - } - - public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS = new HashMap<>(); - static { - HashMap<String, Float> bigTeeth = new HashMap<>(); - bigTeeth.put("CRIT_CHANCE", 5f); - PET_STAT_BOOSTS.put("PET_ITEM_BIG_TEETH_COMMON", bigTeeth); - - HashMap<String, Float> hardenedScales = new HashMap<>(); - hardenedScales.put("DEFENCE", 25f); - PET_STAT_BOOSTS.put("PET_ITEM_HARDENED_SCALES_UNCOMMON", hardenedScales); - - HashMap<String, Float> luckyClover = new HashMap<>(); - luckyClover.put("MAGIC_FIND", 7f); - PET_STAT_BOOSTS.put("PET_ITEM_LUCKY_CLOVER", luckyClover); - - HashMap<String, Float> sharpenedClaws = new HashMap<>(); - sharpenedClaws.put("CRIT_DAMAGE", 15f); - PET_STAT_BOOSTS.put("PET_ITEM_SHARPENED_CLAWS_UNCOMMON", sharpenedClaws); - } - public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS_MULT = new HashMap<>(); - static { - HashMap<String, Float> ironClaws = new HashMap<>(); - ironClaws.put("CRIT_DAMAGE", 1.4f); - ironClaws.put("CRIT_CHANCE", 1.4f); - PET_STAT_BOOSTS_MULT.put("PET_ITEM_IRON_CLAWS_COMMON", ironClaws); - - HashMap<String, Float> textbook = new HashMap<>(); - textbook.put("INTELLIGENCE", 2f); - PET_STAT_BOOSTS_MULT.put("PET_ITEM_TEXTBOOK", textbook); - } - - private int selectedPet = -1; - private int petsPage = 0; - private List<JsonObject> sortedPets = null; - private List<ItemStack> sortedPetsStack = null; - public static HashMap<String, String> MINION_RARITY_TO_NUM = new HashMap<>(); - static { - MINION_RARITY_TO_NUM.put("COMMON", "0"); - MINION_RARITY_TO_NUM.put("UNCOMMON", "1"); - MINION_RARITY_TO_NUM.put("RARE", "2"); - MINION_RARITY_TO_NUM.put("EPIC", "3"); - MINION_RARITY_TO_NUM.put("LEGENDARY", "4"); - MINION_RARITY_TO_NUM.put("MYTHIC", "5"); - } - private void drawPetsPage(int mouseX, int mouseY, float partialTicks) { - JsonObject petsInfo = profile.getPetsInfo(profileId); - if(petsInfo == null) return; - JsonObject petsJson = Constants.PETS; - if(petsJson == null) return; - - String location = null; - JsonObject status = profile.getPlayerStatus(); - if(status != null && status.has("mode")) { - location = status.get("mode").getAsString(); - } - - backgroundRotation += (currentTime - lastTime)/400f; - backgroundRotation %= 360; - - String panoramaIdentifier = "day"; - if(SBInfo.getInstance().currentTimeDate != null) { - if(SBInfo.getInstance().currentTimeDate.getHours() <= 6 || - SBInfo.getInstance().currentTimeDate.getHours() >= 20) { - panoramaIdentifier = "night"; - } - } - - JsonArray pets = petsInfo.get("pets").getAsJsonArray(); - if(sortedPets == null) { - sortedPets = new ArrayList<>(); - sortedPetsStack = new ArrayList<>(); - for(int i=0; i<pets.size(); i++) { - sortedPets.add(pets.get(i).getAsJsonObject()); - } - sortedPets.sort((pet1, pet2) -> { - String tier1 = pet1.get("tier").getAsString(); - String tierNum1 = MINION_RARITY_TO_NUM.get(tier1); - if(tierNum1 == null) return 1; - int tierNum1I = Integer.parseInt(tierNum1); - float exp1 = pet1.get("exp").getAsFloat(); - - String tier2 = pet2.get("tier").getAsString(); - String tierNum2 = MINION_RARITY_TO_NUM.get(tier2); - if(tierNum2 == null) return -1; - int tierNum2I = Integer.parseInt(tierNum2); - float exp2 = pet2.get("exp").getAsFloat(); - - if(tierNum1I != tierNum2I) { - return tierNum2I - tierNum1I; - } else { - return (int)(exp2 - exp1); - } - }); - for(JsonObject pet : sortedPets) { - String petname = pet.get("type").getAsString(); - String tier = pet.get("tier").getAsString(); - String heldItem = Utils.getElementAsString(pet.get("heldItem"), null); - JsonObject heldItemJson = heldItem==null?null:NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(heldItem); - String tierNum = MINION_RARITY_TO_NUM.get(tier); - float exp = pet.get("exp").getAsFloat(); - if(tierNum == null) continue; - - if(pet.has("heldItem") && !pet.get("heldItem").isJsonNull() && pet.get("heldItem").getAsString().equals("PET_ITEM_TIER_BOOST")) { - tierNum = ""+(Integer.parseInt(tierNum)+1); - } - - int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt(); - JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray(); - - PetLevel levelObj = getPetLevel(levelsArr, petRarityOffset, exp); - float level = levelObj.level; - float currentLevelRequirement = levelObj.currentLevelRequirement; - float maxXP = levelObj.maxXP; - pet.addProperty("level", level); - pet.addProperty("currentLevelRequirement", currentLevelRequirement); - pet.addProperty("maxXP", maxXP); - - JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(petname+";"+tierNum); - if(petItem == null) continue; - - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem, false, false); - HashMap<String, String> replacements = NotEnoughUpdates.INSTANCE.manager.getLoreReplacements(petname, tier, (int)Math.floor(level)); - - if(heldItem != null) { - HashMap<String, Float> petStatBoots = PET_STAT_BOOSTS.get(heldItem); - HashMap<String, Float> petStatBootsMult = PET_STAT_BOOSTS_MULT.get(heldItem); - if(petStatBoots != null) { - for(Map.Entry<String, Float> entryBoost : petStatBoots.entrySet()) { - try { - float value = Float.parseFloat(replacements.get(entryBoost.getKey())); - replacements.put(entryBoost.getKey(), String.valueOf((int)Math.floor(value+entryBoost.getValue()))); - } catch(Exception ignored) {} - } - - } - if(petStatBootsMult != null) { - for(Map.Entry<String, Float> entryBoost : petStatBootsMult.entrySet()) { - try { - float value = Float.parseFloat(replacements.get(entryBoost.getKey())); - replacements.put(entryBoost.getKey(), String.valueOf((int)Math.floor(value*entryBoost.getValue()))); - } catch(Exception ignored) {} - } - } - } - - NBTTagCompound tag = stack.getTagCompound()==null?new NBTTagCompound():stack.getTagCompound(); - if(tag.hasKey("display", 10)) { - NBTTagCompound display = tag.getCompoundTag("display"); - if(display.hasKey("Lore", 9)) { - NBTTagList newNewLore = new NBTTagList(); - NBTTagList newLore = new NBTTagList(); - NBTTagList lore = display.getTagList("Lore", 8); - HashMap<Integer, Integer> blankLocations = new HashMap<>(); - for(int j=0; j<lore.tagCount(); j++) { - String line = lore.getStringTagAt(j); - if(line.trim().isEmpty()) { - blankLocations.put(blankLocations.size(), j); - } - for(Map.Entry<String, String> replacement : replacements.entrySet()) { - line = line.replace("{"+replacement.getKey()+"}", replacement.getValue()); - } - newLore.appendTag(new NBTTagString(line)); - } - Integer secondLastBlank = blankLocations.get(blankLocations.size()-2); - if(heldItemJson != null && secondLastBlank != null) { - for(int j=0; j<newLore.tagCount(); j++) { - String line = newLore.getStringTagAt(j); - - if(j == secondLastBlank.intValue()) { - newNewLore.appendTag(new NBTTagString("")); - newNewLore.appendTag(new NBTTagString(EnumChatFormatting.GOLD+"Held Item: "+heldItemJson.get("displayname").getAsString())); - int blanks = 0; - JsonArray heldItemLore = heldItemJson.get("lore").getAsJsonArray(); - for(int k=0; k<heldItemLore.size(); k++) { - String heldItemLine = heldItemLore.get(k).getAsString(); - if(heldItemLine.trim().isEmpty()) { - blanks++; - } else if(blanks==2) { - newNewLore.appendTag(new NBTTagString(heldItemLine)); - } else if(blanks>2) { - break; - } - } - } - - newNewLore.appendTag(new NBTTagString(line)); - } - display.setTag("Lore", newNewLore); - } else { - display.setTag("Lore", newLore); - } - } - if(display.hasKey("Name", 8)) { - String displayName = display.getString("Name"); - for(Map.Entry<String, String> replacement : replacements.entrySet()) { - displayName = displayName.replace("{"+replacement.getKey()+"}", replacement.getValue()); - } - display.setTag("Name", new NBTTagString(displayName)); - } - tag.setTag("display", display); - } - stack.setTagCompound(tag); - - sortedPetsStack.add(stack); - } - } - - Panorama.drawPanorama(-backgroundRotation, guiLeft+212, guiTop+44, 81, 108, -0.37f, 0.6f, - getPanoramasForLocation(location==null?"dynamic":location, panoramaIdentifier)); - - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_pets); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - - Utils.drawStringCentered(EnumChatFormatting.DARK_PURPLE+"Pets", Minecraft.getMinecraft().fontRendererObj, - guiLeft+100, guiTop+14, true, 4210752); - GlStateManager.color(1, 1, 1, 1); - - JsonElement activePetElement = petsInfo.get("active_pet"); - if(selectedPet == -1 && activePetElement != null && activePetElement.isJsonObject()) { - JsonObject active = activePetElement.getAsJsonObject(); - for(int i=0; i<sortedPets.size(); i++) { - if(sortedPets.get(i) == active) { - selectedPet = i; - break; - } - } - } - - boolean leftHovered = false; - boolean rightHovered = false; - if(Mouse.isButtonDown(0)) { - if(mouseY > guiTop+6 && mouseY < guiTop+22) { - if(mouseX > guiLeft+100-20-12 && mouseX < guiLeft+100-20) { - leftHovered = true; - } else if(mouseX > guiLeft+100+20 && mouseX < guiLeft+100+20+12) { - rightHovered = true; - } - } - } - Minecraft.getMinecraft().getTextureManager().bindTexture(resource_packs); - - if(petsPage > 0) { - Utils.drawTexturedRect(guiLeft+100-15-12, guiTop+6, 12, 16, - 29/256f, 53/256f, !leftHovered?0:32/256f, !leftHovered?32/256f:64/256f, GL11.GL_NEAREST); - } - if(petsPage < Math.ceil(pets.size()/20f)-1) { - Utils.drawTexturedRect( guiLeft+100+15, guiTop+6, 12, 16, - 5/256f, 29/256f, !rightHovered?0:32/256f, !rightHovered?32/256f:64/256f, GL11.GL_NEAREST); - } - - for(int i=petsPage*20; i<Math.min(petsPage*20+20, Math.min(sortedPetsStack.size(), sortedPets.size())); i++) { - JsonObject pet = sortedPets.get(i); - ItemStack stack = sortedPetsStack.get(i); - if(pet != null) { - int xIndex = (i%20) % COLLS_XCOUNT; - int yIndex = (i%20) / COLLS_XCOUNT; - - float x = 5 + COLLS_XPADDING + (COLLS_XPADDING + 20) * xIndex; - float y = 7 + COLLS_YPADDING + (COLLS_YPADDING + 20) * yIndex; - - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - if(i == selectedPet) { - GlStateManager.color(1, 185/255f, 0, 1); - Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20, - 0, 20/256f, 0, 20/256f, GL11.GL_NEAREST); - } else { - GlStateManager.color(1, 1, 1, 1); - Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20, - 0, 20/256f, 0, 20/256f, GL11.GL_NEAREST); - } - - Utils.drawItemStack(stack, guiLeft+(int)x+2, guiTop+(int)y+2); - - if(mouseX > guiLeft+x && mouseX < guiLeft+x+20) { - if(mouseY > guiTop+y && mouseY < guiTop+y+20) { - tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - } - } - } - } - - if(selectedPet >= 0) { - ItemStack petStack = sortedPetsStack.get(selectedPet); - String display = petStack.getDisplayName(); - JsonObject pet = sortedPets.get(selectedPet); - String type = pet.get("type").getAsString(); - - for(int i=0; i<4; i++) { - JsonObject item = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(type+";"+i); - if(item != null) { - int x = guiLeft+280; - float y = guiTop+67+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI)); - - int displayLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(display); - int halfDisplayLen = displayLen/2; - - GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, 0); - - drawRect(-halfDisplayLen-1-28, -1, halfDisplayLen+1-28, 8, new Color(0, 0, 0, 100).getRGB()); - - Minecraft.getMinecraft().fontRendererObj.drawString(display, -halfDisplayLen-28, 0, 0, true); - - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item); - GlStateManager.enableDepth(); - GlStateManager.translate(-55, 0, 0); - GlStateManager.scale(3.5f, 3.5f, 1); - Utils.drawItemStack(stack, 0, 0); - GlStateManager.popMatrix(); - break; - } - } - - float level = pet.get("level").getAsFloat(); - float currentLevelRequirement = pet.get("currentLevelRequirement").getAsFloat(); - float exp = pet.get("exp").getAsFloat(); - float maxXP = pet.get("maxXP").getAsFloat(); - - String[] split = display.split("] "); - String colouredName = split[split.length-1]; - - Utils.renderAlignedString(colouredName, EnumChatFormatting.WHITE+"Level "+(int)Math.floor(level), guiLeft+319, guiTop+28, 98); - - //Utils.drawStringCenteredScaledMaxWidth(, Minecraft.getMinecraft().fontRendererObj, guiLeft+368, guiTop+28+4, true, 98, 0); - //renderAlignedString(display, EnumChatFormatting.YELLOW+"[LVL "+Math.floor(level)+"]", guiLeft+319, guiTop+28, 98); - renderBar(guiLeft+319, guiTop+38, 98, (float)Math.floor(level)/100f); - - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"To Next LVL", EnumChatFormatting.WHITE.toString()+(int)(level%1*100)+"%", guiLeft+319, guiTop+46, 98); - renderBar(guiLeft+319, guiTop+56, 98, level%1); - - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"To Max LVL", EnumChatFormatting.WHITE.toString()+Math.min(100, (int)(exp/maxXP*100))+"%", guiLeft+319, guiTop+64, 98); - renderBar(guiLeft+319, guiTop+74, 98, exp/maxXP); - - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(exp, 0), guiLeft+319, guiTop+125, 98); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Current LVL XP", - EnumChatFormatting.WHITE.toString()+shortNumberFormat((level%1)*currentLevelRequirement, 0), guiLeft+319, guiTop+143, 98); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Required LVL XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(currentLevelRequirement, 0), guiLeft+319, guiTop+161, 98); - } - } - - private String[] romans = new String[]{"I","II","III","IV","V","VI","VII","VIII","IX","X","XI", - "XII","XIII","XIV","XV","XVI","XVII","XIX","XX"}; - - private final int COLLS_XCOUNT = 5; - private final int COLLS_YCOUNT = 4; - private final float COLLS_XPADDING = (190-COLLS_XCOUNT*20)/(float)(COLLS_XCOUNT+1); - private final float COLLS_YPADDING = (202-COLLS_YCOUNT*20)/(float)(COLLS_YCOUNT+1); - - private void drawColsPage(int mouseX, int mouseY, float partialTicks) { - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_cols); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - - JsonObject collectionInfo = profile.getCollectionInfo(profileId); - if(collectionInfo == null) { - Utils.drawStringCentered(EnumChatFormatting.RED+"Collection API not enabled!", Minecraft.getMinecraft().fontRendererObj, - guiLeft+134, guiTop+101, true, 0); - return; - } - JsonObject resourceCollectionInfo = ProfileViewer.getResourceCollectionInformation(); - if(resourceCollectionInfo == null) return; - - int collectionCatSize = ProfileViewer.getCollectionCatToCollectionMap().size(); - int collectionCatYSize = (int)(162f/(collectionCatSize-1+0.0000001f)); - { - int yIndex = 0; - for(ItemStack stack : ProfileViewer.getCollectionCatToCollectionMap().keySet()) { - if(selectedCollectionCategory == null) selectedCollectionCategory = stack; - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - if(stack == selectedCollectionCategory) { - Utils.drawTexturedRect(guiLeft+7, guiTop+10+collectionCatYSize*yIndex, 20, 20, - 20/256f, 0, 20/256f, 0, GL11.GL_NEAREST); - Utils.drawItemStackWithText(stack, guiLeft+10, guiTop+13+collectionCatYSize*yIndex, ""+(yIndex+1)); - } else { - Utils.drawTexturedRect(guiLeft+7, guiTop+10+collectionCatYSize*yIndex, 20, 20, - 0, 20/256f, 0, 20/256f, GL11.GL_NEAREST); - Utils.drawItemStackWithText(stack, guiLeft+9, guiTop+12+collectionCatYSize*yIndex, ""+(yIndex+1)); - } - yIndex++; - } - } - - Utils.drawStringCentered(selectedCollectionCategory.getDisplayName() + " Collections", Minecraft.getMinecraft().fontRendererObj, - guiLeft+134, guiTop+14, true, 4210752); - - JsonObject minionTiers = collectionInfo.get("minion_tiers").getAsJsonObject(); - JsonObject collectionTiers = collectionInfo.get("collection_tiers").getAsJsonObject(); - JsonObject maxAmounts = collectionInfo.get("max_amounts").getAsJsonObject(); - JsonObject totalAmounts = collectionInfo.get("total_amounts").getAsJsonObject(); - JsonObject personalAmounts = collectionInfo.get("personal_amounts").getAsJsonObject(); - - List<String> collections = ProfileViewer.getCollectionCatToCollectionMap().get(selectedCollectionCategory); - if(collections != null) { - for(int i=0; i<collections.size(); i++) { - String collection = collections.get(i); - if(collection != null) { - ItemStack collectionItem = ProfileViewer.getCollectionToCollectionDisplayMap().get(collection); - if(collectionItem != null) { - int xIndex = i%COLLS_XCOUNT; - int yIndex = i/COLLS_XCOUNT; - - float x = 39+COLLS_XPADDING+(COLLS_XPADDING+20)*xIndex; - float y = 7+COLLS_YPADDING+(COLLS_YPADDING+20)*yIndex; - - String tierString; - int tier = (int)Utils.getElementAsFloat(collectionTiers.get(collection), 0); - if(tier > 20 || tier < 0) { - tierString = String.valueOf(tier); - } else { - tierString = romans[tier]; - } - float amount = Utils.getElementAsFloat(totalAmounts.get(collection), 0); - float maxAmount = Utils.getElementAsFloat(maxAmounts.get(collection), 0); - Color color = new Color(128, 128, 128, 255); - int tierStringColour = color.getRGB(); - float completedness = 0; - if(maxAmount > 0) { - completedness = amount/maxAmount; - } - completedness = Math.min(1, completedness); - if(maxAmounts.has(collection) && completedness >= 1) { - tierStringColour = new Color(255, 215, 0).getRGB(); - } - - GlStateManager.color(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20*(1-completedness), - 0, 20/256f, 0, 20*(1-completedness)/256f, GL11.GL_NEAREST); - GlStateManager.color(1, 185/255f, 0, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - Utils.drawTexturedRect(guiLeft+x, guiTop+y+20*(1-completedness), 20, 20*(completedness), - 0, 20/256f, 20*(1-completedness)/256f, 20/256f, GL11.GL_NEAREST); - Utils.drawItemStack(collectionItem, guiLeft+(int)x+2, guiTop+(int)y+2); - - if(mouseX > guiLeft+(int)x+2 && mouseX < guiLeft+(int)x+18) { - if(mouseY > guiTop+(int)y+2 && mouseY < guiTop+(int)y+18) { - tooltipToDisplay = new ArrayList<>(); - tooltipToDisplay.add(collectionItem.getDisplayName() + " " + - (completedness>=1?EnumChatFormatting.GOLD:EnumChatFormatting.GRAY) + tierString); - tooltipToDisplay.add("Collected: " + numberFormat.format(Utils.getElementAsFloat(personalAmounts.get(collection), 0))); - tooltipToDisplay.add("Total Collected: " + numberFormat.format(amount)); - } - } - - GlStateManager.color(1, 1, 1, 1); - if(tier >= 0) { - Utils.drawStringCentered(tierString, fontRendererObj, - guiLeft+x+10, guiTop+y-4, true, - tierStringColour); - } - - Utils.drawStringCentered(shortNumberFormat(amount, 0)+"", fontRendererObj, - guiLeft+x+10, guiTop+y+26, true, - color.getRGB()); - } - } - } - } - - Utils.drawStringCentered(selectedCollectionCategory.getDisplayName() + " Minions", Minecraft.getMinecraft().fontRendererObj, - guiLeft+326, guiTop+14, true, 4210752); - - float MAX_MINION_TIER = 11f; - List<String> minions = ProfileViewer.getCollectionCatToMinionMap().get(selectedCollectionCategory); - if(minions != null) { - for(int i=0; i<minions.size(); i++) { - String minion = minions.get(i); - if(minion != null) { - JsonObject minionJson = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(minion+"_GENERATOR_1"); - if(minionJson != null) { - int xIndex = i%COLLS_XCOUNT; - int yIndex = i/COLLS_XCOUNT; - - float x = 231+COLLS_XPADDING+(COLLS_XPADDING+20)*xIndex; - float y = 7+COLLS_YPADDING+(COLLS_YPADDING+20)*yIndex; - - String tierString; - int tier = (int)Utils.getElementAsFloat(minionTiers.get(minion), 0); - if(tier-1 >= romans.length || tier-1 < 0) { - tierString = String.valueOf(tier); - } else { - tierString = romans[tier-1]; - } - - Color color = new Color(128, 128, 128, 255); - int tierStringColour = color.getRGB(); - float completedness = tier/MAX_MINION_TIER; - - completedness = Math.min(1, completedness); - if(completedness >= 1) { - tierStringColour = new Color(255, 215, 0).getRGB(); - } - - GlStateManager.color(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20*(1-completedness), - 0, 20/256f, 0, 20*(1-completedness)/256f, GL11.GL_NEAREST); - GlStateManager.color(1, 185/255f, 0, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - Utils.drawTexturedRect(guiLeft+x, guiTop+y+20*(1-completedness), 20, 20*(completedness), - 0, 20/256f, 20*(1-completedness)/256f, 20/256f, GL11.GL_NEAREST); - - Utils.drawItemStack(NotEnoughUpdates.INSTANCE.manager.jsonToStack(minionJson), guiLeft+(int)x+2, guiTop+(int)y+2); - - if(mouseX > guiLeft+(int)x+2 && mouseX < guiLeft+(int)x+18) { - if(mouseY > guiTop+(int)y+2 && mouseY < guiTop+(int)y+18) { - tooltipToDisplay = NotEnoughUpdates.INSTANCE.manager.jsonToStack(minionJson) - .getTooltip(Minecraft.getMinecraft().thePlayer, false); - } - } - - GlStateManager.color(1, 1, 1, 1); - if(tier >= 0) { - Utils.drawStringCentered(tierString, fontRendererObj, - guiLeft+x+10, guiTop+y-4, true, - tierStringColour); - } - } - } - } - } - - //190 - } - - private static final LinkedHashMap<String, ItemStack> invNameToDisplayMap = new LinkedHashMap<>(); - static { - invNameToDisplayMap.put("inv_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.chest), EnumChatFormatting.GRAY+"Inventory")); - invNameToDisplayMap.put("ender_chest_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.ender_chest), EnumChatFormatting.GRAY+"Ender Chest")); - invNameToDisplayMap.put("talisman_bag", Utils.createItemStack(Items.golden_apple, EnumChatFormatting.GRAY+"Accessory Bag")); - invNameToDisplayMap.put("wardrobe_contents", Utils.createItemStack(Items.leather_chestplate, EnumChatFormatting.GRAY+"Wardrobe")); - invNameToDisplayMap.put("fishing_bag", Utils.createItemStack(Items.fish, EnumChatFormatting.GRAY+"Fishing Bag")); - invNameToDisplayMap.put("potion_bag", Utils.createItemStack(Items.potionitem, EnumChatFormatting.GRAY+"Potion Bag")); - } - - public int countItemsInInventory(String internalname, JsonObject inventoryInfo, String... invsToSearch) { - int count = 0; - for(String inv : invsToSearch) { - JsonArray invItems = inventoryInfo.get(inv).getAsJsonArray(); - for(int i=0; i<invItems.size(); i++) { - if(invItems.get(i) == null || !invItems.get(i).isJsonObject()) continue; - JsonObject item = invItems.get(i).getAsJsonObject(); - if(item.get("internalname").getAsString().equals(internalname)) { - if(item.has("count")) { - count += item.get("count").getAsInt(); - } else { - count += 1; - } - } - } - } - return count; - } - - private static final Pattern DAMAGE_PATTERN = Pattern.compile("^Damage: \\+([0-9]+)"); - private static final Pattern STRENGTH_PATTERN = Pattern.compile("^Strength: \\+([0-9]+)"); - private static final Pattern FISHSPEED_PATTERN = Pattern.compile("^Increases fishing speed by \\+([0-9]+)"); - - private ItemStack[] findBestItems(JsonObject inventoryInfo, int numItems, String[] invsToSearch, String[] typeMatches, Pattern... importantPatterns) { - ItemStack[] bestItems = new ItemStack[numItems]; - TreeMap<Integer, Set<ItemStack>> map = new TreeMap<>(); - for(String inv : invsToSearch) { - JsonArray invItems = inventoryInfo.get(inv).getAsJsonArray(); - for(int i=0; i<invItems.size(); i++) { - if(invItems.get(i) == null || !invItems.get(i).isJsonObject()) continue; - JsonObject item = invItems.get(i).getAsJsonObject(); - JsonArray lore = item.get("lore").getAsJsonArray(); - if(Utils.checkItemType(lore, true, typeMatches) >= 0) { - int importance = 0; - for(int j=0; j<lore.size(); j++) { - String line = lore.get(j).getAsString(); - for(Pattern pattern : importantPatterns) { - Matcher matcher = pattern.matcher(Utils.cleanColour(line)); - if(matcher.find()) { - importance += Integer.parseInt(matcher.group(1)); - } - } - } - map.computeIfAbsent(importance, k->new HashSet<>()).add( - NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, false)); - } - } - } - int i=0; - outer: - for(int key : map.descendingKeySet()) { - Set<ItemStack> items = map.get(key); - for(ItemStack item : items) { - bestItems[i] = item; - if(++i >= bestItems.length) break outer; - } - } - - return bestItems; - } - - private int getRowsForInventory(String invName) { - switch(invName) { - case "wardrobe_contents": - return 4; - } - return 6; - } - - private boolean useActualMax(String invName) { - switch(invName) { - case "talisman_bag": - case "fishing_bag": - case "potion_bag": - return true; - } - return false; - } - - private int getIgnoredRowsForInventory(String invName) { - switch(invName) { - case "talisman_bag": - case "fishing_bag": - case "potion_bag": - return 1; - } - return 0; - } - - private int getAvailableSlotsForInventory(JsonObject inventoryInfo, JsonObject collectionInfo, String invName) { - if(collectionInfo == null) return -1; - JsonObject misc = Constants.MISC; - if(misc == null) return -1; - JsonElement sizesElement = Utils.getElement(misc, "bag_size."+invName+".sizes"); - JsonElement collectionElement = Utils.getElement(misc, "bag_size."+invName+".collection"); - - if(sizesElement == null || !sizesElement.isJsonArray()) return -1; - if(collectionElement == null || !collectionElement.isJsonPrimitive()) return -1; - - JsonArray sizes = sizesElement.getAsJsonArray(); - String collection = collectionElement.getAsString(); - - JsonElement tierElement = Utils.getElement(collectionInfo, "collection_tiers."+collection); - - if(tierElement == null || !tierElement.isJsonPrimitive()) { - return 0; - } - int tier = tierElement.getAsInt(); - - int currentSlots = 0; - for(int i=0; i<sizes.size(); i++) { - JsonObject sizeInfo = sizes.get(i).getAsJsonObject(); - if(sizeInfo.get("tier").getAsInt() <= tier) { - currentSlots = sizeInfo.get("slots").getAsInt(); - } - } - return currentSlots; - } - - private ItemStack fillerStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, 15); - public ItemStack[][][] getItemsForInventory(JsonObject inventoryInfo, String invName) { - if(inventoryItems.containsKey(invName)) return inventoryItems.get(invName); - - JsonArray jsonInv = Utils.getElement(inventoryInfo, invName).getAsJsonArray(); - - if(jsonInv.size() == 0) return new ItemStack[1][][]; - - int jsonInvSize; - if(useActualMax(invName)) { - jsonInvSize = (int)Math.ceil(jsonInv.size()/9f)*9; - } else { - jsonInvSize = 9*4; - for(int i=9*4; i<jsonInv.size(); i++) { - JsonElement item = jsonInv.get(i); - if(item != null && item.isJsonObject()) { - jsonInvSize = (i/9)*9; - } - } - } - - int rowSize = 9; - int rows = jsonInvSize/rowSize; - int maxRowsPerPage = getRowsForInventory(invName); - int maxInvSize = rowSize*maxRowsPerPage; - - int numInventories = (jsonInvSize-1)/maxInvSize+1; - - ItemStack[][][] inventories = new ItemStack[numInventories][][]; - - //int availableSlots = getAvailableSlotsForInventory(inventoryInfo, collectionInfo, invName); - - for(int i=0; i<numInventories; i++) { - int thisRows = Math.min(maxRowsPerPage, rows-maxRowsPerPage*i); - if(thisRows <= 0) break; - - ItemStack[][] items = new ItemStack[thisRows][rowSize]; - - int invSize = Math.min(jsonInvSize, maxInvSize+maxInvSize*i); - for(int j=maxInvSize*i; j<invSize; j++) { - int xIndex = (j%maxInvSize)%rowSize; - int yIndex = (j%maxInvSize)/rowSize; - if(invName.equals("inv_contents")) { - yIndex--; - if(yIndex < 0) yIndex = rows-1; - } - if(yIndex >= thisRows) { - break; - } - - if(j >= jsonInv.size()) { - items[yIndex][xIndex] = fillerStack; - continue; - } - if(jsonInv.get(j) == null || !jsonInv.get(j).isJsonObject()) { - continue; - } - - JsonObject item = jsonInv.get(j).getAsJsonObject(); - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, false); - if(item.has("item_contents")) { - JsonArray bytesArr = item.get("item_contents").getAsJsonArray(); - byte[] bytes = new byte[bytesArr.size()]; - for(int bytesArrI=0; bytesArrI<bytesArr.size(); bytesArrI++) { - bytes[bytesArrI] = bytesArr.get(bytesArrI).getAsByte(); - } - //byte[] bytes2 = null; - NBTTagCompound tag = stack.getTagCompound(); - if(tag != null && tag.hasKey("ExtraAttributes", 10)) { - NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); - for(String key : ea.getKeySet()) { - if(key.endsWith("backpack_data") || key.equals("new_year_cake_bag_data")) { - ea.setTag(key, new NBTTagByteArray(bytes)); - break; - } - } - tag.setTag("ExtraAttributes", ea); - stack.setTagCompound(tag); - } - } - items[yIndex][xIndex] = stack; - } - inventories[i] = items; - } - - inventoryItems.put(invName, inventories); - return inventories; - } - - - private ItemStack[] bestWeapons = null; - private ItemStack[] bestRods = null; - private ItemStack[] armorItems = null; - private HashMap<String, ItemStack[][][]> inventoryItems = new HashMap<>(); - private String selectedInventory = "inv_contents"; - private int currentInventoryIndex = 0; - private int arrowCount = -1; - private int greenCandyCount = -1; - private int purpleCandyCount = -1; - private GuiElementTextField inventoryTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT); - private ItemStack lastBackpack; - private int lastBackpackX; - private int lastBackpackY; - private void drawInvsPage(int mouseX, int mouseY, float partialTicks) { - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_invs); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - inventoryTextField.setSize(88, 20); - - JsonObject inventoryInfo = profile.getInventoryInfo(profileId); - if(inventoryInfo == null) return; - - int invNameIndex=0; - for(Map.Entry<String, ItemStack> entry : invNameToDisplayMap.entrySet()) { - int xIndex = invNameIndex%3; - int yIndex = invNameIndex/3; - - int x = 19+34*xIndex; - int y = 26+34*yIndex; - - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); - if(entry.getKey().equals(selectedInventory)) { - Utils.drawTexturedRect(guiLeft+x-2, guiTop+y-2, 20, 20, 20/256f, 0, - 20/256f, 0, GL11.GL_NEAREST); - x++; - y++; - } else { - Utils.drawTexturedRect(guiLeft+x-2, guiTop+y-2, 20, 20, 0, 20/256f, - 0, 20/256f, GL11.GL_NEAREST); - } - - Utils.drawItemStackWithText(entry.getValue(), guiLeft+x, guiTop+y, ""+(invNameIndex+1)); - - if(mouseX >= guiLeft+x && mouseX <= guiLeft+x+16) { - if(mouseY >= guiTop+y && mouseY <= guiTop+y+16) { - tooltipToDisplay = entry.getValue().getTooltip(Minecraft.getMinecraft().thePlayer, false); - } - } - - invNameIndex++; - } - - inventoryTextField.render(guiLeft+19, guiTop+sizeY-26-20); - - if(armorItems == null) { - armorItems = new ItemStack[4]; - JsonArray armor = Utils.getElement(inventoryInfo, "inv_armor").getAsJsonArray(); - for(int i=0; i<armor.size(); i++) { - if(armor.get(i) == null || !armor.get(i).isJsonObject()) continue; - armorItems[i] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(armor.get(i).getAsJsonObject(), false); - } - } - - for(int i=0; i<armorItems.length; i++) { - ItemStack stack = armorItems[i]; - if(stack != null) { - Utils.drawItemStack(stack, guiLeft+173, guiTop+67-18*i); - if(stack != fillerStack) { - if(mouseX >= guiLeft+173-1 && mouseX <= guiLeft+173+16+1) { - if(mouseY >= guiTop+67-18*i-1 && mouseY <= guiTop+67-18*i+16+1) { - tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, - Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - } - } - } - } - } - - ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, selectedInventory); - if(currentInventoryIndex >= inventories.length) currentInventoryIndex = inventories.length-1; - if(currentInventoryIndex < 0) currentInventoryIndex = 0; - - ItemStack[][] inventory = inventories[currentInventoryIndex]; - if(inventory == null) { - Utils.drawStringCentered(EnumChatFormatting.RED+"Inventory API not enabled!", Minecraft.getMinecraft().fontRendererObj, - guiLeft+317, guiTop+101, true, 0); - return; - } - - if(bestWeapons == null) { - bestWeapons = findBestItems(inventoryInfo, 6, new String[]{"inv_contents", "ender_chest_contents"}, - new String[]{"SWORD","BOW"}, DAMAGE_PATTERN, STRENGTH_PATTERN); - } - if(bestRods == null) { - bestRods = findBestItems(inventoryInfo, 3, new String[]{"inv_contents", "ender_chest_contents"}, - new String[]{"FISHING ROD"}, FISHSPEED_PATTERN); - } - - for(int i=0; i<bestWeapons.length; i++) { - if(bestWeapons[i] == null) continue; - ItemStack stack = bestWeapons[i]; - Utils.drawItemStack(stack, guiLeft+143, guiTop+13+18*i); - if(mouseX >= guiLeft+143-1 && mouseX <= guiLeft+143+16+1) { - if(mouseY >= guiTop+13+18*i-1 && mouseY <= guiTop+13+18*i+16+1) { - tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - } - } - } - - for(int i=0; i<bestRods.length; i++) { - if(bestRods[i] == null) continue; - ItemStack stack = bestRods[i]; - Utils.drawItemStack(stack, guiLeft+143, guiTop+137+18*i); - if(mouseX >= guiLeft+143-1 && mouseX <= guiLeft+143+16+1) { - if(mouseY >= guiTop+137+18*i-1 && mouseY <= guiTop+137+18*i+16+1) { - tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - } - } - } - - if(arrowCount == -1) { - arrowCount = countItemsInInventory("ARROW", inventoryInfo, "quiver"); - } - if(greenCandyCount == -1) { - greenCandyCount = countItemsInInventory("GREEN_CANDY", inventoryInfo, "candy_inventory_contents"); - } - if(purpleCandyCount == -1) { - purpleCandyCount = countItemsInInventory("PURPLE_CANDY", inventoryInfo, "candy_inventory_contents"); - } - - Utils.drawItemStackWithText(NotEnoughUpdates.INSTANCE.manager.jsonToStack( - NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ARROW")), guiLeft+173, guiTop+101, - ""+(arrowCount>999?shortNumberFormat(arrowCount, 0):arrowCount)); - Utils.drawItemStackWithText(NotEnoughUpdates.INSTANCE.manager.jsonToStack( - NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("GREEN_CANDY")), guiLeft+173, guiTop+119, ""+greenCandyCount); - Utils.drawItemStackWithText(NotEnoughUpdates.INSTANCE.manager.jsonToStack( - NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PURPLE_CANDY")), guiLeft+173, guiTop+137, ""+purpleCandyCount); - if(mouseX > guiLeft+173 && mouseX < guiLeft+173+16) { - if(mouseY > guiTop+101 && mouseY < guiTop+137+16) { - if(mouseY < guiTop+101+17) { - tooltipToDisplay = Utils.createList(EnumChatFormatting.WHITE+"Arrow "+EnumChatFormatting.GRAY+"x"+arrowCount); - } else if(mouseY < guiTop+119+17) { - tooltipToDisplay = Utils.createList(EnumChatFormatting.GREEN+"Green Candy "+EnumChatFormatting.GRAY+"x"+greenCandyCount); - } else { - tooltipToDisplay = Utils.createList(EnumChatFormatting.DARK_PURPLE+"Purple Candy "+EnumChatFormatting.GRAY+"x"+purpleCandyCount); - } - } - } - - int inventoryRows = inventory.length; - - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - Minecraft.getMinecraft().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); - - int invSizeY = inventoryRows*18+17+7; - - int x = guiLeft+320-176/2; - int y = guiTop+101-invSizeY/2; - - this.drawTexturedModalRect(x, y, 0, 0, 176, inventoryRows*18+17); - this.drawTexturedModalRect(x, y+inventoryRows*18+17, 0, 215, 176, 7); - - boolean leftHovered = false; - boolean rightHovered = false; - if(Mouse.isButtonDown(0)) { - if(mouseY > y+invSizeY && mouseY < y+invSizeY+16) { - if(mouseX > guiLeft+320-12 && mouseX < guiLeft+320+12) { - if(mouseX < guiLeft+320) { - leftHovered = true; - } else { - rightHovered = true; - } - } - } - } - Minecraft.getMinecraft().getTextureManager().bindTexture(resource_packs); - - if(currentInventoryIndex > 0) { - Utils.drawTexturedRect(guiLeft+320-12, y+invSizeY, 12, 16, - 29/256f, 53/256f, !leftHovered?0:32/256f, !leftHovered?32/256f:64/256f, GL11.GL_NEAREST); - } - if(currentInventoryIndex < inventories.length-1) { - Utils.drawTexturedRect(guiLeft+320, y+invSizeY, 12, 16, - 5/256f, 29/256f, !rightHovered?0:32/256f, !rightHovered?32/256f:64/256f, GL11.GL_NEAREST); - } - - fontRendererObj.drawString(Utils.cleanColour(invNameToDisplayMap.get(selectedInventory).getDisplayName()), x+8, y+6, 4210752); - - ItemStack stackToRender = null; - int overlay = new Color(0, 0, 0, 100).getRGB(); - for(int yIndex=0; yIndex<inventory.length; yIndex++) { - if(inventory[yIndex] == null) continue; - - for(int xIndex=0; xIndex<inventory[yIndex].length; xIndex++) { - ItemStack stack = inventory[yIndex][xIndex]; - - if(stack != null) Utils.drawItemStack(stack, x+8+xIndex*18, y+18+yIndex*18); - - if(inventoryTextField.getText() != null && !inventoryTextField.getText().isEmpty() && - (stack == null || !NotEnoughUpdates.INSTANCE.manager.doesStackMatchSearch(stack, inventoryTextField.getText()))) { - GlStateManager.translate(0, 0, 50); - drawRect(x+8+xIndex*18, y+18+yIndex*18, x+8+xIndex*18+16, y+18+yIndex*18+16, overlay); - GlStateManager.translate(0, 0, -50); - } - - if(stack == null || stack == fillerStack) continue; - - if(mouseX >= x+8+xIndex*18 && mouseX <= x+8+xIndex*18+16) { - if(mouseY >= y+18+yIndex*18 && mouseY <= y+18+yIndex*18+16) { - stackToRender = stack; - } - } - } - } - if(stackToRender != null) { - tooltipToDisplay = stackToRender.getTooltip(Minecraft.getMinecraft().thePlayer, false); - } - - } - - private String niceUuid(String uuidStr) { - if(uuidStr.length()!=32) return uuidStr; - - StringBuilder niceAucId = new StringBuilder(); - niceAucId.append(uuidStr, 0, 8); - niceAucId.append("-"); - niceAucId.append(uuidStr, 8, 12); - niceAucId.append("-"); - niceAucId.append(uuidStr, 12, 16); - niceAucId.append("-"); - niceAucId.append(uuidStr, 16, 20); - niceAucId.append("-"); - niceAucId.append(uuidStr, 20, 32); - return niceAucId.toString(); - } - - public EntityOtherPlayerMP getEntityPlayer() { - return entityPlayer; - } - - private EntityOtherPlayerMP entityPlayer = null; - private ResourceLocation playerLocationSkin = null; - private ResourceLocation playerLocationCape = null; - private String skinType = null; - - private HashMap<String, ResourceLocation[]> panoramasMap = new HashMap<>(); - - public ResourceLocation[] getPanoramasForLocation(String location, String identifier) { - if(panoramasMap.containsKey(location+identifier)) return panoramasMap.get(location+identifier); - try { - ResourceLocation[] panoramasArray = new ResourceLocation[6]; - for(int i=0; i<6; i++) { - panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/"+location+"_"+identifier+"/panorama_"+i+".jpg"); - Minecraft.getMinecraft().getResourceManager().getResource(panoramasArray[i]); - } - panoramasMap.put(location+identifier, panoramasArray); - return panoramasArray; - } catch(IOException e) { - try { - ResourceLocation[] panoramasArray = new ResourceLocation[6]; - for(int i=0; i<6; i++) { - panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/"+location+"/panorama_"+i+".jpg"); - Minecraft.getMinecraft().getResourceManager().getResource(panoramasArray[i]); - } - panoramasMap.put(location+identifier, panoramasArray); - return panoramasArray; - } catch(IOException e2) { - ResourceLocation[] panoramasArray = new ResourceLocation[6]; - for(int i=0; i<6; i++) { - panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/unknown/panorama_"+i+".jpg"); - } - panoramasMap.put(location+identifier, panoramasArray); - return panoramasArray; - } - } - } - - private TreeMap<Integer, Set<String>> topKills = null; - private TreeMap<Integer, Set<String>> topDeaths = null; - - private void drawExtraPage(int mouseX, int mouseY, float partialTicks) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_extra); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - - JsonObject profileInfo = profile.getProfileInformation(profileId); - if(profileInfo == null) return; - JsonObject skillInfo = profile.getSkillInfo(profileId); - - float xStart = 22; - float xOffset = 103; - float yStartTop = 27; - float yStartBottom = 109; - float yOffset = 10; - - float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0); - float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0); - - Utils.renderAlignedString(EnumChatFormatting.GOLD+"Bank Balance", EnumChatFormatting.WHITE.toString()+shortNumberFormat(bankBalance, 0), - guiLeft+xStart, guiTop+yStartTop, 76); - Utils.renderAlignedString(EnumChatFormatting.GOLD+"Purse", EnumChatFormatting.WHITE.toString()+shortNumberFormat(purseBalance, 0), - guiLeft+xStart, guiTop+yStartTop+yOffset, 76); - - - float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_souls_collected"), 0); - - int fairySoulMax = 227; - if(Constants.FAIRYSOULS != null && Constants.FAIRYSOULS.has("Max Souls")) { - fairySoulMax = Constants.FAIRYSOULS.get("Max Souls").getAsInt(); - } - Utils.renderAlignedString(EnumChatFormatting.LIGHT_PURPLE+"Fairy Souls", EnumChatFormatting.WHITE.toString()+(int)fairySouls+"/"+fairySoulMax, - guiLeft+xStart, guiTop+yStartBottom, 76); - if(skillInfo != null) { - float totalSkillLVL = 0; - float totalTrueSkillLVL = 0; - float totalSlayerLVL = 0; - float totalSkillCount = 0; - float totalSlayerCount = 0; - - for(Map.Entry<String, JsonElement> entry : skillInfo.entrySet()) { - if(entry.getKey().startsWith("level_skill")) { - if(entry.getKey().contains("runecrafting")) continue; - if(entry.getKey().contains("carpentry")) continue; - if(entry.getKey().contains("catacombs")) continue; - - totalSkillLVL += entry.getValue().getAsFloat(); - totalTrueSkillLVL += Math.floor(entry.getValue().getAsFloat()); - totalSkillCount++; - } else if(entry.getKey().startsWith("level_slayer")) { - totalSlayerLVL += entry.getValue().getAsFloat(); - totalSlayerCount++; - } - } - - float avgSkillLVL = totalSkillLVL/totalSkillCount; - float avgTrueSkillLVL = totalTrueSkillLVL/totalSkillCount; - float avgSlayerLVL = totalSlayerLVL/totalSlayerCount; - - Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSkillLVL*10)/10, - guiLeft+xStart, guiTop+yStartBottom+yOffset, 76); - Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10, - guiLeft+xStart, guiTop+yStartBottom+yOffset*2, 76); - Utils.renderAlignedString(EnumChatFormatting.RED+"True AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgTrueSkillLVL*10)/10, - guiLeft+xStart, guiTop+yStartBottom+yOffset*3, 76); - } - - - float auctions_bids = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_bids"), 0); - float auctions_highest_bid = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_highest_bid"), 0); - float auctions_won = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_won"), 0); - float auctions_created = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_created"), 0); - float auctions_gold_spent = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_gold_spent"), 0); - float auctions_gold_earned = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_gold_earned"), 0); - - Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auction Bids", EnumChatFormatting.WHITE.toString()+(int)auctions_bids, - guiLeft+xStart+xOffset, guiTop+yStartTop, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Highest Bid", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_highest_bid, 0), - guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Won", EnumChatFormatting.WHITE.toString()+(int)auctions_won, - guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*2, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Created", EnumChatFormatting.WHITE.toString()+(int)auctions_created, - guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*3, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Spent", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_spent, 0), - guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*4, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Earned", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_earned, 0), - guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*5, 76); - - - float zombie_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.boss_kills_tier_2"), 0); - float zombie_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.boss_kills_tier_3"), 0); - float spider_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.boss_kills_tier_2"), 0); - float spider_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.boss_kills_tier_3"), 0); - float wolf_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.boss_kills_tier_2"), 0); - float wolf_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.boss_kills_tier_3"), 0); - - Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T3", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_2, - guiLeft+xStart+xOffset, guiTop+yStartBottom, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T4", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_3, - guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T3", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_2, - guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*2, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T4", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_3, - guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*3, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T3", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_2, - guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*4, 76); - Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T4", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_3, - guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*5, 76); - - float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.pet_milestone_ores_mined"), 0); - float pet_milestone_sea_creatures_killed = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.pet_milestone_sea_creatures_killed"), 0); - - float items_fished = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished"), 0); - float items_fished_treasure = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished_treasure"), 0); - float items_fished_large_treasure = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished_large_treasure"), 0); - - Utils.renderAlignedString(EnumChatFormatting.GREEN+"Ores Mined", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_ores_mined, - guiLeft+xStart+xOffset*2, guiTop+yStartTop, 76); - Utils.renderAlignedString(EnumChatFormatting.GREEN+"Sea Creatures Killed", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_sea_creatures_killed, - guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset, 76); - - Utils.renderAlignedString(EnumChatFormatting.GREEN+"Items Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished, - guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*3, 76); - Utils.renderAlignedString(EnumChatFormatting.GREEN+"Treasures Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished_treasure, - guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*4, 76); - Utils.renderAlignedString(EnumChatFormatting.GREEN+"Large Treasures", EnumChatFormatting.WHITE.toString()+(int)items_fished_large_treasure, - guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*5, 76); - - if(topKills == null) { - topKills = new TreeMap<>(); - JsonObject stats = profileInfo.get("stats").getAsJsonObject(); - for(Map.Entry<String, JsonElement> entry : stats.entrySet()) { - if(entry.getKey().startsWith("kills_")) { - if(entry.getValue().isJsonPrimitive()) { - JsonPrimitive prim = (JsonPrimitive) entry.getValue(); - if(prim.isNumber()) { - String name = WordUtils.capitalizeFully(entry.getKey().substring("kills_".length()).replace("_", " ")); - Set<String> kills = topKills.computeIfAbsent(prim.getAsInt(), k->new HashSet<>()); - kills.add(name); - } - } - } - } - } - if(topDeaths == null) { - topDeaths = new TreeMap<>(); - JsonObject stats = profileInfo.get("stats").getAsJsonObject(); - for(Map.Entry<String, JsonElement> entry : stats.entrySet()) { - if(entry.getKey().startsWith("deaths_")) { - if(entry.getValue().isJsonPrimitive()) { - JsonPrimitive prim = (JsonPrimitive) entry.getValue(); - if(prim.isNumber()) { - String name = WordUtils.capitalizeFully(entry.getKey().substring("deaths_".length()).replace("_", " ")); - Set<String> deaths = topDeaths.computeIfAbsent(prim.getAsInt(), k->new HashSet<>()); - deaths.add(name); - } - } - } - } - } - - int index = 0; - for(int killCount : topKills.descendingKeySet()) { - if(index >= 6) break; - Set<String> kills = topKills.get(killCount); - for(String killType : kills) { - if(index >= 6) break; - Utils.renderAlignedString(EnumChatFormatting.YELLOW+killType+" Kills", EnumChatFormatting.WHITE.toString()+killCount, - guiLeft+xStart+xOffset*3, guiTop+yStartTop+yOffset*index, 76); - index++; - } - } - index = 0; - for(int deathCount : topDeaths.descendingKeySet()) { - if(index >= 6) break; - Set<String> deaths = topDeaths.get(deathCount); - for(String deathType : deaths) { - if(index >= 6) break; - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Deaths: "+ deathType, EnumChatFormatting.WHITE.toString()+deathCount, - guiLeft+xStart+xOffset*3, guiTop+yStartBottom+yOffset*index, 76); - index++; - } - } - } - - private int backgroundClickedX = -1; - - private static char[] c = new char[]{'k', 'm', 'b', 't'}; - - public static String shortNumberFormat(double n, int iteration) { - if(n < 1000) { - if(n % 1 == 0) { - return Integer.toString((int)n); - } else { - return String.format("%.2f", n); - } - } - - double d = ((long) n / 100) / 10.0; - boolean isRound = (d * 10) %10 == 0; - return (d < 1000? - ((d > 99.9 || isRound || (!isRound && d > 9.99)? - (int) d * 10 / 10 : d + "" - ) + "" + c[iteration]) - : shortNumberFormat(d, iteration+1)); - } - - private boolean loadingProfile = false; - private static final ExecutorService profileLoader = Executors.newFixedThreadPool(1); - - private void drawBasicPage(int mouseX, int mouseY, float partialTicks) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - String location = null; - JsonObject status = profile.getPlayerStatus(); - if(status != null && status.has("mode")) { - location = status.get("mode").getAsString(); - } - - int extraRotation = 0; - if(Mouse.isButtonDown(0) || Mouse.isButtonDown(1)) { - if(backgroundClickedX == -1) { - if(mouseX > guiLeft+23 && mouseX < guiLeft+23+81) { - if(mouseY > guiTop+44 && mouseY < guiTop+44+108) { - backgroundClickedX = mouseX; - } - } - } - } else { - if(backgroundClickedX != -1) { - backgroundRotation += mouseX - backgroundClickedX; - backgroundClickedX = -1; - } - } - if(backgroundClickedX == -1) { - backgroundRotation += (currentTime - lastTime)/400f; - } else { - extraRotation = mouseX - backgroundClickedX; - } - backgroundRotation %= 360; - - String panoramaIdentifier = "day"; - if(SBInfo.getInstance().currentTimeDate != null) { - if(SBInfo.getInstance().currentTimeDate.getHours() <= 6 || - SBInfo.getInstance().currentTimeDate.getHours() >= 20) { - panoramaIdentifier = "night"; - } - } - - Panorama.drawPanorama(-backgroundRotation-extraRotation, guiLeft+23, guiTop+44, 81, 108, 0.37f, 0.8f, - getPanoramasForLocation(location==null?"unknown":location, panoramaIdentifier)); - - Minecraft.getMinecraft().getTextureManager().bindTexture(pv_basic); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - - if(entityPlayer != null && profile.getHypixelProfile() != null) { - String playerName = null; - if(profile.getHypixelProfile().has("prefix")) { - playerName = Utils.getElementAsString(profile.getHypixelProfile().get("prefix"), "") + " " + entityPlayer.getName(); - } else { - String rank = Utils.getElementAsString(profile.getHypixelProfile().get("rank"), - Utils.getElementAsString(profile.getHypixelProfile().get("newPackageRank"), "NONE"));; - String monthlyPackageRank = Utils.getElementAsString(profile.getHypixelProfile().get("monthlyPackageRank"), "NONE"); - if(!rank.equals("YOUTUBER") && !monthlyPackageRank.equals("NONE")) { - rank = monthlyPackageRank; - } - EnumChatFormatting rankPlusColorECF = EnumChatFormatting.getValueByName(Utils.getElementAsString(profile.getHypixelProfile().get("rankPlusColor"), - "GOLD")); - String rankPlusColor = EnumChatFormatting.GOLD.toString(); - if(rankPlusColorECF != null) { - rankPlusColor = rankPlusColorECF.toString(); - } - - JsonObject misc = Constants.MISC; - if(misc != null) { - if(misc.has("ranks")) { - String rankName = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".tag"), null); - String rankColor = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".color"), "7"); - String rankPlus = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".plus"), ""); - - String name = entityPlayer.getName(); - - if(misc.has("special_bois")) { - JsonArray special_bois = misc.get("special_bois").getAsJsonArray(); - for(int i=0; i<special_bois.size(); i++) { - if(special_bois.get(i).getAsString().equals(profile.getUuid())) { - name = Utils.chromaString(name); - break; - } - } - } - - playerName = EnumChatFormatting.GRAY.toString() + name; - if(rankName != null) { - StringBuilder sb = new StringBuilder(); - sb.append("\u00A7"+rankColor); - sb.append("["); - sb.append(rankName); - sb.append(rankPlusColor); - sb.append(rankPlus); - sb.append("\u00A7"+rankColor); - sb.append("] "); - sb.append(name); - playerName = sb.toString(); - } - } - } - - } - if(playerName != null) { - int rankPrefixLen = fr.getStringWidth(playerName); - int halfRankPrefixLen = rankPrefixLen/2; - - int x = guiLeft+63; - int y = guiTop+54; - - drawRect(x-halfRankPrefixLen-1, y-1, x+halfRankPrefixLen+1, y+8, new Color(0, 0, 0, 64).getRGB()); - - fr.drawString(playerName, x-halfRankPrefixLen, y, 0, true); - } - } - - long networth = profile.getNetWorth(profileId); - if(networth > 0) { - Utils.drawStringCentered(EnumChatFormatting.GREEN+"Net Worth: "+EnumChatFormatting.GOLD+numberFormat.format(networth), fr, guiLeft+63, guiTop+38, true, 0); - try { - double networthInCookies = (networth / NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE").get("avg_buy").getAsDouble()); - String networthIRLMoney = Long.toString(Math.round(((networthInCookies * 325) / 675) * 4.99)); - - if(mouseX > guiLeft+8 && mouseX < guiLeft+8+fontRendererObj.getStringWidth("Net Worth: " + numberFormat.format(networth))) { - if(mouseY > guiTop+32 && mouseY < guiTop+32+fontRendererObj.FONT_HEIGHT) { - tooltipToDisplay = new ArrayList<>(); - tooltipToDisplay.add(EnumChatFormatting.GREEN+"Net worth in IRL money: "+EnumChatFormatting.DARK_GREEN+"$" +EnumChatFormatting.GOLD+networthIRLMoney); - tooltipToDisplay.add(""); - if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - tooltipToDisplay.add(EnumChatFormatting.RED+"This is calculated using the current"); - tooltipToDisplay.add(EnumChatFormatting.RED+"price of booster cookies on bazaar and the price"); - tooltipToDisplay.add(EnumChatFormatting.RED+"for cookies using gems, then the price of gems"); - tooltipToDisplay.add(EnumChatFormatting.RED+"is where we get the amount of IRL money you" ); - tooltipToDisplay.add(EnumChatFormatting.RED+"theoretically have on skyblock in net worth."); - } else { - tooltipToDisplay.add(EnumChatFormatting.GRAY+"[SHIFT for Info]"); - } - tooltipToDisplay.add(""); - tooltipToDisplay.add(EnumChatFormatting.RED+"THIS IS IN NO WAY ENDORSING IRL TRADING!"); - - } - } - } catch(Exception e){} - } - - if(status != null) { - JsonElement onlineElement = Utils.getElement(status, "online"); - boolean online = onlineElement != null && onlineElement.isJsonPrimitive() && onlineElement.getAsBoolean(); - String statusStr = online ? EnumChatFormatting.GREEN + "ONLINE" : EnumChatFormatting.RED + "OFFLINE"; - String locationStr = null; - if(profile.getUuid().equals("20934ef9488c465180a78f861586b4cf")) { - locationStr = "Ignoring DMs"; - } else { - if(location != null) { - JsonObject misc = Constants.MISC; - if(misc != null) { - locationStr = Utils.getElementAsString(Utils.getElement(misc, "area_names."+location), "Unknown"); - } - } - } - if(locationStr != null) { - statusStr += EnumChatFormatting.GRAY+" - "+EnumChatFormatting.GREEN+locationStr; - } - - Utils.drawStringCentered(statusStr, fr, guiLeft+63, guiTop+160, true, 0); - } - - if(entityPlayer == null) { - if(!loadingProfile || ((ThreadPoolExecutor)profileLoader).getActiveCount() == 0) { - loadingProfile = true; - UUID playerUUID = UUID.fromString(niceUuid(profile.getUuid())); - - profileLoader.submit(() -> { - GameProfile fakeProfile = Minecraft.getMinecraft().getSessionService().fillProfileProperties(new GameProfile(playerUUID, "CoolGuy123"), false); - entityPlayer = new EntityOtherPlayerMP(Minecraft.getMinecraft().theWorld, fakeProfile) { - public ResourceLocation getLocationSkin() { - return playerLocationSkin == null ? DefaultPlayerSkin.getDefaultSkin(this.getUniqueID()) : playerLocationSkin; - } - - public ResourceLocation getLocationCape() { - return playerLocationCape; - } - - public String getSkinType() { - return skinType == null ? DefaultPlayerSkin.getSkinType(this.getUniqueID()) : skinType; - } - }; - entityPlayer.setAlwaysRenderNameTag(false); - entityPlayer.setCustomNameTag(""); - }); - } - } else { - entityPlayer.refreshDisplayName(); - byte b = 0; - for(EnumPlayerModelParts part : EnumPlayerModelParts.values()) { - b |= part.getPartMask(); - } - entityPlayer.getDataWatcher().updateObject(10, b); - } - - JsonObject profileInfo = profile.getProfileInformation(profileId); - if(profileInfo == null) return; - - JsonObject skillInfo = profile.getSkillInfo(profileId); - JsonObject inventoryInfo = profile.getInventoryInfo(profileId); - - if(entityPlayer != null) { - if(backgroundClickedX != -1 && Mouse.isButtonDown(1)) { - Arrays.fill(entityPlayer.inventory.armorInventory, null); - } else { - if(inventoryInfo != null && inventoryInfo.has("inv_armor")) { - JsonArray items = inventoryInfo.get("inv_armor").getAsJsonArray(); - if(items != null && items.size() == 4) { - for(int i=0; i<entityPlayer.inventory.armorInventory.length; i++) { - JsonElement itemElement = items.get(i); - if(itemElement != null && itemElement.isJsonObject()) { - entityPlayer.inventory.armorInventory[i] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(itemElement.getAsJsonObject(), false); - } - } - } - } else { - Arrays.fill(entityPlayer.inventory.armorInventory, null); - } - } - if(entityPlayer.getUniqueID().toString().equals("ae6193ab-494a-4719-b6e7-d50392c8f012")) { - entityPlayer.inventory.armorInventory[3] = NotEnoughUpdates.INSTANCE.manager.jsonToStack( - NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SMALL_BACKPACK")); - } - } - - if(entityPlayer != null && playerLocationSkin == null) { - try { - Minecraft.getMinecraft().getSkinManager().loadProfileTextures(entityPlayer.getGameProfile(), new SkinManager.SkinAvailableCallback() { - public void skinAvailable(MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) { - switch (type) { - case SKIN: - playerLocationSkin = location; - skinType = profileTexture.getMetadata("model"); - - if(skinType == null) { - skinType = "default"; - } - - break; - case CAPE: - playerLocationCape = location; - } - } - }, false); - } catch(Exception e){} - } - - GlStateManager.color(1, 1, 1, 1); - JsonObject petsInfo = profile.getPetsInfo(profileId); - if(petsInfo != null) { - JsonElement activePetElement = petsInfo.get("active_pet"); - if(activePetElement != null && activePetElement.isJsonObject()) { - JsonObject activePet = activePetElement.getAsJsonObject(); - - String type = activePet.get("type").getAsString(); - - for(int i=0; i<4; i++) { - JsonObject item = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(type+";"+i); - if(item != null) { - int x = guiLeft+50; - float y = guiTop+82+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI)); - GlStateManager.translate(x, y, 0); - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, false); - - //Remove extra attributes so no CIT - NBTTagCompound stackTag = stack.getTagCompound()==null?new NBTTagCompound():stack.getTagCompound(); - stackTag.removeTag("ExtraAttributes"); - stack.setTagCompound(stackTag); - - GlStateManager.scale(-1.5f, 1.5f, 1); - GlStateManager.enableDepth(); - Utils.drawItemStack(stack, 0, 0); - GlStateManager.scale(-1/1.5f, 1/1.5f, 1); - GlStateManager.translate(-x, -y, 0); - break; - } - } - } - } - if(entityPlayer != null) { - drawEntityOnScreen(guiLeft+63, guiTop+128+7, 36, guiLeft+63-mouseX, guiTop+129-mouseY, entityPlayer); - } - - PlayerStats.Stats stats = profile.getStats(profileId); - - if(stats != null) { - Splitter splitter = Splitter.on(" ").omitEmptyStrings().limit(2); - for(int i=0; i<PlayerStats.defaultStatNames.length; i++) { - String statName = PlayerStats.defaultStatNames[i]; - String statNamePretty = PlayerStats.defaultStatNamesPretty[i]; - - int val = Math.round(stats.get(statName)); - - GlStateManager.color(1, 1, 1, 1); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - Utils.renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString()+val, guiLeft+132, guiTop+27+11f*i, 80); - - if(mouseX > guiLeft+132 && mouseX < guiLeft+212) { - if(mouseY > guiTop+27+11f*i && mouseY < guiTop+37+11f*i) { - List<String> split = splitter.splitToList(statNamePretty); - PlayerStats.Stats baseStats = PlayerStats.getBaseStats(); - tooltipToDisplay = new ArrayList<>(); - tooltipToDisplay.add(statNamePretty); - int base = Math.round(baseStats.get(statName)); - tooltipToDisplay.add(EnumChatFormatting.GRAY+"Base "+split.get(1)+": "+EnumChatFormatting.GREEN+base+" "+split.get(0)); - int passive = Math.round(profile.getPassiveStats(profileId).get(statName)-baseStats.get(statName)); - tooltipToDisplay.add(EnumChatFormatting.GRAY+"Passive "+split.get(1)+" Bonus: +"+EnumChatFormatting.YELLOW+passive+" "+split.get(0)); - int itemBonus = Math.round(stats.get(statName)-profile.getPassiveStats(profileId).get(statName)); - tooltipToDisplay.add(EnumChatFormatting.GRAY+"Item "+split.get(1)+" Bonus: +"+EnumChatFormatting.DARK_PURPLE+itemBonus+" "+split.get(0)); - int finalStat = Math.round(stats.get(statName)); - tooltipToDisplay.add(EnumChatFormatting.GRAY+"Final "+split.get(1)+": +"+EnumChatFormatting.RED+finalStat+" "+split.get(0)); - } - } - } - } else { - Utils.drawStringCentered(EnumChatFormatting.RED+"Skill/Inv/Coll", Minecraft.getMinecraft().fontRendererObj, - guiLeft+172, guiTop+101-10, true, 0); - Utils.drawStringCentered(EnumChatFormatting.RED+"APIs not", Minecraft.getMinecraft().fontRendererObj, - guiLeft+172, guiTop+101, true, 0); - Utils.drawStringCentered(EnumChatFormatting.RED+"enabled!", Minecraft.getMinecraft().fontRendererObj, - guiLeft+172, guiTop+101+10, true, 0); - } - - if(skillInfo != null) { - int position = 0; - for(Map.Entry<String, ItemStack> entry : ProfileViewer.getSkillToSkillDisplayMap().entrySet()) { - if(entry.getValue() == null || entry.getKey() == null) { - position++; - continue; - } - - int yPosition = position % 7; - int xPosition = position / 7; - - String skillName = entry.getValue().getDisplayName(); - - float level = Utils.getElementAsFloat(skillInfo.get("level_"+entry.getKey()), 0); - int levelFloored = (int)Math.floor(level); - - int x = guiLeft+237+86*xPosition; - int y = guiTop+31+21*yPosition; - - Utils.renderAlignedString(skillName, EnumChatFormatting.WHITE.toString()+levelFloored, x+14, y-4, 60); - - if(skillInfo.get("maxed_"+entry.getKey()).getAsBoolean()) { - renderGoldBar(x, y+6, 80); - } else { - renderBar(x, y+6, 80, level%1); - } - - if(mouseX > x && mouseX < x+80) { - if(mouseY > y-4 && mouseY < y+13) { - tooltipToDisplay = new ArrayList<>(); - tooltipToDisplay.add(skillName); - if(skillInfo.get("maxed_"+entry.getKey()).getAsBoolean()) { - tooltipToDisplay.add(EnumChatFormatting.GRAY+"Progress: "+EnumChatFormatting.GOLD+"MAXED!"); - } else { - int maxXp = (int)skillInfo.get("maxxp_"+entry.getKey()).getAsFloat(); - tooltipToDisplay.add(EnumChatFormatting.GRAY+"Progress: "+EnumChatFormatting.DARK_PURPLE.toString() + - shortNumberFormat(Math.round((level%1)*maxXp), 0) + "/" + shortNumberFormat(maxXp, 0)); - } - String totalXpS = NumberFormat.getIntegerInstance().format((int)skillInfo.get("experience_"+entry.getKey()).getAsFloat()); - tooltipToDisplay.add(EnumChatFormatting.GRAY+"Total XP: " + - EnumChatFormatting.DARK_PURPLE+totalXpS); - } - } - - GL11.glTranslatef((x), (y-6f), 0); - GL11.glScalef(0.7f, 0.7f, 1); - Utils.drawItemStackLinear(entry.getValue(), 0, 0); - GL11.glScalef(1/0.7f, 1/0.7f, 1); - GL11.glTranslatef(-(x), -(y-6f), 0); - - position++; - } - } else { - Utils.drawStringCentered(EnumChatFormatting.RED+"Skills API not enabled!", Minecraft.getMinecraft().fontRendererObj, - guiLeft+322, guiTop+101, true, 0); - } - } - - private void renderGoldBar(float x, float y, float xSize) { - if(!OpenGlHelper.areShadersSupported()) { - renderBar(x, y, xSize, 1); - return; - } - - Minecraft.getMinecraft().getTextureManager().bindTexture(icons); - ShaderManager shaderManager = ShaderManager.getInstance(); - shaderManager.loadShader("make_gold"); - shaderManager.loadData("make_gold", "amount", (startTime-System.currentTimeMillis())/10000f); - - Utils.drawTexturedRect(x, y, xSize/2f, 5, 0/256f, (xSize/2f)/256f, 79/256f, 84/256f, GL11.GL_NEAREST); - Utils.drawTexturedRect(x+xSize/2f, y, xSize/2f, 5, (182-xSize/2f)/256f, 182/256f, 79/256f, 84/256f, GL11.GL_NEAREST); - - GL20.glUseProgram(0); - } - - private void renderBar(float x, float y, float xSize, float completed) { - Minecraft.getMinecraft().getTextureManager().bindTexture(icons); - - completed = Math.round(completed/0.05f)*0.05f; - - float notcompleted = 1-completed; - - int displayNum = 0;//tl.x%5; - - GlStateManager.color(1, 1, 1, 1); - float width = 0; - - if(completed < 0.5f && (displayNum == 1 || displayNum == 0)) { - width = (0.5f - completed) * xSize; - Utils.drawTexturedRect(x+xSize*completed, y, width, 5, xSize*completed/256f, (xSize/2f)/256f, 74/256f, 79/256f, GL11.GL_NEAREST); - } - if(completed < 1f && (displayNum == 2 || displayNum == 0)) { - width = Math.min(xSize*notcompleted, xSize/2f); - Utils.drawTexturedRect(x+(xSize/2f)+Math.max(xSize*(completed-0.5f), 0), y, width, 5, - (182-(xSize/2f)+Math.max(xSize*(completed-0.5f), 0))/256f, 182/256f, 74/256f, 79/256f, GL11.GL_NEAREST); - } - - if(completed > 0f && (displayNum == 3 || displayNum == 0)) { - width = Math.min(xSize*completed, xSize/2f); - Utils.drawTexturedRect(x, y, width, 5, - 0/256f, width/256f, 79/256f, 84/256f, GL11.GL_NEAREST); - } - if(completed > 0.5f && (displayNum == 4 || displayNum == 0)) { - width = Math.min(xSize*(completed-0.5f), xSize/2f); - Utils.drawTexturedRect(x+(xSize/2f), y, width, 5, - (182-(xSize/2f))/256f, (182-(xSize/2f)+width)/256f, 79/256f, 84/256f, GL11.GL_NEAREST); - } - } - - private static final ResourceLocation shadowTextures = new ResourceLocation("textures/misc/shadow.png"); - public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) { - GlStateManager.enableColorMaterial(); - GlStateManager.pushMatrix(); - GlStateManager.translate((float)posX, (float)posY, 50.0F); - GlStateManager.scale((float)(-scale), (float)scale, (float)scale); - GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); - float renderYawOffset = ent.renderYawOffset; - float f1 = ent.rotationYaw; - float f2 = ent.rotationPitch; - float f3 = ent.prevRotationYawHead; - float f4 = ent.rotationYawHead; - GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); - RenderHelper.enableStandardItemLighting(); - GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(25, 1.0F, 0.0F, 0.0F); - ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; - ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; - ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; - ent.rotationYawHead = ent.rotationYaw; - ent.prevRotationYawHead = ent.rotationYaw; - RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); - rendermanager.setPlayerViewY(180.0F); - rendermanager.setRenderShadow(false); - rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); - - /*{ - GlStateManager.enableBlend(); - GlStateManager.blendFunc(770, 771); - rendermanager.renderEngine.bindTexture(shadowTextures); - GlStateManager.depthMask(false); - float f = 0.5f; - - if (ent instanceof EntityLiving) { - EntityLiving entityliving = (EntityLiving)ent; - f *= entityliving.getRenderSizeModifier(); - - if (entityliving.isChild()) - { - f *= 0.5F; - } - } - - /*Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - - GlStateManager.color(1, 1, 1, 0.5f); - Utils.drawTexturedRect(-0.5f*tl.x, -0.5f*tl.x, 1*tl.x, 1*tl.x); - - /*for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) { - Block block = world.getBlockState(blockpos.down()).getBlock(); - - if (block.getRenderType() != -1 && world.getLightFromNeighbors(blockpos) > 3) { - this.func_180549_a(block, x, y, z, blockpos, shadowAlpha, f, d2, d3, d4); - } - } - - GlStateManager.disableBlend(); - GlStateManager.depthMask(true); - }*/ - - ent.renderYawOffset = renderYawOffset; - ent.rotationYaw = f1; - ent.rotationPitch = f2; - ent.prevRotationYawHead = f3; - ent.rotationYawHead = f4; - GlStateManager.popMatrix(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableRescaleNormal(); - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.disableTexture2D(); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - } - - public void resetCache() { - bestWeapons = null; - bestRods = null; - armorItems = null; - inventoryItems = new HashMap<>(); - currentInventoryIndex = 0; - arrowCount = -1; - greenCandyCount = -1; - purpleCandyCount = -1; - entityPlayer = null; - playerLocationSkin = null; - playerLocationCape = null; - skinType = null; - petsPage = 0; - sortedPets = null; - sortedPetsStack = null; - selectedPet = -1; - } - - Shader blurShaderHorz = null; - Framebuffer blurOutputHorz = null; - Shader blurShaderVert = null; - Framebuffer blurOutputVert = null; - - /** - * Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate - * space [-1 -> 1; 1 -> -1] (Note: flipped y-axis). - * - * This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to - * apply scales and translations manually. - */ - private Matrix4f createProjectionMatrix(int width, int height) { - Matrix4f projMatrix = new Matrix4f(); - projMatrix.setIdentity(); - projMatrix.m00 = 2.0F / (float)width; - projMatrix.m11 = 2.0F / (float)(-height); - projMatrix.m22 = -0.0020001999F; - projMatrix.m33 = 1.0F; - projMatrix.m03 = -1.0F; - projMatrix.m13 = 1.0F; - projMatrix.m23 = -1.0001999F; - return projMatrix; - } - - /** - * Renders whatever is currently in the Minecraft framebuffer to our two framebuffers, applying a horizontal - * and vertical blur separately in order to significantly save computation time. - * This is only possible if framebuffers are supported by the system, so this method will exit prematurely - * if framebuffers are not available. (Apple machines, for example, have poor framebuffer support). - */ - private double lastBgBlurFactor = -1; - private void blurBackground() { - if(!OpenGlHelper.isFramebufferEnabled()) return; - - int width = Minecraft.getMinecraft().displayWidth; - int height = Minecraft.getMinecraft().displayHeight; - - if(blurOutputHorz == null) { - blurOutputHorz = new Framebuffer(width, height, false); - blurOutputHorz.setFramebufferFilter(GL11.GL_NEAREST); - } - if(blurOutputVert == null) { - blurOutputVert = new Framebuffer(width, height, false); - blurOutputVert.setFramebufferFilter(GL11.GL_NEAREST); - } - if(blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) { - blurOutputHorz.createBindFramebuffer(width, height); - blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height)); - Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); - } - if(blurOutputVert.framebufferWidth != width || blurOutputVert.framebufferHeight != height) { - blurOutputVert.createBindFramebuffer(width, height); - blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height)); - Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); - } - - if(blurShaderHorz == null) { - try { - blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", - Minecraft.getMinecraft().getFramebuffer(), blurOutputHorz); - blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0); - blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height)); - } catch(Exception e) { } - } - if(blurShaderVert == null) { - try { - blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", - blurOutputHorz, blurOutputVert); - blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1); - blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height)); - } catch(Exception e) { } - } - if(blurShaderHorz != null && blurShaderVert != null) { - if(15 != lastBgBlurFactor) { - blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)15); - blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)15); - lastBgBlurFactor = 15; - } - GL11.glPushMatrix(); - blurShaderHorz.loadShader(0); - blurShaderVert.loadShader(0); - GlStateManager.enableDepth(); - GL11.glPopMatrix(); - - Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false); - } - } - - /** - * Renders a subsection of the blurred framebuffer on to the corresponding section of the screen. - * Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight] - */ - public void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) { - if(!OpenGlHelper.isFramebufferEnabled()) return; - - float uMin = x/(float)width; - float uMax = (x+blurWidth)/(float)width; - float vMin = (height-y)/(float)height; - float vMax = (height-y-blurHeight)/(float)height; - - blurOutputVert.bindFramebufferTexture(); - GlStateManager.color(1f, 1f, 1f, 1f); - //Utils.setScreen(width*f, height*f, f); - Utils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax); - //Utils.setScreen(width, height, f); - blurOutputVert.unbindFramebufferTexture(); - } -} +package io.github.moulberry.notenoughupdates.profileviewer;
+
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.minecraft.MinecraftProfileTexture;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
+import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityOtherPlayerMP;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.*;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.resources.DefaultPlayerSkin;
+import net.minecraft.client.resources.SkinManager;
+import net.minecraft.client.shader.Framebuffer;
+import net.minecraft.client.shader.Shader;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EnumPlayerModelParts;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.*;
+import net.minecraft.util.*;
+import org.apache.commons.lang3.text.WordUtils;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+import org.lwjgl.opengl.GL20;
+
+import java.awt.*;
+import java.io.IOException;
+import java.text.NumberFormat;
+import java.util.*;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class GuiProfileViewer extends GuiScreen {
+
+ private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png");
+ public static final ResourceLocation pv_basic = new ResourceLocation("notenoughupdates:pv_basic.png");
+ public static final ResourceLocation pv_dung = new ResourceLocation("notenoughupdates:pv_dung.png");
+ public static final ResourceLocation pv_extra = new ResourceLocation("notenoughupdates:pv_extra.png");
+ public static final ResourceLocation pv_invs = new ResourceLocation("notenoughupdates:pv_invs.png");
+ public static final ResourceLocation pv_cols = new ResourceLocation("notenoughupdates:pv_cols.png");
+ public static final ResourceLocation pv_pets = new ResourceLocation("notenoughupdates:pv_pets.png");
+ public static final ResourceLocation pv_dropdown = new ResourceLocation("notenoughupdates:pv_dropdown.png");
+ public static final ResourceLocation pv_bg = new ResourceLocation("notenoughupdates:pv_bg.png");
+ public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png");
+ public static final ResourceLocation resource_packs = new ResourceLocation("minecraft:textures/gui/resource_packs.png");
+ public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png");
+
+ private static final NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
+
+ private final ProfileViewer.Profile profile;
+ public static ProfileViewerPage currentPage = ProfileViewerPage.BASIC;
+ private int sizeX;
+ private int sizeY;
+ private int guiLeft;
+ private int guiTop;
+
+ private float backgroundRotation = 0;
+
+ private long currentTime = 0;
+ private long lastTime = 0;
+ private long startTime = 0;
+
+ private List<String> tooltipToDisplay = null;
+
+ private String profileId = null;
+ private boolean profileDropdownSelected = false;
+
+ public enum ProfileViewerPage {
+ LOADING(null),
+ INVALID_NAME(null),
+ NO_SKYBLOCK(null),
+ BASIC(new ItemStack(Items.paper)),
+ DUNG(new ItemStack(Item.getItemFromBlock(Blocks.deadbush))),
+ EXTRA(new ItemStack(Items.book)),
+ INVS(new ItemStack(Item.getItemFromBlock(Blocks.ender_chest))),
+ COLS(new ItemStack(Items.painting)),
+ PETS(new ItemStack(Items.bone));
+
+ public final ItemStack stack;
+
+ ProfileViewerPage(ItemStack stack) {
+ this.stack = stack;
+ }
+ }
+
+ public GuiProfileViewer(ProfileViewer.Profile profile) {
+ this.profile = profile;
+ String name = "";
+ if(profile != null && profile.getHypixelProfile() != null) {
+ name = profile.getHypixelProfile().get("displayname").getAsString();
+ }
+ playerNameTextField = new GuiElementTextField(name,
+ GuiElementTextField.SCALE_TEXT);
+ playerNameTextField.setSize(100, 20);
+
+ if(currentPage == ProfileViewerPage.LOADING) {
+ currentPage = ProfileViewerPage.BASIC;
+ }
+ }
+
+ private GuiElementTextField playerNameTextField;
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ currentTime = System.currentTimeMillis();
+ if(startTime == 0) startTime = currentTime;
+
+ ProfileViewerPage page = currentPage;
+ if(profile == null) {
+ page = ProfileViewerPage.INVALID_NAME;
+ } else if(profile.getPlayerInformation(null) == null) {
+ page = ProfileViewerPage.LOADING;
+ } else if(profile.getLatestProfile() == null) {
+ page = ProfileViewerPage.NO_SKYBLOCK;
+ }
+
+ if(profileId == null && profile != null && profile.getLatestProfile() != null) {
+ profileId = profile.getLatestProfile();
+ }
+
+ this.sizeX = 431;
+ this.sizeY = 202;
+ this.guiLeft = (this.width-this.sizeX)/2;
+ this.guiTop = (this.height-this.sizeY)/2;
+
+ super.drawScreen(mouseX, mouseY, partialTicks);
+ drawDefaultBackground();
+
+ blurBackground();
+ renderBlurredBackground(width, height, guiLeft+2, guiTop+2, sizeX-4, sizeY-4);
+
+ GlStateManager.enableDepth();
+ GlStateManager.translate(0, 0, 5);
+ renderTabs(true);
+ GlStateManager.translate(0, 0, -3);
+
+ GlStateManager.disableDepth();
+ GlStateManager.translate(0, 0, -2);
+ renderTabs(false);
+ GlStateManager.translate(0, 0, 2);
+
+ GlStateManager.disableLighting();
+ GlStateManager.enableDepth();
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.enableAlpha();
+ GlStateManager.alphaFunc(516, 0.1F);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_bg);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+
+ if(!(page == ProfileViewerPage.LOADING)) {
+ playerNameTextField.render(guiLeft+sizeX-100, guiTop+sizeY+5);
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+
+ if(profile != null) {
+ renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+3+2, 100-4, 20-4);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown);
+ Utils.drawTexturedRect(guiLeft, guiTop+sizeY+3, 100, 20,
+ 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST);
+ Utils.drawStringCenteredScaledMaxWidth(profileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50,
+ guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB());
+
+ if(profileDropdownSelected && !profile.getProfileIds().isEmpty() && scaledResolution.getScaleFactor() != 4) {
+ int dropdownOptionSize = scaledResolution.getScaleFactor()==3?10:20;
+
+ int numProfiles = profile.getProfileIds().size();
+ int sizeYDropdown = numProfiles*dropdownOptionSize;
+ renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+23, 100-4, sizeYDropdown-2);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown);
+ Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23-3, 100, 3,
+ 100/200f, 1, 0, 3/185f, GL11.GL_NEAREST);
+ Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23+sizeYDropdown-4, 100, 4,
+ 100/200f, 1, 181/185f, 1, GL11.GL_NEAREST);
+ Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23, 100, sizeYDropdown-4,
+ 100/200f, 1, (181-sizeYDropdown)/185f, 181/185f, GL11.GL_NEAREST);
+
+ for(int yIndex = 0; yIndex<profile.getProfileIds().size(); yIndex++) {
+ String otherProfileId = profile.getProfileIds().get(yIndex);
+ Utils.drawStringCenteredScaledMaxWidth(otherProfileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50,
+ guiTop+sizeY+23+dropdownOptionSize/2f+dropdownOptionSize*yIndex, true, 90, new Color(33, 112, 104, 255).getRGB());
+ }
+
+ }
+ }
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ switch (page) {
+ case BASIC:
+ drawBasicPage(mouseX, mouseY, partialTicks);
+ break;
+ case DUNG:
+ drawDungPage(mouseX, mouseY, partialTicks);
+ break;
+ case EXTRA:
+ drawExtraPage(mouseX, mouseY, partialTicks);
+ break;
+ case INVS:
+ drawInvsPage(mouseX, mouseY, partialTicks);
+ break;
+ case COLS:
+ drawColsPage(mouseX, mouseY, partialTicks);
+ break;
+ case PETS:
+ drawPetsPage(mouseX, mouseY, partialTicks);
+ break;
+ case LOADING:
+ String str = EnumChatFormatting.YELLOW+"Loading player profiles.";
+ long currentTimeMod = System.currentTimeMillis() % 1000;
+ if(currentTimeMod > 333) {
+ if(currentTimeMod < 666) {
+ str += ".";
+ } else {
+ str += "..";
+ }
+ }
+
+ Utils.drawStringCentered(str, Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+sizeX/2f, guiTop+101, true, 0);
+ break;
+ case INVALID_NAME:
+ Utils.drawStringCentered(EnumChatFormatting.RED+"Invalid name or API is down!", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+sizeX/2f, guiTop+101, true, 0);
+ break;
+ case NO_SKYBLOCK:
+ Utils.drawStringCentered(EnumChatFormatting.RED+"No skyblock data found!", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+sizeX/2f, guiTop+101, true, 0);
+ break;
+ }
+
+ lastTime = currentTime;
+
+ if(tooltipToDisplay != null) {
+ List<String> grayTooltip = new ArrayList<>(tooltipToDisplay.size());
+ for(String line : tooltipToDisplay) {
+ grayTooltip.add(EnumChatFormatting.GRAY + line);
+ }
+ Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
+ tooltipToDisplay = null;
+ }
+ }
+
+ private void renderTabs(boolean renderPressed) {
+ int ignoredTabs = 0;
+ for(int i=0; i<ProfileViewerPage.values().length; i++) {
+ ProfileViewerPage page = ProfileViewerPage.values()[i];
+ if(page.stack == null) {
+ ignoredTabs++;
+ continue;
+ }
+ boolean pressed = page == currentPage;
+ if(pressed == renderPressed) {
+ renderTab(page.stack, i-ignoredTabs, pressed);
+ }
+ }
+ }
+
+ private void renderTab(ItemStack stack, int xIndex, boolean pressed) {
+ GlStateManager.disableLighting();
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.enableAlpha();
+ GlStateManager.alphaFunc(516, 0.1F);
+
+ int x = guiLeft+xIndex*28;
+ int y = guiTop-28;
+
+ float uMin = 0;
+ float uMax = 28/256f;
+ float vMin = 20/256f;
+ float vMax = 51/256f;
+ if(pressed) {
+ vMin = 52/256f;
+ vMax = 84/256f;
+
+ if(xIndex != 0) {
+ uMin = 28/256f;
+ uMax = 56/256f;
+ }
+
+ renderBlurredBackground(width, height, x+2, y+2, 28-4, 28-4);
+ } else {
+ renderBlurredBackground(width, height, x+2, y+4, 28-4, 28-4);
+ }
+
+ GlStateManager.disableLighting();
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.enableAlpha();
+ GlStateManager.alphaFunc(516, 0.1F);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ Utils.drawTexturedRect(x, y, 28, pressed?32:31, uMin, uMax, vMin, vMax, GL11.GL_NEAREST);
+
+ GlStateManager.enableDepth();
+ Utils.drawItemStack(stack, x+6, y+9);
+ }
+
+ @Override
+ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
+ if(currentPage != ProfileViewerPage.LOADING && currentPage != ProfileViewerPage.INVALID_NAME) {
+ int ignoredTabs = 0;
+ for(int i=0; i<ProfileViewerPage.values().length; i++) {
+ ProfileViewerPage page = ProfileViewerPage.values()[i];
+ if(page.stack == null) {
+ ignoredTabs++;
+ continue;
+ }
+ int i2 = i - ignoredTabs;
+ int x = guiLeft+i2*28;
+ int y = guiTop-28;
+
+ if(mouseX > x && mouseX < x+28) {
+ if(mouseY > y && mouseY < y+32) {
+ if(currentPage != page) Utils.playPressSound();
+ currentPage = page;
+ inventoryTextField.otherComponentClick();
+ playerNameTextField.otherComponentClick();
+ return;
+ }
+ }
+ }
+ }
+ switch (currentPage) {
+ case DUNG:
+ mouseClickedDung(mouseX, mouseY, mouseButton);
+ break;
+ case INVS:
+ inventoryTextField.setSize(88, 20);
+ if(mouseX > guiLeft+19 && mouseX < guiLeft+19+88) {
+ if(mouseY > guiTop+sizeY-26-20 && mouseY < guiTop+sizeY-26) {
+ inventoryTextField.mouseClicked(mouseX, mouseY, mouseButton);
+ playerNameTextField.otherComponentClick();
+ return;
+ }
+ }
+ break;
+ case PETS:
+ if(sortedPets == null) break;
+ for(int i=petsPage*20; i<Math.min(petsPage*20+20, sortedPets.size()); i++) {
+ int xIndex = (i%20) % COLLS_XCOUNT;
+ int yIndex = (i%20) / COLLS_XCOUNT;
+
+ float x = 5 + COLLS_XPADDING + (COLLS_XPADDING + 20) * xIndex;
+ float y = 7 + COLLS_YPADDING + (COLLS_YPADDING + 20) * yIndex;
+
+ if(mouseX > guiLeft+x && mouseX < guiLeft+x+20) {
+ if(mouseY > guiTop+y && mouseY < guiTop+y+20) {
+ selectedPet = i;
+ return;
+ }
+ }
+ }
+ break;
+ }
+ if(mouseX > guiLeft+sizeX-100 && mouseX < guiLeft+sizeX) {
+ if(mouseY > guiTop+sizeY+5 && mouseY < guiTop+sizeY+25) {
+ playerNameTextField.mouseClicked(mouseX, mouseY, mouseButton);
+ inventoryTextField.otherComponentClick();
+ return;
+ }
+ }
+ if(mouseX > guiLeft && mouseX < guiLeft+100 && profile != null && !profile.getProfileIds().isEmpty()) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ if(mouseY > guiTop+sizeY+3 && mouseY < guiTop+sizeY+23) {
+ if(scaledResolution.getScaleFactor() == 4) {
+ profileDropdownSelected = false;
+ int profileNum = 0;
+ for(int index = 0; index<profile.getProfileIds().size(); index++) {
+ if(profile.getProfileIds().get(index).equals(profileId)) {
+ profileNum = index;
+ break;
+ }
+ }
+ if(mouseButton == 0) {
+ profileNum++;
+ } else {
+ profileNum--;
+ }
+ if(profileNum >= profile.getProfileIds().size()) profileNum = 0;
+ if(profileNum < 0) profileNum = profile.getProfileIds().size()-1;
+
+ String newProfileId = profile.getProfileIds().get(profileNum);
+ if(profileId != null && !profileId.equals(newProfileId)) {
+ resetCache();
+ }
+ profileId = newProfileId;
+ } else {
+ profileDropdownSelected = !profileDropdownSelected;
+ }
+ } else if(scaledResolution.getScaleFactor() != 4 && profileDropdownSelected) {
+ int dropdownOptionSize = scaledResolution.getScaleFactor()==3?10:20;
+ int extraY = mouseY - (guiTop+sizeY+23);
+ int index = extraY/dropdownOptionSize;
+ if(index >= 0 && index < profile.getProfileIds().size()) {
+ String newProfileId = profile.getProfileIds().get(index);
+ if(profileId != null && !profileId.equals(newProfileId)) {
+ resetCache();
+ }
+ profileId = newProfileId;
+ }
+ }
+ playerNameTextField.otherComponentClick();
+ inventoryTextField.otherComponentClick();
+ return;
+ }
+ profileDropdownSelected = false;
+ playerNameTextField.otherComponentClick();
+ inventoryTextField.otherComponentClick();
+ }
+
+ @Override
+ protected void keyTyped(char typedChar, int keyCode) throws IOException {
+ super.keyTyped(typedChar, keyCode);
+ switch (currentPage) {
+ case INVS:
+ keyTypedInvs(typedChar, keyCode);
+ inventoryTextField.keyTyped(typedChar, keyCode);
+ break;
+ case COLS:
+ keyTypedCols(typedChar, keyCode);
+ break;
+ case DUNG:
+ keyTypedDung(typedChar, keyCode);
+ break;
+ }
+ if(playerNameTextField.getFocus() && !(currentPage == ProfileViewerPage.LOADING)) {
+ if(keyCode == Keyboard.KEY_RETURN) {
+ currentPage = ProfileViewerPage.LOADING;
+ NotEnoughUpdates.profileViewer.getProfileByName(playerNameTextField.getText(), profile -> { //todo: invalid name
+ if(profile != null) profile.resetCache();
+ Minecraft.getMinecraft().displayGuiScreen(new GuiProfileViewer(profile));
+ });
+ }
+ playerNameTextField.keyTyped(typedChar, keyCode);
+ }
+ }
+
+ @Override
+ protected void mouseReleased(int mouseX, int mouseY, int mouseButton) {
+ super.mouseReleased(mouseX, mouseY, mouseButton);
+
+ switch (currentPage) {
+ case INVS:
+ mouseReleasedInvs(mouseX, mouseY, mouseButton);
+ break;
+ case COLS:
+ mouseReleasedCols(mouseX, mouseY, mouseButton);
+ break;
+ case PETS:
+ mouseReleasedPets(mouseX, mouseY, mouseButton);
+ }
+ }
+
+ protected void mouseClickedDung(int mouseX, int mouseY, int mouseButton) {
+ if(mouseX >= guiLeft+50 && mouseX <= guiLeft+70 &&
+ mouseY >= guiTop+54 && mouseY <= guiTop+64) {
+ dungeonLevelTextField.mouseClicked(mouseX, mouseY, mouseButton);
+ } else {
+ dungeonLevelTextField.otherComponentClick();
+ }
+
+ int cW = fontRendererObj.getStringWidth("Calculate");
+ if(mouseX >= guiLeft+23+110-17-cW && mouseX <= guiLeft+23+110-17 &&
+ mouseY >= guiTop+55 && mouseY <= guiTop+65) {
+ calculateFloorLevelXP();
+ }
+
+ int y = guiTop+142;
+
+ if(mouseY >= y-2 && mouseY <= y+9) {
+ for(int i=1; i<=7; i++) {
+ int w = fontRendererObj.getStringWidth(""+i);
+
+ int x = guiLeft+23+110*i/8-w/2;
+
+ if(mouseX >= x-2 && mouseX <= x+7) {
+ floorTime = i;
+ return;
+ }
+ }
+ }
+ }
+
+ protected void keyTypedDung(char typedChar, int keyCode) {
+ dungeonLevelTextField.keyTyped(typedChar, keyCode);
+ }
+
+ protected void keyTypedInvs(char typedChar, int keyCode) throws IOException {
+ switch(keyCode) {
+ case Keyboard.KEY_1:
+ case Keyboard.KEY_NUMPAD1:
+ selectedInventory = "inv_contents"; break;
+ case Keyboard.KEY_2:
+ case Keyboard.KEY_NUMPAD2:
+ selectedInventory = "ender_chest_contents"; break;
+ case Keyboard.KEY_3:
+ case Keyboard.KEY_NUMPAD3:
+ selectedInventory = "backpack_contents"; break;
+ case Keyboard.KEY_4:
+ case Keyboard.KEY_NUMPAD4:
+ selectedInventory = "personal_vault_contents"; break;
+ case Keyboard.KEY_5:
+ case Keyboard.KEY_NUMPAD5:
+ selectedInventory = "talisman_bag"; break;
+ case Keyboard.KEY_6:
+ case Keyboard.KEY_NUMPAD6:
+ selectedInventory = "wardrobe_contents"; break;
+ case Keyboard.KEY_7:
+ case Keyboard.KEY_NUMPAD7:
+ selectedInventory = "fishing_bag"; break;
+ case Keyboard.KEY_8:
+ case Keyboard.KEY_NUMPAD8:
+ selectedInventory = "potion_bag"; break;
+
+ }
+ Utils.playPressSound();
+ }
+
+ protected void keyTypedCols(char typedChar, int keyCode) throws IOException {
+ ItemStack stack = null;
+ Iterator<ItemStack> items = ProfileViewer.getCollectionCatToCollectionMap().keySet().iterator();
+ switch(keyCode) {
+ case Keyboard.KEY_5:
+ case Keyboard.KEY_NUMPAD5:
+ stack = items.next();
+ case Keyboard.KEY_4:
+ case Keyboard.KEY_NUMPAD4:
+ stack = items.next();
+ case Keyboard.KEY_3:
+ case Keyboard.KEY_NUMPAD3:
+ stack = items.next();
+ case Keyboard.KEY_2:
+ case Keyboard.KEY_NUMPAD2:
+ stack = items.next();
+ case Keyboard.KEY_1:
+ case Keyboard.KEY_NUMPAD1:
+ stack = items.next();
+ }
+ if(stack != null) {
+ selectedCollectionCategory = stack;
+ }
+ Utils.playPressSound();
+ }
+
+ private void mouseReleasedPets(int mouseX, int mouseY, int mouseButton) {
+ if(mouseY > guiTop+6 && mouseY < guiTop+22) {
+ if(mouseX > guiLeft+100-15-12 && mouseX < guiLeft+100-20) {
+ if(petsPage > 0) {
+ petsPage--;
+ }
+ return;
+ } else if(mouseX > guiLeft+100+15 && mouseX < guiLeft+100+20+12) {
+ if(sortedPets != null && petsPage < Math.ceil(sortedPets.size()/20f)-1) {
+ petsPage++;
+ }
+ return;
+ }
+ }
+ }
+
+ private void mouseReleasedInvs(int mouseX, int mouseY, int mouseButton) {
+ if(mouseButton == 0) {
+ int i=0;
+ for(Map.Entry<String, ItemStack> entry : invNameToDisplayMap.entrySet()) {
+ int xIndex = i%3;
+ int yIndex = i/3;
+
+ int x = guiLeft+19+34*xIndex;
+ int y = guiTop+26+34*yIndex;
+
+ if(mouseX >= x && mouseX <= x+16) {
+ if(mouseY >= y && mouseY <= y+16) {
+ if(selectedInventory != entry.getKey()) Utils.playPressSound();
+ selectedInventory = entry.getKey();
+ return;
+ }
+ }
+
+ i++;
+ }
+
+ JsonObject inventoryInfo = profile.getInventoryInfo(profileId);
+ if(inventoryInfo == null) return;
+
+ ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, selectedInventory);
+ if(currentInventoryIndex >= inventories.length) currentInventoryIndex = inventories.length-1;
+ if(currentInventoryIndex < 0) currentInventoryIndex = 0;
+
+ ItemStack[][] inventory = inventories[currentInventoryIndex];
+ if(inventory == null) return;
+
+ int inventoryRows = inventory.length;
+ int invSizeY = inventoryRows*18+17+7;
+
+ int y = guiTop+101-invSizeY/2;
+ int staticSelectorHeight = guiTop+177;
+
+ if(mouseY > staticSelectorHeight && mouseY < staticSelectorHeight+16) {
+ if(mouseX > guiLeft+320-12 && mouseX < guiLeft+320+12) {
+ if(mouseX < guiLeft+320) {
+ currentInventoryIndex--;
+ } else {
+ currentInventoryIndex++;
+ }
+ }
+ }
+ }
+ }
+
+ private ItemStack selectedCollectionCategory = null;
+
+ private void mouseReleasedCols(int mouseX, int mouseY, int mouseButton) {
+ int collectionCatSize = ProfileViewer.getCollectionCatToCollectionMap().size();
+ int collectionCatYSize = (int)(162f/(collectionCatSize-1+0.0000001f));
+ int yIndex = 0;
+ for(ItemStack stack : ProfileViewer.getCollectionCatToCollectionMap().keySet()) {
+ if(mouseX > guiLeft+7 && mouseX < guiLeft+7+20) {
+ if(mouseY > guiTop+10+collectionCatYSize*yIndex && mouseY < guiTop+10+collectionCatYSize*yIndex+20) {
+ selectedCollectionCategory = stack;
+ Utils.playPressSound();
+ return;
+ }
+ }
+ yIndex++;
+ }
+ }
+
+ private static final ItemStack DEADBUSH = new ItemStack(Item.getItemFromBlock(Blocks.deadbush));
+ private static final ItemStack[] BOSS_HEADS = new ItemStack[7];
+
+ private HashMap<String, ProfileViewer.Level> levelObjCatas = new HashMap<>();
+ private HashMap<String, HashMap<String, ProfileViewer.Level>> levelObjClasseses = new HashMap<>();
+
+ private GuiElementTextField dungeonLevelTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT);
+
+ private static final String[] dungSkillsName = {"Healer", "Mage", "Berserk", "Archer", "Tank"};
+ private static final ItemStack[] dungSkillsStack = { new ItemStack(Items.potionitem, 1, 16389),
+ new ItemStack(Items.blaze_rod), new ItemStack(Items.iron_sword), new ItemStack(Items.bow), new ItemStack(Items.leather_chestplate)};
+ private static final String[] bossFloorArr = {"Bonzo", "Scarf", "Professor", "Thorn", "Livid", "Sadan", "Necron"};
+ private static final String[] bossFloorHeads = {
+ "12716ecbf5b8da00b05f316ec6af61e8bd02805b21eb8e440151468dc656549c",
+ "7de7bbbdf22bfe17980d4e20687e386f11d59ee1db6f8b4762391b79a5ac532d",
+ "9971cee8b833a62fc2a612f3503437fdf93cad692d216b8cf90bbb0538c47dd8",
+ "8b6a72138d69fbbd2fea3fa251cabd87152e4f1c97e5f986bf685571db3cc0",
+ "c1007c5b7114abec734206d4fc613da4f3a0e99f71ff949cedadc99079135a0b",
+ "fa06cb0c471c1c9bc169af270cd466ea701946776056e472ecdaeb49f0f4a4dc",
+ "a435164c05cea299a3f016bbbed05706ebb720dac912ce4351c2296626aecd9a"
+ };
+ private static int floorTime = 7;
+ private int floorLevelTo = -1;
+ private int floorLevelToXP = -1;
+
+ private void calculateFloorLevelXP() {
+ JsonObject leveling = Constants.LEVELING;
+ if(leveling == null) return;
+ ProfileViewer.Level levelObjCata = levelObjCatas.get(profileId);
+ if(levelObjCata == null) return;
+
+ try {
+ dungeonLevelTextField.setCustomBorderColour(0xffffffff);
+ floorLevelTo = Integer.parseInt(dungeonLevelTextField.getText());
+
+ JsonArray levelingArray = Utils.getElement(leveling, "catacombs").getAsJsonArray();
+
+ float remaining = -((levelObjCata.level % 1) * levelObjCata.maxXpForLevel);
+
+ for(int level=0; level<Math.min(floorLevelTo, levelingArray.size()); level++) {
+ if(level < Math.floor(levelObjCata.level)) {
+ continue;
+ }
+ remaining += levelingArray.get(level).getAsFloat();
+ }
+
+ if(remaining < 0) {
+ remaining = 0;
+ }
+ floorLevelToXP = (int) remaining;
+ } catch(Exception e) {
+ dungeonLevelTextField.setCustomBorderColour(0xffff0000);
+ }
+ }
+
+ private void drawDungPage(int mouseX, int mouseY, float partialTicks) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dung);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+
+ JsonObject hypixelInfo = profile.getHypixelProfile();
+ if(hypixelInfo == null) return;
+ JsonObject profileInfo = profile.getProfileInformation(profileId);
+ if(profileInfo == null) return;
+
+ JsonObject leveling = Constants.LEVELING;
+ if(leveling == null) return;
+
+ int sectionWidth = 110;
+
+ ProfileViewer.Level levelObjCata = levelObjCatas.get(profileId);
+ //Catacombs level thingy
+ {
+ if(levelObjCata == null) {
+ float cataXp = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.experience"), 0);
+ levelObjCata = ProfileViewer.getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(),
+ cataXp, 50, false);
+ levelObjCatas.put(profileId, levelObjCata);
+ }
+
+ String skillName = EnumChatFormatting.RED+"Catacombs";
+ float level = levelObjCata.level;
+ int levelFloored = (int)Math.floor(level);
+
+ if(floorLevelTo == -1 && levelFloored >= 0) {
+ dungeonLevelTextField.setText(""+(levelFloored+1));
+ calculateFloorLevelXP();
+ }
+
+ int x = guiLeft+23;
+ int y = guiTop+25;
+
+ renderXpBar(skillName, DEADBUSH, x, y, sectionWidth, levelObjCata, mouseX, mouseY);
+
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Until Cata "+floorLevelTo+": ",
+ EnumChatFormatting.WHITE.toString()+shortNumberFormat(floorLevelToXP, 0), x, y+16, sectionWidth);
+
+ if(mouseX > x && mouseX < x + sectionWidth &&
+ mouseY > y+16 && mouseY < y+24) {
+ float xpF5 = 2000;
+ float xpF6 = 4000;
+ float xpF7 = 20000;
+ if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ xpF5 *= 1.1;
+ xpF6 *= 1.1;
+ xpF7 *= 1.1;
+ }
+
+ long runsF5 = (int)Math.ceil(floorLevelToXP/xpF5);
+ long runsF6 = (int)Math.ceil(floorLevelToXP/xpF6);
+ long runsF7 = (int)Math.ceil(floorLevelToXP/xpF7);
+
+ float timeF5 = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.fastest_time_s_plus.5"), 0);
+ float timeF6 = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.fastest_time_s_plus.6"), 0);
+ float timeF7 = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.fastest_time_s_plus.7"), 0);
+
+ tooltipToDisplay = Lists.newArrayList(
+ String.format("# F5 Runs (%s xp) : %d", shortNumberFormat(xpF5, 0), runsF5),
+ String.format("# F6 Runs (%s xp) : %d", shortNumberFormat(xpF6, 0), runsF6),
+ String.format("# F7 Runs (%s xp) : %d", shortNumberFormat(xpF7, 0), runsF7),
+ ""
+ );
+ boolean hasTime = false;
+ if(timeF5 > 1000) {
+ tooltipToDisplay.add(String.format("Expected Time (F5) : %s", Utils.prettyTime(runsF5*(long)(timeF5*1.2))));
+ hasTime = true;
+ }
+ if(timeF6 > 1000) {
+ tooltipToDisplay.add(String.format("Expected Time (F6) : %s", Utils.prettyTime(runsF6*(long)(timeF6*1.2))));
+ hasTime = true;
+ }
+ if(timeF7 > 1000) {
+ tooltipToDisplay.add(String.format("Expected Time (F7) : %s", Utils.prettyTime(runsF7*(long)(timeF7*1.2))));
+ hasTime = true;
+ }
+ if(hasTime) {
+ tooltipToDisplay.add("");
+ }
+ if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ tooltipToDisplay.add("[Hold "+EnumChatFormatting.YELLOW+"SHIFT"+EnumChatFormatting.GRAY+" to show without Expert Ring]");
+ }
+ if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
+ if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) tooltipToDisplay.add("");
+ tooltipToDisplay.add("Number of runs is calculated as [Remaining XP]/[XP per Run].");
+ tooltipToDisplay.add("The [XP per Run] is the average xp gained from an S+ run");
+ tooltipToDisplay.add("The "+EnumChatFormatting.DARK_PURPLE+"Catacombs Expert Ring"+EnumChatFormatting.GRAY+
+ " is assumed to be used, unless "+EnumChatFormatting.YELLOW+"SHIFT"+EnumChatFormatting.GRAY+" is held.");
+ tooltipToDisplay.add("[Time per run] is calculated using fastestSPlus x 120%");
+ } else {
+ tooltipToDisplay.add("[Hold "+EnumChatFormatting.YELLOW+"CTRL"+EnumChatFormatting.GRAY+" to see details]");
+ }
+ }
+
+ dungeonLevelTextField.setSize(20, 10);
+ dungeonLevelTextField.render(x+22, y+29);
+ int calcLen = fontRendererObj.getStringWidth("Calculate");
+ Utils.renderShadowedString(EnumChatFormatting.WHITE+"Calculate", x+sectionWidth-17-calcLen/2f,
+ y+30, 100);
+
+ //Random stats
+
+ float secrets = Utils.getElementAsFloat(Utils.getElement(hypixelInfo,
+ "achievements.skyblock_treasure_hunter"), 0);
+
+ float totalRuns = 0;
+ float totalRunsF5 = 0;
+ for(int i=1; i<=7; i++) {
+ float runs = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.tier_completions."+i), 0);
+ totalRuns += runs;
+ if(i >= 5) {
+ totalRunsF5 += runs;
+ }
+ }
+
+ float mobKills = 0;
+ float mobKillsF5 = 0;
+ for(int i=1; i<=7; i++) {
+ float kills = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.mobs_killed."+i), 0);
+ mobKills += kills;
+ if(i >= 5) {
+ mobKillsF5 += kills;
+ }
+ }
+
+ int miscTopY = y+55;
+
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs ",
+ EnumChatFormatting.WHITE.toString()+((int)(totalRuns)), x, miscTopY, sectionWidth);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs (F5-7) ",
+ EnumChatFormatting.WHITE.toString()+((int)(totalRunsF5)), x, miscTopY+10, sectionWidth);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (Total) ",
+ EnumChatFormatting.WHITE.toString()+shortNumberFormat(secrets, 0), x, miscTopY+20, sectionWidth);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (/Run) ",
+ EnumChatFormatting.WHITE.toString()+(Math.round(secrets/Math.max(1, totalRuns)*100)/100f), x, miscTopY+30, sectionWidth);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Mob Kills (Total) ",
+ EnumChatFormatting.WHITE.toString()+shortNumberFormat(mobKills, 0), x, miscTopY+40, sectionWidth);
+
+ int y3 = y+117;
+
+ for(int i=1; i<=7; i++) {
+ int w = fontRendererObj.getStringWidth(""+i);
+
+ int bx = x+sectionWidth*i/8-w/2;
+
+ boolean invert = i == floorTime;
+ float uMin = 20/256f;
+ float uMax = 29/256f;
+ float vMin = 0/256f;
+ float vMax = 11/256f;
+
+ GlStateManager.color(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ Utils.drawTexturedRect(bx-2, y3-2, 9, 11,
+ invert ? uMax : uMin, invert ? uMin : uMax,
+ invert ? vMax : vMin, invert ? vMin : vMax, GL11.GL_NEAREST);
+
+ Utils.renderShadowedString(EnumChatFormatting.WHITE.toString()+i, bx+w/2, y3, 10);
+ }
+
+ float timeNorm = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.fastest_time."+floorTime), 0);
+ float timeS = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.fastest_time_s."+floorTime), 0);
+ float timeSPLUS = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.fastest_time_s_plus."+floorTime), 0);
+ String timeNormStr = timeNorm <= 0 ? "N/A" : Utils.prettyTime((long)timeNorm);
+ String timeSStr = timeS <= 0 ? "N/A" : Utils.prettyTime((long)timeS);
+ String timeSPlusStr = timeSPLUS <= 0 ? "N/A" : Utils.prettyTime((long)timeSPLUS);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Floor "+floorTime+" ",
+ EnumChatFormatting.WHITE.toString()+timeNormStr, x, y3+10, sectionWidth);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Floor "+floorTime+" S",
+ EnumChatFormatting.WHITE.toString()+timeSStr, x, y3+20, sectionWidth);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Floor "+floorTime+" S+",
+ EnumChatFormatting.WHITE.toString()+timeSPlusStr, x, y3+30, sectionWidth);
+ }
+
+ //Completions
+ {
+ int x = guiLeft+161;
+ int y = guiTop+27;
+
+ Utils.renderShadowedString(EnumChatFormatting.RED+"Boss Collections",
+ x+sectionWidth/2, y, sectionWidth);
+ for(int i=1; i<=7; i++) {
+ float compl = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.dungeon_types.catacombs.tier_completions."+i), 0);
+
+ if(BOSS_HEADS[i-1] == null) {
+ String textureLink = bossFloorHeads[i-1];
+
+ String b64Decoded = "{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + textureLink + "\"}}}";
+ String b64Encoded = new String(Base64.getEncoder().encode(b64Decoded.getBytes()));
+
+ ItemStack stack = new ItemStack(Items.skull, 1, 3);
+ NBTTagCompound nbt = new NBTTagCompound();
+ NBTTagCompound skullOwner = new NBTTagCompound();
+ NBTTagCompound properties = new NBTTagCompound();
+ NBTTagList textures = new NBTTagList();
+ NBTTagCompound textures_0 = new NBTTagCompound();
+
+ String uuid = UUID.nameUUIDFromBytes(b64Encoded.getBytes()).toString();
+ skullOwner.setString("Id", uuid);
+ skullOwner.setString("Name", uuid);
+
+ textures_0.setString("Value", b64Encoded);
+ textures.appendTag(textures_0);
+
+ properties.setTag("textures", textures);
+ skullOwner.setTag("Properties", properties);
+ nbt.setTag("SkullOwner", skullOwner);
+ stack.setTagCompound(nbt);
+
+ BOSS_HEADS[i-1] = stack;
+ }
+
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(x-4, y+10+20*(i-1), 0);
+ GlStateManager.scale(1.3f, 1.3f, 1);
+ Utils.drawItemStack(BOSS_HEADS[i-1], 0, 0);
+ GlStateManager.popMatrix();
+
+ Utils.renderAlignedString(String.format(EnumChatFormatting.YELLOW+"%s (F%d) ", bossFloorArr[i-1], i),
+ EnumChatFormatting.WHITE.toString()+(int)compl,
+ x+16, y+18+20*(i-1), sectionWidth-15);
+
+ }
+ }
+
+ //Skills
+ {
+ int x = guiLeft+298;
+ int y = guiTop+27;
+
+ //Gui.drawRect(x, y, x+120, y+147, 0xffffffff);
+
+ Utils.renderShadowedString(EnumChatFormatting.DARK_PURPLE+"Class Levels",
+ x+sectionWidth/2, y, sectionWidth);
+
+ JsonElement activeClassElement = Utils.getElement(profileInfo, "dungeons.selected_dungeon_class");
+ String activeClass = null;
+ if(activeClassElement instanceof JsonPrimitive && ((JsonPrimitive) activeClassElement).isString()) {
+ activeClass = activeClassElement.getAsString();
+ }
+
+ for(int i=0; i<dungSkillsName.length; i++) {
+ String skillName = dungSkillsName[i];
+
+
+ HashMap<String, ProfileViewer.Level> levelObjClasses = levelObjClasseses.computeIfAbsent(profileId, k->new HashMap<>());
+ if(!levelObjClasses.containsKey(skillName)) {
+ float cataXp = Utils.getElementAsFloat(Utils.getElement(profileInfo,
+ "dungeons.player_classes."+skillName.toLowerCase()+".experience"), 0);
+ ProfileViewer.Level levelObj = ProfileViewer.getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(),
+ cataXp, 50, false);
+ levelObjClasses.put(skillName, levelObj);
+ }
+
+ String colour = EnumChatFormatting.WHITE.toString();
+ if(skillName.toLowerCase().equals(activeClass)) {
+ colour = EnumChatFormatting.GREEN.toString();
+ }
+
+ ProfileViewer.Level levelObj = levelObjClasses.get(skillName);
+
+ renderXpBar(colour+skillName, dungSkillsStack[i], x, y+20+29*i, sectionWidth, levelObj, mouseX, mouseY);
+ }
+ }
+ }
+
+ private void renderXpBar(String skillName, ItemStack stack, int x, int y, int xSize, ProfileViewer.Level levelObj, int mouseX, int mouseY) {
+ float level = levelObj.level;
+ int levelFloored = (int)Math.floor(level);
+
+ Utils.renderAlignedString(skillName, EnumChatFormatting.WHITE.toString()+levelFloored, x+14, y-4, xSize-20);
+
+ if(levelObj.maxed) {
+ renderGoldBar(x, y+6, xSize);
+ } else {
+ renderBar(x, y+6, xSize, level%1);
+ }
+
+ if(mouseX > x && mouseX < x+120) {
+ if(mouseY > y-4 && mouseY < y+13) {
+ String levelStr;
+ if(levelObj.maxed) {
+ levelStr = EnumChatFormatting.GOLD+"MAXED!";
+ } else {
+ int maxXp = (int)levelObj.maxXpForLevel;
+ levelStr = EnumChatFormatting.DARK_PURPLE.toString() + shortNumberFormat(Math.round((level%1)*maxXp),
+ 0) + "/" + shortNumberFormat(maxXp, 0);
+ }
+
+ tooltipToDisplay = Utils.createList(levelStr);
+ }
+ }
+
+ GL11.glTranslatef((x), (y-6f), 0);
+ GL11.glScalef(0.7f, 0.7f, 1);
+ Utils.drawItemStackLinear(stack, 0, 0);
+ GL11.glScalef(1/0.7f, 1/0.7f, 1);
+ GL11.glTranslatef(-(x), -(y-6f), 0);
+ }
+
+ public static class PetLevel {
+ public float level;
+ public float currentLevelRequirement;
+ public float maxXP;
+ public float levelPercentage;
+ public float levelXp;
+ public float totalXp;
+ }
+
+ public static PetLevel getPetLevel(JsonArray levels, int offset, float exp) {
+ float xpTotal = 0;
+ float level = 1;
+ float currentLevelRequirement = 0;
+ float currentLevelProgress = 0;
+
+ boolean addLevel = true;
+
+ for(int i=offset; i<offset+99; i++) {
+ if(addLevel) {
+ currentLevelRequirement = levels.get(i).getAsFloat();
+ xpTotal += currentLevelRequirement;
+ if(xpTotal > exp) {
+ currentLevelProgress = (exp-(xpTotal-currentLevelRequirement));
+ addLevel = false;
+ } else {
+ level += 1;
+ }
+ } else {
+ xpTotal += levels.get(i).getAsFloat();
+ }
+ }
+
+ level += currentLevelProgress/currentLevelRequirement;
+ if(level <= 0) {
+ level = 1;
+ } else if(level > 100) {
+ level = 100;
+ }
+ PetLevel levelObj = new PetLevel();
+ levelObj.level = level;
+ levelObj.currentLevelRequirement = currentLevelRequirement;
+ levelObj.maxXP = xpTotal;
+ levelObj.levelPercentage = currentLevelProgress/currentLevelRequirement;
+ levelObj.levelXp = currentLevelProgress;
+ levelObj.totalXp = exp;
+ return levelObj;
+ }
+
+ public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS = new HashMap<>();
+ static {
+ HashMap<String, Float> bigTeeth = new HashMap<>();
+ bigTeeth.put("CRIT_CHANCE", 5f);
+ PET_STAT_BOOSTS.put("PET_ITEM_BIG_TEETH_COMMON", bigTeeth);
+
+ HashMap<String, Float> hardenedScales = new HashMap<>();
+ hardenedScales.put("DEFENCE", 25f);
+ PET_STAT_BOOSTS.put("PET_ITEM_HARDENED_SCALES_UNCOMMON", hardenedScales);
+
+ HashMap<String, Float> luckyClover = new HashMap<>();
+ luckyClover.put("MAGIC_FIND", 7f);
+ PET_STAT_BOOSTS.put("PET_ITEM_LUCKY_CLOVER", luckyClover);
+
+ HashMap<String, Float> sharpenedClaws = new HashMap<>();
+ sharpenedClaws.put("CRIT_DAMAGE", 15f);
+ PET_STAT_BOOSTS.put("PET_ITEM_SHARPENED_CLAWS_UNCOMMON", sharpenedClaws);
+ }
+ public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS_MULT = new HashMap<>();
+ static {
+ HashMap<String, Float> ironClaws = new HashMap<>();
+ ironClaws.put("CRIT_DAMAGE", 1.4f);
+ ironClaws.put("CRIT_CHANCE", 1.4f);
+ PET_STAT_BOOSTS_MULT.put("PET_ITEM_IRON_CLAWS_COMMON", ironClaws);
+
+ HashMap<String, Float> textbook = new HashMap<>();
+ textbook.put("INTELLIGENCE", 2f);
+ PET_STAT_BOOSTS_MULT.put("PET_ITEM_TEXTBOOK", textbook);
+ }
+
+ private int selectedPet = -1;
+ private int petsPage = 0;
+ private List<JsonObject> sortedPets = null;
+ private List<ItemStack> sortedPetsStack = null;
+ public static HashMap<String, String> MINION_RARITY_TO_NUM = new HashMap<>();
+ static {
+ MINION_RARITY_TO_NUM.put("COMMON", "0");
+ MINION_RARITY_TO_NUM.put("UNCOMMON", "1");
+ MINION_RARITY_TO_NUM.put("RARE", "2");
+ MINION_RARITY_TO_NUM.put("EPIC", "3");
+ MINION_RARITY_TO_NUM.put("LEGENDARY", "4");
+ MINION_RARITY_TO_NUM.put("MYTHIC", "5");
+ }
+ private void drawPetsPage(int mouseX, int mouseY, float partialTicks) {
+ JsonObject petsInfo = profile.getPetsInfo(profileId);
+ if(petsInfo == null) return;
+ JsonObject petsJson = Constants.PETS;
+ if(petsJson == null) return;
+
+ String location = null;
+ JsonObject status = profile.getPlayerStatus();
+ if(status != null && status.has("mode")) {
+ location = status.get("mode").getAsString();
+ }
+
+ backgroundRotation += (currentTime - lastTime)/400f;
+ backgroundRotation %= 360;
+
+ String panoramaIdentifier = "day";
+ if(SBInfo.getInstance().currentTimeDate != null) {
+ if(SBInfo.getInstance().currentTimeDate.getHours() <= 6 ||
+ SBInfo.getInstance().currentTimeDate.getHours() >= 20) {
+ panoramaIdentifier = "night";
+ }
+ }
+
+ JsonArray pets = petsInfo.get("pets").getAsJsonArray();
+ if(sortedPets == null) {
+ sortedPets = new ArrayList<>();
+ sortedPetsStack = new ArrayList<>();
+ for(int i=0; i<pets.size(); i++) {
+ sortedPets.add(pets.get(i).getAsJsonObject());
+ }
+ sortedPets.sort((pet1, pet2) -> {
+ String tier1 = pet1.get("tier").getAsString();
+ String tierNum1 = MINION_RARITY_TO_NUM.get(tier1);
+ if(tierNum1 == null) return 1;
+ int tierNum1I = Integer.parseInt(tierNum1);
+ float exp1 = pet1.get("exp").getAsFloat();
+
+ String tier2 = pet2.get("tier").getAsString();
+ String tierNum2 = MINION_RARITY_TO_NUM.get(tier2);
+ if(tierNum2 == null) return -1;
+ int tierNum2I = Integer.parseInt(tierNum2);
+ float exp2 = pet2.get("exp").getAsFloat();
+
+ if(tierNum1I != tierNum2I) {
+ return tierNum2I - tierNum1I;
+ } else {
+ return (int)(exp2 - exp1);
+ }
+ });
+ for(JsonObject pet : sortedPets) {
+ String petname = pet.get("type").getAsString();
+ String tier = pet.get("tier").getAsString();
+ String heldItem = Utils.getElementAsString(pet.get("heldItem"), null);
+ JsonObject heldItemJson = heldItem==null?null:NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(heldItem);
+ String tierNum = MINION_RARITY_TO_NUM.get(tier);
+ float exp = pet.get("exp").getAsFloat();
+ if(tierNum == null) continue;
+
+ if(pet.has("heldItem") && !pet.get("heldItem").isJsonNull() && pet.get("heldItem").getAsString().equals("PET_ITEM_TIER_BOOST")) {
+ tierNum = ""+(Integer.parseInt(tierNum)+1);
+ }
+
+ int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt();
+ JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray();
+
+ PetLevel levelObj = getPetLevel(levelsArr, petRarityOffset, exp);
+ float level = levelObj.level;
+ float currentLevelRequirement = levelObj.currentLevelRequirement;
+ float maxXP = levelObj.maxXP;
+ pet.addProperty("level", level);
+ pet.addProperty("currentLevelRequirement", currentLevelRequirement);
+ pet.addProperty("maxXP", maxXP);
+
+ JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(petname+";"+tierNum);
+ if(petItem == null) continue;
+
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem, false, false);
+ HashMap<String, String> replacements = NotEnoughUpdates.INSTANCE.manager.getLoreReplacements(petname, tier, (int)Math.floor(level));
+
+ if(heldItem != null) {
+ HashMap<String, Float> petStatBoots = PET_STAT_BOOSTS.get(heldItem);
+ HashMap<String, Float> petStatBootsMult = PET_STAT_BOOSTS_MULT.get(heldItem);
+ if(petStatBoots != null) {
+ for(Map.Entry<String, Float> entryBoost : petStatBoots.entrySet()) {
+ try {
+ float value = Float.parseFloat(replacements.get(entryBoost.getKey()));
+ replacements.put(entryBoost.getKey(), String.valueOf((int)Math.floor(value+entryBoost.getValue())));
+ } catch(Exception ignored) {}
+ }
+
+ }
+ if(petStatBootsMult != null) {
+ for(Map.Entry<String, Float> entryBoost : petStatBootsMult.entrySet()) {
+ try {
+ float value = Float.parseFloat(replacements.get(entryBoost.getKey()));
+ replacements.put(entryBoost.getKey(), String.valueOf((int)Math.floor(value*entryBoost.getValue())));
+ } catch(Exception ignored) {}
+ }
+ }
+ }
+
+ NBTTagCompound tag = stack.getTagCompound()==null?new NBTTagCompound():stack.getTagCompound();
+ if(tag.hasKey("display", 10)) {
+ NBTTagCompound display = tag.getCompoundTag("display");
+ if(display.hasKey("Lore", 9)) {
+ NBTTagList newNewLore = new NBTTagList();
+ NBTTagList newLore = new NBTTagList();
+ NBTTagList lore = display.getTagList("Lore", 8);
+ HashMap<Integer, Integer> blankLocations = new HashMap<>();
+ for(int j=0; j<lore.tagCount(); j++) {
+ String line = lore.getStringTagAt(j);
+ if(line.trim().isEmpty()) {
+ blankLocations.put(blankLocations.size(), j);
+ }
+ for(Map.Entry<String, String> replacement : replacements.entrySet()) {
+ line = line.replace("{"+replacement.getKey()+"}", replacement.getValue());
+ }
+ newLore.appendTag(new NBTTagString(line));
+ }
+ Integer secondLastBlank = blankLocations.get(blankLocations.size()-2);
+ if(heldItemJson != null && secondLastBlank != null) {
+ for(int j=0; j<newLore.tagCount(); j++) {
+ String line = newLore.getStringTagAt(j);
+
+ if(j == secondLastBlank.intValue()) {
+ newNewLore.appendTag(new NBTTagString(""));
+ newNewLore.appendTag(new NBTTagString(EnumChatFormatting.GOLD+"Held Item: "+heldItemJson.get("displayname").getAsString()));
+ int blanks = 0;
+ JsonArray heldItemLore = heldItemJson.get("lore").getAsJsonArray();
+ for(int k=0; k<heldItemLore.size(); k++) {
+ String heldItemLine = heldItemLore.get(k).getAsString();
+ if(heldItemLine.trim().isEmpty()) {
+ blanks++;
+ } else if(blanks==2) {
+ newNewLore.appendTag(new NBTTagString(heldItemLine));
+ } else if(blanks>2) {
+ break;
+ }
+ }
+ }
+
+ newNewLore.appendTag(new NBTTagString(line));
+ }
+ display.setTag("Lore", newNewLore);
+ } else {
+ display.setTag("Lore", newLore);
+ }
+ }
+ if(display.hasKey("Name", 8)) {
+ String displayName = display.getString("Name");
+ for(Map.Entry<String, String> replacement : replacements.entrySet()) {
+ displayName = displayName.replace("{"+replacement.getKey()+"}", replacement.getValue());
+ }
+ display.setTag("Name", new NBTTagString(displayName));
+ }
+ tag.setTag("display", display);
+ }
+ stack.setTagCompound(tag);
+
+ sortedPetsStack.add(stack);
+ }
+ }
+
+ Panorama.drawPanorama(-backgroundRotation, guiLeft+212, guiTop+44, 81, 108, -0.37f, 0.6f,
+ getPanoramasForLocation(location==null?"dynamic":location, panoramaIdentifier));
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_pets);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+
+ Utils.drawStringCentered(EnumChatFormatting.DARK_PURPLE+"Pets", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+100, guiTop+14, true, 4210752);
+ GlStateManager.color(1, 1, 1, 1);
+
+ JsonElement activePetElement = petsInfo.get("active_pet");
+ if(selectedPet == -1 && activePetElement != null && activePetElement.isJsonObject()) {
+ JsonObject active = activePetElement.getAsJsonObject();
+ for(int i=0; i<sortedPets.size(); i++) {
+ if(sortedPets.get(i) == active) {
+ selectedPet = i;
+ break;
+ }
+ }
+ }
+
+ boolean leftHovered = false;
+ boolean rightHovered = false;
+ if(Mouse.isButtonDown(0)) {
+ if(mouseY > guiTop+6 && mouseY < guiTop+22) {
+ if(mouseX > guiLeft+100-20-12 && mouseX < guiLeft+100-20) {
+ leftHovered = true;
+ } else if(mouseX > guiLeft+100+20 && mouseX < guiLeft+100+20+12) {
+ rightHovered = true;
+ }
+ }
+ }
+ Minecraft.getMinecraft().getTextureManager().bindTexture(resource_packs);
+
+ if(petsPage > 0) {
+ Utils.drawTexturedRect(guiLeft+100-15-12, guiTop+6, 12, 16,
+ 29/256f, 53/256f, !leftHovered?0:32/256f, !leftHovered?32/256f:64/256f, GL11.GL_NEAREST);
+ }
+ if(petsPage < Math.ceil(pets.size()/20f)-1) {
+ Utils.drawTexturedRect( guiLeft+100+15, guiTop+6, 12, 16,
+ 5/256f, 29/256f, !rightHovered?0:32/256f, !rightHovered?32/256f:64/256f, GL11.GL_NEAREST);
+ }
+
+ for(int i=petsPage*20; i<Math.min(petsPage*20+20, Math.min(sortedPetsStack.size(), sortedPets.size())); i++) {
+ JsonObject pet = sortedPets.get(i);
+ ItemStack stack = sortedPetsStack.get(i);
+ if(pet != null) {
+ int xIndex = (i%20) % COLLS_XCOUNT;
+ int yIndex = (i%20) / COLLS_XCOUNT;
+
+ float x = 5 + COLLS_XPADDING + (COLLS_XPADDING + 20) * xIndex;
+ float y = 7 + COLLS_YPADDING + (COLLS_YPADDING + 20) * yIndex;
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ if(i == selectedPet) {
+ GlStateManager.color(1, 185/255f, 0, 1);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20,
+ 0, 20/256f, 0, 20/256f, GL11.GL_NEAREST);
+ } else {
+ GlStateManager.color(1, 1, 1, 1);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20,
+ 0, 20/256f, 0, 20/256f, GL11.GL_NEAREST);
+ }
+
+ Utils.drawItemStack(stack, guiLeft+(int)x+2, guiTop+(int)y+2);
+
+ if(mouseX > guiLeft+x && mouseX < guiLeft+x+20) {
+ if(mouseY > guiTop+y && mouseY < guiTop+y+20) {
+ tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
+ }
+ }
+ }
+
+ if(selectedPet >= 0) {
+ ItemStack petStack = sortedPetsStack.get(selectedPet);
+ String display = petStack.getDisplayName();
+ JsonObject pet = sortedPets.get(selectedPet);
+ String type = pet.get("type").getAsString();
+
+ for(int i=0; i<4; i++) {
+ JsonObject item = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(type+";"+i);
+ if(item != null) {
+ int x = guiLeft+280;
+ float y = guiTop+67+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI));
+
+ int displayLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(display);
+ int halfDisplayLen = displayLen/2;
+
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(x, y, 0);
+
+ drawRect(-halfDisplayLen-1-28, -1, halfDisplayLen+1-28, 8, new Color(0, 0, 0, 100).getRGB());
+
+ Minecraft.getMinecraft().fontRendererObj.drawString(display, -halfDisplayLen-28, 0, 0, true);
+
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item);
+ GlStateManager.enableDepth();
+ GlStateManager.translate(-55, 0, 0);
+ GlStateManager.scale(3.5f, 3.5f, 1);
+ Utils.drawItemStack(stack, 0, 0);
+ GlStateManager.popMatrix();
+ break;
+ }
+ }
+
+ float level = pet.get("level").getAsFloat();
+ float currentLevelRequirement = pet.get("currentLevelRequirement").getAsFloat();
+ float exp = pet.get("exp").getAsFloat();
+ float maxXP = pet.get("maxXP").getAsFloat();
+
+ String[] split = display.split("] ");
+ String colouredName = split[split.length-1];
+
+ Utils.renderAlignedString(colouredName, EnumChatFormatting.WHITE+"Level "+(int)Math.floor(level), guiLeft+319, guiTop+28, 98);
+
+ //Utils.drawStringCenteredScaledMaxWidth(, Minecraft.getMinecraft().fontRendererObj, guiLeft+368, guiTop+28+4, true, 98, 0);
+ //renderAlignedString(display, EnumChatFormatting.YELLOW+"[LVL "+Math.floor(level)+"]", guiLeft+319, guiTop+28, 98);
+ renderBar(guiLeft+319, guiTop+38, 98, (float)Math.floor(level)/100f);
+
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"To Next LVL", EnumChatFormatting.WHITE.toString()+(int)(level%1*100)+"%", guiLeft+319, guiTop+46, 98);
+ renderBar(guiLeft+319, guiTop+56, 98, level%1);
+
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"To Max LVL", EnumChatFormatting.WHITE.toString()+Math.min(100, (int)(exp/maxXP*100))+"%", guiLeft+319, guiTop+64, 98);
+ renderBar(guiLeft+319, guiTop+74, 98, exp/maxXP);
+
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(exp, 0), guiLeft+319, guiTop+125, 98);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Current LVL XP",
+ EnumChatFormatting.WHITE.toString()+shortNumberFormat((level%1)*currentLevelRequirement, 0), guiLeft+319, guiTop+143, 98);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Required LVL XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(currentLevelRequirement, 0), guiLeft+319, guiTop+161, 98);
+ }
+ }
+
+ private String[] romans = new String[]{"I","II","III","IV","V","VI","VII","VIII","IX","X","XI",
+ "XII","XIII","XIV","XV","XVI","XVII","XIX","XX"};
+
+ private final int COLLS_XCOUNT = 5;
+ private final int COLLS_YCOUNT = 4;
+ private final float COLLS_XPADDING = (190-COLLS_XCOUNT*20)/(float)(COLLS_XCOUNT+1);
+ private final float COLLS_YPADDING = (202-COLLS_YCOUNT*20)/(float)(COLLS_YCOUNT+1);
+
+ private void drawColsPage(int mouseX, int mouseY, float partialTicks) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_cols);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+
+ JsonObject collectionInfo = profile.getCollectionInfo(profileId);
+ if(collectionInfo == null) {
+ Utils.drawStringCentered(EnumChatFormatting.RED+"Collection API not enabled!", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+134, guiTop+101, true, 0);
+ return;
+ }
+ JsonObject resourceCollectionInfo = ProfileViewer.getResourceCollectionInformation();
+ if(resourceCollectionInfo == null) return;
+
+ int collectionCatSize = ProfileViewer.getCollectionCatToCollectionMap().size();
+ int collectionCatYSize = (int)(162f/(collectionCatSize-1+0.0000001f));
+ {
+ int yIndex = 0;
+ for(ItemStack stack : ProfileViewer.getCollectionCatToCollectionMap().keySet()) {
+ if(selectedCollectionCategory == null) selectedCollectionCategory = stack;
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ if(stack == selectedCollectionCategory) {
+ Utils.drawTexturedRect(guiLeft+7, guiTop+10+collectionCatYSize*yIndex, 20, 20,
+ 20/256f, 0, 20/256f, 0, GL11.GL_NEAREST);
+ Utils.drawItemStackWithText(stack, guiLeft+10, guiTop+13+collectionCatYSize*yIndex, ""+(yIndex+1));
+ } else {
+ Utils.drawTexturedRect(guiLeft+7, guiTop+10+collectionCatYSize*yIndex, 20, 20,
+ 0, 20/256f, 0, 20/256f, GL11.GL_NEAREST);
+ Utils.drawItemStackWithText(stack, guiLeft+9, guiTop+12+collectionCatYSize*yIndex, ""+(yIndex+1));
+ }
+ yIndex++;
+ }
+ }
+
+ Utils.drawStringCentered(selectedCollectionCategory.getDisplayName() + " Collections", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+134, guiTop+14, true, 4210752);
+
+ JsonObject minionTiers = collectionInfo.get("minion_tiers").getAsJsonObject();
+ JsonObject collectionTiers = collectionInfo.get("collection_tiers").getAsJsonObject();
+ JsonObject maxAmounts = collectionInfo.get("max_amounts").getAsJsonObject();
+ JsonObject totalAmounts = collectionInfo.get("total_amounts").getAsJsonObject();
+ JsonObject personalAmounts = collectionInfo.get("personal_amounts").getAsJsonObject();
+
+ List<String> collections = ProfileViewer.getCollectionCatToCollectionMap().get(selectedCollectionCategory);
+ if(collections != null) {
+ for(int i=0; i<collections.size(); i++) {
+ String collection = collections.get(i);
+ if(collection != null) {
+ ItemStack collectionItem = ProfileViewer.getCollectionToCollectionDisplayMap().get(collection);
+ if(collectionItem != null) {
+ int xIndex = i%COLLS_XCOUNT;
+ int yIndex = i/COLLS_XCOUNT;
+
+ float x = 39+COLLS_XPADDING+(COLLS_XPADDING+20)*xIndex;
+ float y = 7+COLLS_YPADDING+(COLLS_YPADDING+20)*yIndex;
+
+ String tierString;
+ int tier = (int)Utils.getElementAsFloat(collectionTiers.get(collection), 0);
+ if(tier > 20 || tier < 0) {
+ tierString = String.valueOf(tier);
+ } else {
+ tierString = romans[tier];
+ }
+ float amount = Utils.getElementAsFloat(totalAmounts.get(collection), 0);
+ float maxAmount = Utils.getElementAsFloat(maxAmounts.get(collection), 0);
+ Color color = new Color(128, 128, 128, 255);
+ int tierStringColour = color.getRGB();
+ float completedness = 0;
+ if(maxAmount > 0) {
+ completedness = amount/maxAmount;
+ }
+ completedness = Math.min(1, completedness);
+ if(maxAmounts.has(collection) && completedness >= 1) {
+ tierStringColour = new Color(255, 215, 0).getRGB();
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20*(1-completedness),
+ 0, 20/256f, 0, 20*(1-completedness)/256f, GL11.GL_NEAREST);
+ GlStateManager.color(1, 185/255f, 0, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y+20*(1-completedness), 20, 20*(completedness),
+ 0, 20/256f, 20*(1-completedness)/256f, 20/256f, GL11.GL_NEAREST);
+ Utils.drawItemStack(collectionItem, guiLeft+(int)x+2, guiTop+(int)y+2);
+
+ if(mouseX > guiLeft+(int)x+2 && mouseX < guiLeft+(int)x+18) {
+ if(mouseY > guiTop+(int)y+2 && mouseY < guiTop+(int)y+18) {
+ tooltipToDisplay = new ArrayList<>();
+ tooltipToDisplay.add(collectionItem.getDisplayName() + " " +
+ (completedness>=1?EnumChatFormatting.GOLD:EnumChatFormatting.GRAY) + tierString);
+ tooltipToDisplay.add("Collected: " + numberFormat.format(Utils.getElementAsFloat(personalAmounts.get(collection), 0)));
+ tooltipToDisplay.add("Total Collected: " + numberFormat.format(amount));
+ }
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ if(tier >= 0) {
+ Utils.drawStringCentered(tierString, fontRendererObj,
+ guiLeft+x+10, guiTop+y-4, true,
+ tierStringColour);
+ }
+
+ Utils.drawStringCentered(shortNumberFormat(amount, 0)+"", fontRendererObj,
+ guiLeft+x+10, guiTop+y+26, true,
+ color.getRGB());
+ }
+ }
+ }
+ }
+
+ Utils.drawStringCentered(selectedCollectionCategory.getDisplayName() + " Minions", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+326, guiTop+14, true, 4210752);
+
+ float MAX_MINION_TIER = 11f;
+ List<String> minions = ProfileViewer.getCollectionCatToMinionMap().get(selectedCollectionCategory);
+ if(minions != null) {
+ for(int i=0; i<minions.size(); i++) {
+ String minion = minions.get(i);
+ if(minion != null) {
+ JsonObject minionJson = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(minion+"_GENERATOR_1");
+ if(minionJson != null) {
+ int xIndex = i%COLLS_XCOUNT;
+ int yIndex = i/COLLS_XCOUNT;
+
+ float x = 231+COLLS_XPADDING+(COLLS_XPADDING+20)*xIndex;
+ float y = 7+COLLS_YPADDING+(COLLS_YPADDING+20)*yIndex;
+
+ String tierString;
+ int tier = (int)Utils.getElementAsFloat(minionTiers.get(minion), 0);
+ if(tier-1 >= romans.length || tier-1 < 0) {
+ tierString = String.valueOf(tier);
+ } else {
+ tierString = romans[tier-1];
+ }
+
+ Color color = new Color(128, 128, 128, 255);
+ int tierStringColour = color.getRGB();
+ float completedness = tier/MAX_MINION_TIER;
+
+ completedness = Math.min(1, completedness);
+ if(completedness >= 1) {
+ tierStringColour = new Color(255, 215, 0).getRGB();
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y, 20, 20*(1-completedness),
+ 0, 20/256f, 0, 20*(1-completedness)/256f, GL11.GL_NEAREST);
+ GlStateManager.color(1, 185/255f, 0, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ Utils.drawTexturedRect(guiLeft+x, guiTop+y+20*(1-completedness), 20, 20*(completedness),
+ 0, 20/256f, 20*(1-completedness)/256f, 20/256f, GL11.GL_NEAREST);
+
+ Utils.drawItemStack(NotEnoughUpdates.INSTANCE.manager.jsonToStack(minionJson), guiLeft+(int)x+2, guiTop+(int)y+2);
+
+ if(mouseX > guiLeft+(int)x+2 && mouseX < guiLeft+(int)x+18) {
+ if(mouseY > guiTop+(int)y+2 && mouseY < guiTop+(int)y+18) {
+ tooltipToDisplay = NotEnoughUpdates.INSTANCE.manager.jsonToStack(minionJson)
+ .getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ if(tier >= 0) {
+ Utils.drawStringCentered(tierString, fontRendererObj,
+ guiLeft+x+10, guiTop+y-4, true,
+ tierStringColour);
+ }
+ }
+ }
+ }
+ }
+
+ //190
+ }
+
+ private static final LinkedHashMap<String, ItemStack> invNameToDisplayMap = new LinkedHashMap<>();
+ static {
+ invNameToDisplayMap.put("inv_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.chest), EnumChatFormatting.GRAY+"Inventory"));
+ invNameToDisplayMap.put("ender_chest_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.ender_chest), EnumChatFormatting.GRAY+"Ender Chest"));
+ //invNameToDisplayMap.put("backpack_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.dropper), EnumChatFormatting.GRAY+"Backpacks"));
+ invNameToDisplayMap.put("backpack_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("JUMBO_BACKPACK")).setStackDisplayName(EnumChatFormatting.GRAY+"Backpacks"));
+ invNameToDisplayMap.put("personal_vault_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("IRON_CHEST")).setStackDisplayName(EnumChatFormatting.GRAY+"Personal vault"));
+ invNameToDisplayMap.put("talisman_bag", Utils.createItemStack(Items.golden_apple, EnumChatFormatting.GRAY+"Accessory Bag"));
+ invNameToDisplayMap.put("wardrobe_contents", Utils.createItemStack(Items.leather_chestplate, EnumChatFormatting.GRAY+"Wardrobe"));
+ invNameToDisplayMap.put("fishing_bag", Utils.createItemStack(Items.fish, EnumChatFormatting.GRAY+"Fishing Bag"));
+ invNameToDisplayMap.put("potion_bag", Utils.createItemStack(Items.potionitem, EnumChatFormatting.GRAY+"Potion Bag"));
+ }
+
+ public int countItemsInInventory(String internalname, JsonObject inventoryInfo, String... invsToSearch) {
+ int count = 0;
+ for(String inv : invsToSearch) {
+ JsonArray invItems = inventoryInfo.get(inv).getAsJsonArray();
+ for(int i=0; i<invItems.size(); i++) {
+ if(invItems.get(i) == null || !invItems.get(i).isJsonObject()) continue;
+ JsonObject item = invItems.get(i).getAsJsonObject();
+ if(item.get("internalname").getAsString().equals(internalname)) {
+ if(item.has("count")) {
+ count += item.get("count").getAsInt();
+ } else {
+ count += 1;
+ }
+ }
+ }
+ }
+ return count;
+ }
+
+ private static final Pattern DAMAGE_PATTERN = Pattern.compile("^Damage: \\+([0-9]+)");
+ private static final Pattern STRENGTH_PATTERN = Pattern.compile("^Strength: \\+([0-9]+)");
+ private static final Pattern FISHSPEED_PATTERN = Pattern.compile("^Increases fishing speed by \\+([0-9]+)");
+
+ private ItemStack[] findBestItems(JsonObject inventoryInfo, int numItems, String[] invsToSearch, String[] typeMatches, Pattern... importantPatterns) {
+ ItemStack[] bestItems = new ItemStack[numItems];
+ TreeMap<Integer, Set<ItemStack>> map = new TreeMap<>();
+ for(String inv : invsToSearch) {
+ JsonArray invItems = inventoryInfo.get(inv).getAsJsonArray();
+ for(int i=0; i<invItems.size(); i++) {
+ if(invItems.get(i) == null || !invItems.get(i).isJsonObject()) continue;
+ JsonObject item = invItems.get(i).getAsJsonObject();
+ JsonArray lore = item.get("lore").getAsJsonArray();
+ if(Utils.checkItemType(lore, true, typeMatches) >= 0) {
+ int importance = 0;
+ for(int j=0; j<lore.size(); j++) {
+ String line = lore.get(j).getAsString();
+ for(Pattern pattern : importantPatterns) {
+ Matcher matcher = pattern.matcher(Utils.cleanColour(line));
+ if(matcher.find()) {
+ importance += Integer.parseInt(matcher.group(1));
+ }
+ }
+ }
+ map.computeIfAbsent(importance, k->new HashSet<>()).add(
+ NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, false));
+ }
+ }
+ }
+ int i=0;
+ outer:
+ for(int key : map.descendingKeySet()) {
+ Set<ItemStack> items = map.get(key);
+ for(ItemStack item : items) {
+ bestItems[i] = item;
+ if(++i >= bestItems.length) break outer;
+ }
+ }
+
+ return bestItems;
+ }
+
+ private int getRowsForInventory(String invName) {
+ switch(invName) {
+ case "wardrobe_contents":
+ return 4;
+ case "backpack_contents":
+ return 5;
+ case "ender_chest_contents":
+ return 5;
+ }
+ return 6;
+ }
+
+ private boolean useActualMax(String invName) {
+ switch(invName) {
+ case "talisman_bag":
+ case "fishing_bag":
+ case "potion_bag":
+ case "personal_vault_contents":
+ return true;
+ }
+ return false;
+ }
+
+ private int getIgnoredRowsForInventory(String invName) {
+ switch(invName) {
+ case "talisman_bag":
+ case "fishing_bag":
+ case "potion_bag":
+ return 1;
+ }
+ return 0;
+ }
+
+ private int getAvailableSlotsForInventory(JsonObject inventoryInfo, JsonObject collectionInfo, String invName) {
+ if(collectionInfo == null) return -1;
+ JsonObject misc = Constants.MISC;
+ if(misc == null) return -1;
+ JsonElement sizesElement = Utils.getElement(misc, "bag_size."+invName+".sizes");
+ JsonElement collectionElement = Utils.getElement(misc, "bag_size."+invName+".collection");
+
+ if(sizesElement == null || !sizesElement.isJsonArray()) return -1;
+ if(collectionElement == null || !collectionElement.isJsonPrimitive()) return -1;
+
+ JsonArray sizes = sizesElement.getAsJsonArray();
+ String collection = collectionElement.getAsString();
+
+ JsonElement tierElement = Utils.getElement(collectionInfo, "collection_tiers."+collection);
+
+ if(tierElement == null || !tierElement.isJsonPrimitive()) {
+ return 0;
+ }
+ int tier = tierElement.getAsInt();
+
+ int currentSlots = 0;
+ for(int i=0; i<sizes.size(); i++) {
+ JsonObject sizeInfo = sizes.get(i).getAsJsonObject();
+ if(sizeInfo.get("tier").getAsInt() <= tier) {
+ currentSlots = sizeInfo.get("slots").getAsInt();
+ }
+ }
+ return currentSlots;
+ }
+
+ private ItemStack fillerStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, 15);
+ public ItemStack[][][] getItemsForInventory(JsonObject inventoryInfo, String invName) {
+ if(inventoryItems.containsKey(invName)) return inventoryItems.get(invName);
+
+ JsonArray jsonInv = Utils.getElement(inventoryInfo, invName).getAsJsonArray();
+
+ if(jsonInv.size() == 0) return new ItemStack[1][][];
+
+ int jsonInvSize;
+ if(useActualMax(invName)) {
+ jsonInvSize = (int)Math.ceil(jsonInv.size()/9f)*9;
+ } else {
+ jsonInvSize = 9*4;
+ float divideBy = 9f;
+ if(invName.equals("wardrobe_contents")){
+ divideBy = 36f;
+ }
+ for(int i=9*4; i<jsonInv.size(); i++) {
+ JsonElement item = jsonInv.get(i);
+ if(item != null && item.isJsonObject()) {
+ jsonInvSize = (int) (Math.ceil((i+1)/divideBy)*(int)divideBy);
+ }
+ }
+ }
+
+ int rowSize = 9;
+ int rows = jsonInvSize/rowSize;
+ int maxRowsPerPage = getRowsForInventory(invName);
+ int maxInvSize = rowSize*maxRowsPerPage;
+
+ int numInventories = (jsonInvSize-1)/maxInvSize+1;
+ JsonArray backPackSizes = (JsonArray) inventoryInfo.get("backpack_sizes");
+ if(invName.equals("backpack_contents")) {
+ numInventories = backPackSizes.size();
+ }
+
+ ItemStack[][][] inventories = new ItemStack[numInventories][][];
+
+ //int availableSlots = getAvailableSlotsForInventory(inventoryInfo, collectionInfo, invName);
+ int startNumberJ = 0;
+
+ for(int i=0; i<numInventories; i++) {
+ int thisRows = Math.min(maxRowsPerPage, rows-maxRowsPerPage*i);
+ int invSize =0;
+
+
+ if(invName.equals("backpack_contents")) {
+ thisRows = backPackSizes.get(i).getAsInt()/9;
+ invSize = startNumberJ+(thisRows*9);
+ maxInvSize = thisRows*9;
+ } else {
+ startNumberJ = maxInvSize*i;
+ invSize = Math.min(jsonInvSize, maxInvSize + maxInvSize * i);
+ }
+ if(thisRows <= 0) break;
+
+ ItemStack[][] items = new ItemStack[thisRows][rowSize];
+
+ for(int j=startNumberJ; j<invSize; j++) {
+
+ int xIndex = (j%maxInvSize)%rowSize;
+ int yIndex = (j%maxInvSize)/rowSize;
+ if(invName.equals("inv_contents")) {
+ yIndex--;
+ if(yIndex < 0) yIndex = rows-1;
+ }
+ if(yIndex >= thisRows) {
+ break;
+ }
+
+ if(j >= jsonInv.size()) {
+ items[yIndex][xIndex] = fillerStack;
+ continue;
+ }
+ if(jsonInv.get(j) == null || !jsonInv.get(j).isJsonObject()) {
+ continue;
+ }
+
+ JsonObject item = jsonInv.get(j).getAsJsonObject();
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, false);
+ if(item.has("item_contents")) {
+ JsonArray bytesArr = item.get("item_contents").getAsJsonArray();
+ byte[] bytes = new byte[bytesArr.size()];
+ for(int bytesArrI=0; bytesArrI<bytesArr.size(); bytesArrI++) {
+ bytes[bytesArrI] = bytesArr.get(bytesArrI).getAsByte();
+ }
+ //byte[] bytes2 = null;
+ NBTTagCompound tag = stack.getTagCompound();
+ if(tag != null && tag.hasKey("ExtraAttributes", 10)) {
+ NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
+ for(String key : ea.getKeySet()) {
+ if(key.endsWith("backpack_data") || key.equals("new_year_cake_bag_data")) {
+ ea.setTag(key, new NBTTagByteArray(bytes));
+ break;
+ }
+ }
+ tag.setTag("ExtraAttributes", ea);
+ stack.setTagCompound(tag);
+ }
+ }
+
+ items[yIndex][xIndex] = stack;
+ }
+ inventories[i] = items;
+ if(invName.equals("backpack_contents")) {
+ startNumberJ = startNumberJ + backPackSizes.get(i).getAsInt();
+ }
+ }
+
+ inventoryItems.put(invName, inventories);
+ return inventories;
+ }
+
+
+ private ItemStack[] bestWeapons = null;
+ private ItemStack[] bestRods = null;
+ private ItemStack[] armorItems = null;
+ private HashMap<String, ItemStack[][][]> inventoryItems = new HashMap<>();
+ private String selectedInventory = "inv_contents";
+ private int currentInventoryIndex = 0;
+ private int arrowCount = -1;
+ private int greenCandyCount = -1;
+ private int purpleCandyCount = -1;
+ private GuiElementTextField inventoryTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT);
+ private ItemStack lastBackpack;
+ private int lastBackpackX;
+ private int lastBackpackY;
+ private void drawInvsPage(int mouseX, int mouseY, float partialTicks) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_invs);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+ inventoryTextField.setSize(88, 20);
+
+ JsonObject inventoryInfo = profile.getInventoryInfo(profileId);
+ if(inventoryInfo == null) return;
+
+ int invNameIndex=0;
+ for(Map.Entry<String, ItemStack> entry : invNameToDisplayMap.entrySet()) {
+ int xIndex = invNameIndex%3;
+ int yIndex = invNameIndex/3;
+
+ int x = 19+34*xIndex;
+ int y = 26+34*yIndex;
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements);
+ if(entry.getKey().equals(selectedInventory)) {
+ Utils.drawTexturedRect(guiLeft+x-2, guiTop+y-2, 20, 20, 20/256f, 0,
+ 20/256f, 0, GL11.GL_NEAREST);
+ x++;
+ y++;
+ } else {
+ Utils.drawTexturedRect(guiLeft+x-2, guiTop+y-2, 20, 20, 0, 20/256f,
+ 0, 20/256f, GL11.GL_NEAREST);
+ }
+
+ Utils.drawItemStackWithText(entry.getValue(), guiLeft+x, guiTop+y, ""+(invNameIndex+1));
+
+ if(mouseX >= guiLeft+x && mouseX <= guiLeft+x+16) {
+ if(mouseY >= guiTop+y && mouseY <= guiTop+y+16) {
+ tooltipToDisplay = entry.getValue().getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
+ }
+
+ invNameIndex++;
+ }
+
+ inventoryTextField.render(guiLeft+19, guiTop+sizeY-26-20);
+
+ if(armorItems == null) {
+ armorItems = new ItemStack[4];
+ JsonArray armor = Utils.getElement(inventoryInfo, "inv_armor").getAsJsonArray();
+ for(int i=0; i<armor.size(); i++) {
+ if(armor.get(i) == null || !armor.get(i).isJsonObject()) continue;
+ armorItems[i] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(armor.get(i).getAsJsonObject(), false);
+ }
+ }
+
+ for(int i=0; i<armorItems.length; i++) {
+ ItemStack stack = armorItems[i];
+ if(stack != null) {
+ Utils.drawItemStack(stack, guiLeft+173, guiTop+67-18*i);
+ if(stack != fillerStack) {
+ if(mouseX >= guiLeft+173-1 && mouseX <= guiLeft+173+16+1) {
+ if(mouseY >= guiTop+67-18*i-1 && mouseY <= guiTop+67-18*i+16+1) {
+ tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+ }
+ }
+ }
+ }
+ }
+
+ ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, selectedInventory);
+ if(currentInventoryIndex >= inventories.length) currentInventoryIndex = inventories.length-1;
+ if(currentInventoryIndex < 0) currentInventoryIndex = 0;
+
+ ItemStack[][] inventory = inventories[currentInventoryIndex];
+ if(inventory == null) {
+ Utils.drawStringCentered(EnumChatFormatting.RED+"Inventory API not enabled!"+selectedInventory, Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+317, guiTop+101, true, 0);
+ return;
+ }
+
+ if(bestWeapons == null) {
+ bestWeapons = findBestItems(inventoryInfo, 6, new String[]{"inv_contents", "ender_chest_contents"},
+ new String[]{"SWORD","BOW"}, DAMAGE_PATTERN, STRENGTH_PATTERN);
+ }
+ if(bestRods == null) {
+ bestRods = findBestItems(inventoryInfo, 3, new String[]{"inv_contents", "ender_chest_contents"},
+ new String[]{"FISHING ROD"}, FISHSPEED_PATTERN);
+ }
+
+ for(int i=0; i<bestWeapons.length; i++) {
+ if(bestWeapons[i] == null) continue;
+ ItemStack stack = bestWeapons[i];
+ Utils.drawItemStack(stack, guiLeft+143, guiTop+13+18*i);
+ if(mouseX >= guiLeft+143-1 && mouseX <= guiLeft+143+16+1) {
+ if(mouseY >= guiTop+13+18*i-1 && mouseY <= guiTop+13+18*i+16+1) {
+ tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
+ }
+ }
+
+ for(int i=0; i<bestRods.length; i++) {
+ if(bestRods[i] == null) continue;
+ ItemStack stack = bestRods[i];
+ Utils.drawItemStack(stack, guiLeft+143, guiTop+137+18*i);
+ if(mouseX >= guiLeft+143-1 && mouseX <= guiLeft+143+16+1) {
+ if(mouseY >= guiTop+137+18*i-1 && mouseY <= guiTop+137+18*i+16+1) {
+ tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
+ }
+ }
+
+ if(arrowCount == -1) {
+ arrowCount = countItemsInInventory("ARROW", inventoryInfo, "quiver");
+ }
+ if(greenCandyCount == -1) {
+ greenCandyCount = countItemsInInventory("GREEN_CANDY", inventoryInfo, "candy_inventory_contents");
+ }
+ if(purpleCandyCount == -1) {
+ purpleCandyCount = countItemsInInventory("PURPLE_CANDY", inventoryInfo, "candy_inventory_contents");
+ }
+
+ Utils.drawItemStackWithText(NotEnoughUpdates.INSTANCE.manager.jsonToStack(
+ NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ARROW")), guiLeft+173, guiTop+101,
+ ""+(arrowCount>999?shortNumberFormat(arrowCount, 0):arrowCount));
+ Utils.drawItemStackWithText(NotEnoughUpdates.INSTANCE.manager.jsonToStack(
+ NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("GREEN_CANDY")), guiLeft+173, guiTop+119, ""+greenCandyCount);
+ Utils.drawItemStackWithText(NotEnoughUpdates.INSTANCE.manager.jsonToStack(
+ NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PURPLE_CANDY")), guiLeft+173, guiTop+137, ""+purpleCandyCount);
+ if(mouseX > guiLeft+173 && mouseX < guiLeft+173+16) {
+ if(mouseY > guiTop+101 && mouseY < guiTop+137+16) {
+ if(mouseY < guiTop+101+17) {
+ tooltipToDisplay = Utils.createList(EnumChatFormatting.WHITE+"Arrow "+EnumChatFormatting.GRAY+"x"+arrowCount);
+ } else if(mouseY < guiTop+119+17) {
+ tooltipToDisplay = Utils.createList(EnumChatFormatting.GREEN+"Green Candy "+EnumChatFormatting.GRAY+"x"+greenCandyCount);
+ } else {
+ tooltipToDisplay = Utils.createList(EnumChatFormatting.DARK_PURPLE+"Purple Candy "+EnumChatFormatting.GRAY+"x"+purpleCandyCount);
+ }
+ }
+ }
+
+ int inventoryRows = inventory.length;
+
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
+
+ int invSizeY = inventoryRows*18+17+7;
+
+ int x = guiLeft+320-176/2;
+ int y = guiTop+101-invSizeY/2;
+ int staticSelectorHeight = guiTop+177;
+
+ this.drawTexturedModalRect(x, y, 0, 0, 176, inventoryRows*18+17);
+ this.drawTexturedModalRect(x, y+inventoryRows*18+17, 0, 215, 176, 7);
+
+ boolean leftHovered = false;
+ boolean rightHovered = false;
+ if(Mouse.isButtonDown(0)) {
+ if(mouseY > staticSelectorHeight && mouseY < staticSelectorHeight+16) {
+ if(mouseX > guiLeft+320-12 && mouseX < guiLeft+320+12) {
+ if(mouseX < guiLeft+320) {
+ leftHovered = true;
+ } else {
+ rightHovered = true;
+ }
+ }
+ }
+ }
+ Minecraft.getMinecraft().getTextureManager().bindTexture(resource_packs);
+
+ if(currentInventoryIndex > 0) {
+ Utils.drawTexturedRect(guiLeft+320-12, staticSelectorHeight, 12, 16,
+ 29/256f, 53/256f, !leftHovered?0:32/256f, !leftHovered?32/256f:64/256f, GL11.GL_NEAREST);
+ }
+ if(currentInventoryIndex < inventories.length-1) {
+ Utils.drawTexturedRect(guiLeft+320, staticSelectorHeight, 12, 16,
+ 5/256f, 29/256f, !rightHovered?0:32/256f, !rightHovered?32/256f:64/256f, GL11.GL_NEAREST);
+ }
+
+ fontRendererObj.drawString(Utils.cleanColour(invNameToDisplayMap.get(selectedInventory).getDisplayName()), x+8, y+6, 4210752);
+
+ ItemStack stackToRender = null;
+ int overlay = new Color(0, 0, 0, 100).getRGB();
+ for(int yIndex=0; yIndex<inventory.length; yIndex++) {
+ if(inventory[yIndex] == null) continue;
+
+ for(int xIndex=0; xIndex<inventory[yIndex].length; xIndex++) {
+ ItemStack stack = inventory[yIndex][xIndex];
+
+ if(stack != null) Utils.drawItemStack(stack, x+8+xIndex*18, y+18+yIndex*18);
+
+ if(inventoryTextField.getText() != null && !inventoryTextField.getText().isEmpty() &&
+ (stack == null || !NotEnoughUpdates.INSTANCE.manager.doesStackMatchSearch(stack, inventoryTextField.getText()))) {
+ GlStateManager.translate(0, 0, 50);
+ drawRect(x+8+xIndex*18, y+18+yIndex*18, x+8+xIndex*18+16, y+18+yIndex*18+16, overlay);
+ GlStateManager.translate(0, 0, -50);
+ }
+
+ if(stack == null || stack == fillerStack) continue;
+
+ if(mouseX >= x+8+xIndex*18 && mouseX <= x+8+xIndex*18+16) {
+ if(mouseY >= y+18+yIndex*18 && mouseY <= y+18+yIndex*18+16) {
+ stackToRender = stack;
+ }
+ }
+ }
+ }
+ if(stackToRender != null) {
+ tooltipToDisplay = stackToRender.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
+
+ }
+
+ private String niceUuid(String uuidStr) {
+ if(uuidStr.length()!=32) return uuidStr;
+
+ StringBuilder niceAucId = new StringBuilder();
+ niceAucId.append(uuidStr, 0, 8);
+ niceAucId.append("-");
+ niceAucId.append(uuidStr, 8, 12);
+ niceAucId.append("-");
+ niceAucId.append(uuidStr, 12, 16);
+ niceAucId.append("-");
+ niceAucId.append(uuidStr, 16, 20);
+ niceAucId.append("-");
+ niceAucId.append(uuidStr, 20, 32);
+ return niceAucId.toString();
+ }
+
+ public EntityOtherPlayerMP getEntityPlayer() {
+ return entityPlayer;
+ }
+
+ private EntityOtherPlayerMP entityPlayer = null;
+ private ResourceLocation playerLocationSkin = null;
+ private ResourceLocation playerLocationCape = null;
+ private String skinType = null;
+
+ private HashMap<String, ResourceLocation[]> panoramasMap = new HashMap<>();
+
+ public ResourceLocation[] getPanoramasForLocation(String location, String identifier) {
+ if(panoramasMap.containsKey(location+identifier)) return panoramasMap.get(location+identifier);
+ try {
+ ResourceLocation[] panoramasArray = new ResourceLocation[6];
+ for(int i=0; i<6; i++) {
+ panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/"+location+"_"+identifier+"/panorama_"+i+".jpg");
+ Minecraft.getMinecraft().getResourceManager().getResource(panoramasArray[i]);
+ }
+ panoramasMap.put(location+identifier, panoramasArray);
+ return panoramasArray;
+ } catch(IOException e) {
+ try {
+ ResourceLocation[] panoramasArray = new ResourceLocation[6];
+ for(int i=0; i<6; i++) {
+ panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/"+location+"/panorama_"+i+".jpg");
+ Minecraft.getMinecraft().getResourceManager().getResource(panoramasArray[i]);
+ }
+ panoramasMap.put(location+identifier, panoramasArray);
+ return panoramasArray;
+ } catch(IOException e2) {
+ ResourceLocation[] panoramasArray = new ResourceLocation[6];
+ for(int i=0; i<6; i++) {
+ panoramasArray[i] = new ResourceLocation("notenoughupdates:panoramas/unknown/panorama_"+i+".jpg");
+ }
+ panoramasMap.put(location+identifier, panoramasArray);
+ return panoramasArray;
+ }
+ }
+ }
+
+ private TreeMap<Integer, Set<String>> topKills = null;
+ private TreeMap<Integer, Set<String>> topDeaths = null;
+
+ private void drawExtraPage(int mouseX, int mouseY, float partialTicks) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_extra);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+
+ JsonObject profileInfo = profile.getProfileInformation(profileId);
+ if(profileInfo == null) return;
+ JsonObject skillInfo = profile.getSkillInfo(profileId);
+
+ float xStart = 22;
+ float xOffset = 103;
+ float yStartTop = 27;
+ float yStartBottom = 109;
+ float yOffset = 10;
+
+ float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0);
+ float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
+
+ Utils.renderAlignedString(EnumChatFormatting.GOLD+"Bank Balance", EnumChatFormatting.WHITE.toString()+shortNumberFormat(bankBalance, 0),
+ guiLeft+xStart, guiTop+yStartTop, 76);
+ Utils.renderAlignedString(EnumChatFormatting.GOLD+"Purse", EnumChatFormatting.WHITE.toString()+shortNumberFormat(purseBalance, 0),
+ guiLeft+xStart, guiTop+yStartTop+yOffset, 76);
+
+
+ float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_souls_collected"), 0);
+
+ int fairySoulMax = 227;
+ if(Constants.FAIRYSOULS != null && Constants.FAIRYSOULS.has("Max Souls")) {
+ fairySoulMax = Constants.FAIRYSOULS.get("Max Souls").getAsInt();
+ }
+ Utils.renderAlignedString(EnumChatFormatting.LIGHT_PURPLE+"Fairy Souls", EnumChatFormatting.WHITE.toString()+(int)fairySouls+"/"+fairySoulMax,
+ guiLeft+xStart, guiTop+yStartBottom, 76);
+ if(skillInfo != null) {
+ float totalSkillLVL = 0;
+ float totalTrueSkillLVL = 0;
+ float totalSlayerLVL = 0;
+ float totalSkillCount = 0;
+ float totalSlayerCount = 0;
+
+ for(Map.Entry<String, JsonElement> entry : skillInfo.entrySet()) {
+ if(entry.getKey().startsWith("level_skill")) {
+ if(entry.getKey().contains("runecrafting")) continue;
+ if(entry.getKey().contains("carpentry")) continue;
+ if(entry.getKey().contains("catacombs")) continue;
+
+ totalSkillLVL += entry.getValue().getAsFloat();
+ totalTrueSkillLVL += Math.floor(entry.getValue().getAsFloat());
+ totalSkillCount++;
+ } else if(entry.getKey().startsWith("level_slayer")) {
+ totalSlayerLVL += entry.getValue().getAsFloat();
+ totalSlayerCount++;
+ }
+ }
+
+ float avgSkillLVL = totalSkillLVL/totalSkillCount;
+ float avgTrueSkillLVL = totalTrueSkillLVL/totalSkillCount;
+ float avgSlayerLVL = totalSlayerLVL/totalSlayerCount;
+
+ Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSkillLVL*10)/10,
+ guiLeft+xStart, guiTop+yStartBottom+yOffset, 76);
+ Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10,
+ guiLeft+xStart, guiTop+yStartBottom+yOffset*2, 76);
+ Utils.renderAlignedString(EnumChatFormatting.RED+"True AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgTrueSkillLVL*10)/10,
+ guiLeft+xStart, guiTop+yStartBottom+yOffset*3, 76);
+ }
+
+
+ float auctions_bids = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_bids"), 0);
+ float auctions_highest_bid = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_highest_bid"), 0);
+ float auctions_won = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_won"), 0);
+ float auctions_created = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_created"), 0);
+ float auctions_gold_spent = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_gold_spent"), 0);
+ float auctions_gold_earned = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_gold_earned"), 0);
+
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auction Bids", EnumChatFormatting.WHITE.toString()+(int)auctions_bids,
+ guiLeft+xStart+xOffset, guiTop+yStartTop, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Highest Bid", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_highest_bid, 0),
+ guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Won", EnumChatFormatting.WHITE.toString()+(int)auctions_won,
+ guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*2, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Created", EnumChatFormatting.WHITE.toString()+(int)auctions_created,
+ guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*3, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Spent", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_spent, 0),
+ guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*4, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Earned", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_earned, 0),
+ guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*5, 76);
+
+
+ //Slayer values
+ float zombie_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.boss_kills_tier_2"), 0);
+ float zombie_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.boss_kills_tier_3"), 0);
+ float zombie_boss_kills_tier_4 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.boss_kills_tier_4"), 0);
+ float wolf_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.boss_kills_tier_2"), 0);
+ float wolf_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.boss_kills_tier_3"), 0);
+ float spider_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.boss_kills_tier_2"), 0);
+ float spider_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.boss_kills_tier_3"), 0);
+ float enderman_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.enderman.boss_kills_tier_2"), 0);
+ float enderman_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.enderman.boss_kills_tier_3"), 0);
+
+
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T3", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_2,
+ guiLeft+xStart+xOffset, guiTop+yStartBottom, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T4", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_3,
+ guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T5", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_4,
+ guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*2, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T3", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_2,
+ guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*3, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T4", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_3,
+ guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*4, 76);
+
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T3", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_2,
+ guiLeft+xStart+xOffset*2, guiTop+yStartBottom+yOffset*0, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T4", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_3,
+ guiLeft+xStart+xOffset*2, guiTop+yStartBottom+yOffset*1, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Voidgloom Seraph T3", EnumChatFormatting.WHITE.toString()+(int)enderman_boss_kills_tier_2,
+ guiLeft+xStart+xOffset*2, guiTop+yStartBottom+yOffset*2, 76);
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Voidgloom Seraph T4", EnumChatFormatting.WHITE.toString()+(int)enderman_boss_kills_tier_3,
+ guiLeft+xStart+xOffset*2, guiTop+yStartBottom+yOffset*3, 76);
+
+ float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.pet_milestone_ores_mined"), 0);
+ float pet_milestone_sea_creatures_killed = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.pet_milestone_sea_creatures_killed"), 0);
+
+ float items_fished = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished"), 0);
+ float items_fished_treasure = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished_treasure"), 0);
+ float items_fished_large_treasure = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished_large_treasure"), 0);
+
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Ores Mined", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_ores_mined,
+ guiLeft+xStart+xOffset*2, guiTop+yStartTop, 76);
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Sea Creatures Killed", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_sea_creatures_killed,
+ guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset, 76);
+
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Items Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished,
+ guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*3, 76);
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Treasures Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished_treasure,
+ guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*4, 76);
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Large Treasures", EnumChatFormatting.WHITE.toString()+(int)items_fished_large_treasure,
+ guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*5, 76);
+
+ if(topKills == null) {
+ topKills = new TreeMap<>();
+ JsonObject stats = profileInfo.get("stats").getAsJsonObject();
+ for(Map.Entry<String, JsonElement> entry : stats.entrySet()) {
+ if(entry.getKey().startsWith("kills_")) {
+ if(entry.getValue().isJsonPrimitive()) {
+ JsonPrimitive prim = (JsonPrimitive) entry.getValue();
+ if(prim.isNumber()) {
+ String name = WordUtils.capitalizeFully(entry.getKey().substring("kills_".length()).replace("_", " "));
+ Set<String> kills = topKills.computeIfAbsent(prim.getAsInt(), k->new HashSet<>());
+ kills.add(name);
+ }
+ }
+ }
+ }
+ }
+ if(topDeaths == null) {
+ topDeaths = new TreeMap<>();
+ JsonObject stats = profileInfo.get("stats").getAsJsonObject();
+ for(Map.Entry<String, JsonElement> entry : stats.entrySet()) {
+ if(entry.getKey().startsWith("deaths_")) {
+ if(entry.getValue().isJsonPrimitive()) {
+ JsonPrimitive prim = (JsonPrimitive) entry.getValue();
+ if(prim.isNumber()) {
+ String name = WordUtils.capitalizeFully(entry.getKey().substring("deaths_".length()).replace("_", " "));
+ Set<String> deaths = topDeaths.computeIfAbsent(prim.getAsInt(), k->new HashSet<>());
+ deaths.add(name);
+ }
+ }
+ }
+ }
+ }
+
+ int index = 0;
+ for(int killCount : topKills.descendingKeySet()) {
+ if(index >= 6) break;
+ Set<String> kills = topKills.get(killCount);
+ for(String killType : kills) {
+ if(index >= 6) break;
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+killType+" Kills", EnumChatFormatting.WHITE.toString()+killCount,
+ guiLeft+xStart+xOffset*3, guiTop+yStartTop+yOffset*index, 76);
+ index++;
+ }
+ }
+ index = 0;
+ for(int deathCount : topDeaths.descendingKeySet()) {
+ if(index >= 6) break;
+ Set<String> deaths = topDeaths.get(deathCount);
+ for(String deathType : deaths) {
+ if(index >= 6) break;
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Deaths: "+ deathType, EnumChatFormatting.WHITE.toString()+deathCount,
+ guiLeft+xStart+xOffset*3, guiTop+yStartBottom+yOffset*index, 76);
+ index++;
+ }
+ }
+ }
+
+ private int backgroundClickedX = -1;
+
+ private static char[] c = new char[]{'k', 'm', 'b', 't'};
+
+ public static String shortNumberFormat(double n, int iteration) {
+ if(n < 1000) {
+ if(n % 1 == 0) {
+ return Integer.toString((int)n);
+ } else {
+ return String.format("%.2f", n);
+ }
+ }
+
+ double d = ((long) n / 100) / 10.0;
+ boolean isRound = (d * 10) %10 == 0;
+ return (d < 1000?
+ ((d > 99.9 || isRound || (!isRound && d > 9.99)?
+ (int) d * 10 / 10 : d + ""
+ ) + "" + c[iteration])
+ : shortNumberFormat(d, iteration+1));
+ }
+
+ private boolean loadingProfile = false;
+ private static final ExecutorService profileLoader = Executors.newFixedThreadPool(1);
+
+ private void drawBasicPage(int mouseX, int mouseY, float partialTicks) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+
+ String location = null;
+ JsonObject status = profile.getPlayerStatus();
+ if(status != null && status.has("mode")) {
+ location = status.get("mode").getAsString();
+ }
+
+ int extraRotation = 0;
+ if(Mouse.isButtonDown(0) || Mouse.isButtonDown(1)) {
+ if(backgroundClickedX == -1) {
+ if(mouseX > guiLeft+23 && mouseX < guiLeft+23+81) {
+ if(mouseY > guiTop+44 && mouseY < guiTop+44+108) {
+ backgroundClickedX = mouseX;
+ }
+ }
+ }
+ } else {
+ if(backgroundClickedX != -1) {
+ backgroundRotation += mouseX - backgroundClickedX;
+ backgroundClickedX = -1;
+ }
+ }
+ if(backgroundClickedX == -1) {
+ backgroundRotation += (currentTime - lastTime)/400f;
+ } else {
+ extraRotation = mouseX - backgroundClickedX;
+ }
+ backgroundRotation %= 360;
+
+ String panoramaIdentifier = "day";
+ if(SBInfo.getInstance().currentTimeDate != null) {
+ if(SBInfo.getInstance().currentTimeDate.getHours() <= 6 ||
+ SBInfo.getInstance().currentTimeDate.getHours() >= 20) {
+ panoramaIdentifier = "night";
+ }
+ }
+
+ Panorama.drawPanorama(-backgroundRotation-extraRotation, guiLeft+23, guiTop+44, 81, 108, 0.37f, 0.8f,
+ getPanoramasForLocation(location==null?"unknown":location, panoramaIdentifier));
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_basic);
+ Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
+
+ if(entityPlayer != null && profile.getHypixelProfile() != null) {
+ String playerName = null;
+ if(profile.getHypixelProfile().has("prefix")) {
+ playerName = Utils.getElementAsString(profile.getHypixelProfile().get("prefix"), "") + " " + entityPlayer.getName();
+ } else {
+ String rank = Utils.getElementAsString(profile.getHypixelProfile().get("rank"),
+ Utils.getElementAsString(profile.getHypixelProfile().get("newPackageRank"), "NONE"));;
+ String monthlyPackageRank = Utils.getElementAsString(profile.getHypixelProfile().get("monthlyPackageRank"), "NONE");
+ if(!rank.equals("YOUTUBER") && !monthlyPackageRank.equals("NONE")) {
+ rank = monthlyPackageRank;
+ }
+ EnumChatFormatting rankPlusColorECF = EnumChatFormatting.getValueByName(Utils.getElementAsString(profile.getHypixelProfile().get("rankPlusColor"),
+ "GOLD"));
+ String rankPlusColor = EnumChatFormatting.GOLD.toString();
+ if(rankPlusColorECF != null) {
+ rankPlusColor = rankPlusColorECF.toString();
+ }
+
+ JsonObject misc = Constants.MISC;
+ if(misc != null) {
+ if(misc.has("ranks")) {
+ String rankName = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".tag"), null);
+ String rankColor = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".color"), "7");
+ String rankPlus = Utils.getElementAsString(Utils.getElement(misc, "ranks."+rank+".plus"), "");
+
+ String name = entityPlayer.getName();
+
+ if(misc.has("special_bois")) {
+ JsonArray special_bois = misc.get("special_bois").getAsJsonArray();
+ for(int i=0; i<special_bois.size(); i++) {
+ if(special_bois.get(i).getAsString().equals(profile.getUuid())) {
+ name = Utils.chromaString(name);
+ break;
+ }
+ }
+ }
+
+ playerName = EnumChatFormatting.GRAY.toString() + name;
+ if(rankName != null) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("\u00A7"+rankColor);
+ sb.append("[");
+ sb.append(rankName);
+ sb.append(rankPlusColor);
+ sb.append(rankPlus);
+ sb.append("\u00A7"+rankColor);
+ sb.append("] ");
+ sb.append(name);
+ playerName = sb.toString();
+ }
+ }
+ }
+
+ }
+ if(playerName != null) {
+ int rankPrefixLen = fr.getStringWidth(playerName);
+ int halfRankPrefixLen = rankPrefixLen/2;
+
+ int x = guiLeft+63;
+ int y = guiTop+54;
+
+ drawRect(x-halfRankPrefixLen-1, y-1, x+halfRankPrefixLen+1, y+8, new Color(0, 0, 0, 64).getRGB());
+
+ fr.drawString(playerName, x-halfRankPrefixLen, y, 0, true);
+ }
+ }
+
+ long networth = profile.getNetWorth(profileId);
+ if(networth > 0) {
+ Utils.drawStringCentered(EnumChatFormatting.GREEN+"Net Worth: "+EnumChatFormatting.GOLD+numberFormat.format(networth), fr, guiLeft+63, guiTop+38, true, 0);
+ try {
+ double networthInCookies = (networth / NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE").get("avg_buy").getAsDouble());
+ String networthIRLMoney = Long.toString(Math.round(((networthInCookies * 325) / 675) * 4.99));
+
+ if(mouseX > guiLeft+8 && mouseX < guiLeft+8+fontRendererObj.getStringWidth("Net Worth: " + numberFormat.format(networth))) {
+ if(mouseY > guiTop+32 && mouseY < guiTop+32+fontRendererObj.FONT_HEIGHT) {
+ tooltipToDisplay = new ArrayList<>();
+ tooltipToDisplay.add(EnumChatFormatting.GREEN+"Net worth in IRL money: "+EnumChatFormatting.DARK_GREEN+"$" +EnumChatFormatting.GOLD+networthIRLMoney);
+ tooltipToDisplay.add("");
+ if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ tooltipToDisplay.add(EnumChatFormatting.RED+"This is calculated using the current");
+ tooltipToDisplay.add(EnumChatFormatting.RED+"price of booster cookies on bazaar and the price");
+ tooltipToDisplay.add(EnumChatFormatting.RED+"for cookies using gems, then the price of gems");
+ tooltipToDisplay.add(EnumChatFormatting.RED+"is where we get the amount of IRL money you" );
+ tooltipToDisplay.add(EnumChatFormatting.RED+"theoretically have on skyblock in net worth.");
+ } else {
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"[SHIFT for Info]");
+ }
+ tooltipToDisplay.add("");
+ tooltipToDisplay.add(EnumChatFormatting.RED+"THIS IS IN NO WAY ENDORSING IRL TRADING!");
+
+ }
+ }
+ } catch(Exception e){}
+ }
+
+ if(status != null) {
+ JsonElement onlineElement = Utils.getElement(status, "online");
+ boolean online = onlineElement != null && onlineElement.isJsonPrimitive() && onlineElement.getAsBoolean();
+ String statusStr = online ? EnumChatFormatting.GREEN + "ONLINE" : EnumChatFormatting.RED + "OFFLINE";
+ String locationStr = null;
+ if(profile.getUuid().equals("20934ef9488c465180a78f861586b4cf")) {
+ locationStr = "Ignoring DMs";
+ } else {
+ if(location != null) {
+ JsonObject misc = Constants.MISC;
+ if(misc != null) {
+ locationStr = Utils.getElementAsString(Utils.getElement(misc, "area_names."+location), "Unknown");
+ }
+ }
+ }
+ if(locationStr != null) {
+ statusStr += EnumChatFormatting.GRAY+" - "+EnumChatFormatting.GREEN+locationStr;
+ }
+
+ Utils.drawStringCentered(statusStr, fr, guiLeft+63, guiTop+160, true, 0);
+ }
+
+ if(entityPlayer == null) {
+ if(!loadingProfile || ((ThreadPoolExecutor)profileLoader).getActiveCount() == 0) {
+ loadingProfile = true;
+ UUID playerUUID = UUID.fromString(niceUuid(profile.getUuid()));
+
+ profileLoader.submit(() -> {
+ GameProfile fakeProfile = Minecraft.getMinecraft().getSessionService().fillProfileProperties(new GameProfile(playerUUID, "CoolGuy123"), false);
+ entityPlayer = new EntityOtherPlayerMP(Minecraft.getMinecraft().theWorld, fakeProfile) {
+ public ResourceLocation getLocationSkin() {
+ return playerLocationSkin == null ? DefaultPlayerSkin.getDefaultSkin(this.getUniqueID()) : playerLocationSkin;
+ }
+
+ public ResourceLocation getLocationCape() {
+ return playerLocationCape;
+ }
+
+ public String getSkinType() {
+ return skinType == null ? DefaultPlayerSkin.getSkinType(this.getUniqueID()) : skinType;
+ }
+ };
+ entityPlayer.setAlwaysRenderNameTag(false);
+ entityPlayer.setCustomNameTag("");
+ });
+ }
+ } else {
+ entityPlayer.refreshDisplayName();
+ byte b = 0;
+ for(EnumPlayerModelParts part : EnumPlayerModelParts.values()) {
+ b |= part.getPartMask();
+ }
+ entityPlayer.getDataWatcher().updateObject(10, b);
+ }
+
+ JsonObject profileInfo = profile.getProfileInformation(profileId);
+ if(profileInfo == null) return;
+
+ JsonObject skillInfo = profile.getSkillInfo(profileId);
+ JsonObject inventoryInfo = profile.getInventoryInfo(profileId);
+
+ if(entityPlayer != null) {
+ if(backgroundClickedX != -1 && Mouse.isButtonDown(1)) {
+ Arrays.fill(entityPlayer.inventory.armorInventory, null);
+ } else {
+ if(inventoryInfo != null && inventoryInfo.has("inv_armor")) {
+ JsonArray items = inventoryInfo.get("inv_armor").getAsJsonArray();
+ if(items != null && items.size() == 4) {
+ for(int i=0; i<entityPlayer.inventory.armorInventory.length; i++) {
+ JsonElement itemElement = items.get(i);
+ if(itemElement != null && itemElement.isJsonObject()) {
+ entityPlayer.inventory.armorInventory[i] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(itemElement.getAsJsonObject(), false);
+ }
+ }
+ }
+ } else {
+ Arrays.fill(entityPlayer.inventory.armorInventory, null);
+ }
+ }
+ if(entityPlayer.getUniqueID().toString().equals("ae6193ab-494a-4719-b6e7-d50392c8f012")) {
+ entityPlayer.inventory.armorInventory[3] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(
+ NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SMALL_BACKPACK"));
+ }
+ }
+
+ if(entityPlayer != null && playerLocationSkin == null) {
+ try {
+ Minecraft.getMinecraft().getSkinManager().loadProfileTextures(entityPlayer.getGameProfile(), new SkinManager.SkinAvailableCallback() {
+ public void skinAvailable(MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
+ switch (type) {
+ case SKIN:
+ playerLocationSkin = location;
+ skinType = profileTexture.getMetadata("model");
+
+ if(skinType == null) {
+ skinType = "default";
+ }
+
+ break;
+ case CAPE:
+ playerLocationCape = location;
+ }
+ }
+ }, false);
+ } catch(Exception e){}
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ JsonObject petsInfo = profile.getPetsInfo(profileId);
+ if(petsInfo != null) {
+ JsonElement activePetElement = petsInfo.get("active_pet");
+ if(activePetElement != null && activePetElement.isJsonObject()) {
+ JsonObject activePet = activePetElement.getAsJsonObject();
+
+ String type = activePet.get("type").getAsString();
+
+ for(int i=0; i<4; i++) {
+ JsonObject item = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(type+";"+i);
+ if(item != null) {
+ int x = guiLeft+50;
+ float y = guiTop+82+15*(float)Math.sin(((currentTime-startTime)/800f)%(2*Math.PI));
+ GlStateManager.translate(x, y, 0);
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, false);
+
+ //Remove extra attributes so no CIT
+ NBTTagCompound stackTag = stack.getTagCompound()==null?new NBTTagCompound():stack.getTagCompound();
+ stackTag.removeTag("ExtraAttributes");
+ stack.setTagCompound(stackTag);
+
+ GlStateManager.scale(-1.5f, 1.5f, 1);
+ GlStateManager.enableDepth();
+ Utils.drawItemStack(stack, 0, 0);
+ GlStateManager.scale(-1/1.5f, 1/1.5f, 1);
+ GlStateManager.translate(-x, -y, 0);
+ break;
+ }
+ }
+ }
+ }
+ if(entityPlayer != null) {
+ drawEntityOnScreen(guiLeft+63, guiTop+128+7, 36, guiLeft+63-mouseX, guiTop+129-mouseY, entityPlayer);
+ }
+
+ PlayerStats.Stats stats = profile.getStats(profileId);
+
+ if(stats != null) {
+ Splitter splitter = Splitter.on(" ").omitEmptyStrings().limit(2);
+ for(int i=0; i<PlayerStats.defaultStatNames.length; i++) {
+ String statName = PlayerStats.defaultStatNames[i];
+ String statNamePretty = PlayerStats.defaultStatNamesPretty[i];
+
+ int val = Math.round(stats.get(statName));
+
+ GlStateManager.color(1, 1, 1, 1);
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ Utils.renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString()+val, guiLeft+132, guiTop+27+11f*i, 80);
+
+ if(mouseX > guiLeft+132 && mouseX < guiLeft+212) {
+ if(mouseY > guiTop+27+11f*i && mouseY < guiTop+37+11f*i) {
+ List<String> split = splitter.splitToList(statNamePretty);
+ PlayerStats.Stats baseStats = PlayerStats.getBaseStats();
+ tooltipToDisplay = new ArrayList<>();
+ tooltipToDisplay.add(statNamePretty);
+ int base = Math.round(baseStats.get(statName));
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Base "+split.get(1)+": "+EnumChatFormatting.GREEN+base+" "+split.get(0));
+ int passive = Math.round(profile.getPassiveStats(profileId).get(statName)-baseStats.get(statName));
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Passive "+split.get(1)+" Bonus: +"+EnumChatFormatting.YELLOW+passive+" "+split.get(0));
+ int itemBonus = Math.round(stats.get(statName)-profile.getPassiveStats(profileId).get(statName));
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Item "+split.get(1)+" Bonus: +"+EnumChatFormatting.DARK_PURPLE+itemBonus+" "+split.get(0));
+ int finalStat = Math.round(stats.get(statName));
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Final "+split.get(1)+": +"+EnumChatFormatting.RED+finalStat+" "+split.get(0));
+ }
+ }
+ }
+ } else {
+ Utils.drawStringCentered(EnumChatFormatting.RED+"Skill/Inv/Coll", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+172, guiTop+101-10, true, 0);
+ Utils.drawStringCentered(EnumChatFormatting.RED+"APIs not", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+172, guiTop+101, true, 0);
+ Utils.drawStringCentered(EnumChatFormatting.RED+"enabled!", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+172, guiTop+101+10, true, 0);
+ }
+
+ if(skillInfo != null) {
+ int position = 0;
+ for(Map.Entry<String, ItemStack> entry : ProfileViewer.getSkillToSkillDisplayMap().entrySet()) {
+ if(entry.getValue() == null || entry.getKey() == null) {
+ position++;
+ continue;
+ }
+
+ int yPosition = position % 7;
+ int xPosition = position / 7;
+
+ String skillName = entry.getValue().getDisplayName();
+
+ float level = Utils.getElementAsFloat(skillInfo.get("level_"+entry.getKey()), 0);
+ int levelFloored = (int)Math.floor(level);
+
+ int x = guiLeft+237+86*xPosition;
+ int y = guiTop+31+21*yPosition;
+
+ Utils.renderAlignedString(skillName, EnumChatFormatting.WHITE.toString()+levelFloored, x+14, y-4, 60);
+
+ if(skillInfo.get("maxed_"+entry.getKey()).getAsBoolean()) {
+ renderGoldBar(x, y+6, 80);
+ } else {
+ renderBar(x, y+6, 80, level%1);
+ }
+
+ if(mouseX > x && mouseX < x+80) {
+ if(mouseY > y-4 && mouseY < y+13) {
+ tooltipToDisplay = new ArrayList<>();
+ tooltipToDisplay.add(skillName);
+ if(skillInfo.get("maxed_"+entry.getKey()).getAsBoolean()) {
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Progress: "+EnumChatFormatting.GOLD+"MAXED!");
+ } else {
+ int maxXp = (int)skillInfo.get("maxxp_"+entry.getKey()).getAsFloat();
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Progress: "+EnumChatFormatting.DARK_PURPLE.toString() +
+ shortNumberFormat(Math.round((level%1)*maxXp), 0) + "/" + shortNumberFormat(maxXp, 0));
+ }
+ String totalXpS = NumberFormat.getIntegerInstance().format((int)skillInfo.get("experience_"+entry.getKey()).getAsFloat());
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Total XP: " +
+ EnumChatFormatting.DARK_PURPLE+totalXpS);
+ }
+ }
+
+ GL11.glTranslatef((x), (y-6f), 0);
+ GL11.glScalef(0.7f, 0.7f, 1);
+ Utils.drawItemStackLinear(entry.getValue(), 0, 0);
+ GL11.glScalef(1/0.7f, 1/0.7f, 1);
+ GL11.glTranslatef(-(x), -(y-6f), 0);
+
+ position++;
+ }
+ } else {
+ Utils.drawStringCentered(EnumChatFormatting.RED+"Skills API not enabled!", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+322, guiTop+101, true, 0);
+ }
+ }
+
+ private void renderGoldBar(float x, float y, float xSize) {
+ if(!OpenGlHelper.areShadersSupported()) {
+ renderBar(x, y, xSize, 1);
+ return;
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(icons);
+ ShaderManager shaderManager = ShaderManager.getInstance();
+ shaderManager.loadShader("make_gold");
+ shaderManager.loadData("make_gold", "amount", (startTime-System.currentTimeMillis())/10000f);
+
+ Utils.drawTexturedRect(x, y, xSize/2f, 5, 0/256f, (xSize/2f)/256f, 79/256f, 84/256f, GL11.GL_NEAREST);
+ Utils.drawTexturedRect(x+xSize/2f, y, xSize/2f, 5, (182-xSize/2f)/256f, 182/256f, 79/256f, 84/256f, GL11.GL_NEAREST);
+
+ GL20.glUseProgram(0);
+ }
+
+ private void renderBar(float x, float y, float xSize, float completed) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(icons);
+
+ completed = Math.round(completed/0.05f)*0.05f;
+
+ float notcompleted = 1-completed;
+
+ int displayNum = 0;//tl.x%5;
+
+ GlStateManager.color(1, 1, 1, 1);
+ float width = 0;
+
+ if(completed < 0.5f && (displayNum == 1 || displayNum == 0)) {
+ width = (0.5f - completed) * xSize;
+ Utils.drawTexturedRect(x+xSize*completed, y, width, 5, xSize*completed/256f, (xSize/2f)/256f, 74/256f, 79/256f, GL11.GL_NEAREST);
+ }
+ if(completed < 1f && (displayNum == 2 || displayNum == 0)) {
+ width = Math.min(xSize*notcompleted, xSize/2f);
+ Utils.drawTexturedRect(x+(xSize/2f)+Math.max(xSize*(completed-0.5f), 0), y, width, 5,
+ (182-(xSize/2f)+Math.max(xSize*(completed-0.5f), 0))/256f, 182/256f, 74/256f, 79/256f, GL11.GL_NEAREST);
+ }
+
+ if(completed > 0f && (displayNum == 3 || displayNum == 0)) {
+ width = Math.min(xSize*completed, xSize/2f);
+ Utils.drawTexturedRect(x, y, width, 5,
+ 0/256f, width/256f, 79/256f, 84/256f, GL11.GL_NEAREST);
+ }
+ if(completed > 0.5f && (displayNum == 4 || displayNum == 0)) {
+ width = Math.min(xSize*(completed-0.5f), xSize/2f);
+ Utils.drawTexturedRect(x+(xSize/2f), y, width, 5,
+ (182-(xSize/2f))/256f, (182-(xSize/2f)+width)/256f, 79/256f, 84/256f, GL11.GL_NEAREST);
+ }
+ }
+
+ private static final ResourceLocation shadowTextures = new ResourceLocation("textures/misc/shadow.png");
+ public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) {
+ GlStateManager.enableColorMaterial();
+ GlStateManager.pushMatrix();
+ GlStateManager.translate((float)posX, (float)posY, 50.0F);
+ GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
+ GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
+ float renderYawOffset = ent.renderYawOffset;
+ float f1 = ent.rotationYaw;
+ float f2 = ent.rotationPitch;
+ float f3 = ent.prevRotationYawHead;
+ float f4 = ent.rotationYawHead;
+ GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
+ RenderHelper.enableStandardItemLighting();
+ GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
+ GlStateManager.rotate(25, 1.0F, 0.0F, 0.0F);
+ ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
+ ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
+ ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
+ ent.rotationYawHead = ent.rotationYaw;
+ ent.prevRotationYawHead = ent.rotationYaw;
+ RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
+ rendermanager.setPlayerViewY(180.0F);
+ rendermanager.setRenderShadow(false);
+ rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
+
+ /*{
+ GlStateManager.enableBlend();
+ GlStateManager.blendFunc(770, 771);
+ rendermanager.renderEngine.bindTexture(shadowTextures);
+ GlStateManager.depthMask(false);
+ float f = 0.5f;
+
+ if (ent instanceof EntityLiving) {
+ EntityLiving entityliving = (EntityLiving)ent;
+ f *= entityliving.getRenderSizeModifier();
+
+ if (entityliving.isChild())
+ {
+ f *= 0.5F;
+ }
+ }
+
+ /*Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+
+ GlStateManager.color(1, 1, 1, 0.5f);
+ Utils.drawTexturedRect(-0.5f*tl.x, -0.5f*tl.x, 1*tl.x, 1*tl.x);
+
+ /*for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) {
+ Block block = world.getBlockState(blockpos.down()).getBlock();
+
+ if (block.getRenderType() != -1 && world.getLightFromNeighbors(blockpos) > 3) {
+ this.func_180549_a(block, x, y, z, blockpos, shadowAlpha, f, d2, d3, d4);
+ }
+ }
+
+ GlStateManager.disableBlend();
+ GlStateManager.depthMask(true);
+ }*/
+
+ ent.renderYawOffset = renderYawOffset;
+ ent.rotationYaw = f1;
+ ent.rotationPitch = f2;
+ ent.prevRotationYawHead = f3;
+ ent.rotationYawHead = f4;
+ GlStateManager.popMatrix();
+ RenderHelper.disableStandardItemLighting();
+ GlStateManager.disableRescaleNormal();
+ GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
+ GlStateManager.disableTexture2D();
+ GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
+ }
+
+ public void resetCache() {
+ bestWeapons = null;
+ bestRods = null;
+ armorItems = null;
+ inventoryItems = new HashMap<>();
+ currentInventoryIndex = 0;
+ arrowCount = -1;
+ greenCandyCount = -1;
+ purpleCandyCount = -1;
+ entityPlayer = null;
+ playerLocationSkin = null;
+ playerLocationCape = null;
+ skinType = null;
+ petsPage = 0;
+ sortedPets = null;
+ sortedPetsStack = null;
+ selectedPet = -1;
+ }
+
+ Shader blurShaderHorz = null;
+ Framebuffer blurOutputHorz = null;
+ Shader blurShaderVert = null;
+ Framebuffer blurOutputVert = null;
+
+ /**
+ * Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate
+ * space [-1 -> 1; 1 -> -1] (Note: flipped y-axis).
+ *
+ * This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to
+ * apply scales and translations manually.
+ */
+ private Matrix4f createProjectionMatrix(int width, int height) {
+ Matrix4f projMatrix = new Matrix4f();
+ projMatrix.setIdentity();
+ projMatrix.m00 = 2.0F / (float)width;
+ projMatrix.m11 = 2.0F / (float)(-height);
+ projMatrix.m22 = -0.0020001999F;
+ projMatrix.m33 = 1.0F;
+ projMatrix.m03 = -1.0F;
+ projMatrix.m13 = 1.0F;
+ projMatrix.m23 = -1.0001999F;
+ return projMatrix;
+ }
+
+ /**
+ * Renders whatever is currently in the Minecraft framebuffer to our two framebuffers, applying a horizontal
+ * and vertical blur separately in order to significantly save computation time.
+ * This is only possible if framebuffers are supported by the system, so this method will exit prematurely
+ * if framebuffers are not available. (Apple machines, for example, have poor framebuffer support).
+ */
+ private double lastBgBlurFactor = -1;
+ private void blurBackground() {
+ if(!OpenGlHelper.isFramebufferEnabled()) return;
+
+ int width = Minecraft.getMinecraft().displayWidth;
+ int height = Minecraft.getMinecraft().displayHeight;
+
+ if(blurOutputHorz == null) {
+ blurOutputHorz = new Framebuffer(width, height, false);
+ blurOutputHorz.setFramebufferFilter(GL11.GL_NEAREST);
+ }
+ if(blurOutputVert == null) {
+ blurOutputVert = new Framebuffer(width, height, false);
+ blurOutputVert.setFramebufferFilter(GL11.GL_NEAREST);
+ }
+ if(blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) {
+ blurOutputHorz.createBindFramebuffer(width, height);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+ if(blurOutputVert.framebufferWidth != width || blurOutputVert.framebufferHeight != height) {
+ blurOutputVert.createBindFramebuffer(width, height);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+
+ if(blurShaderHorz == null) {
+ try {
+ blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ Minecraft.getMinecraft().getFramebuffer(), blurOutputHorz);
+ blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
+ }
+ if(blurShaderVert == null) {
+ try {
+ blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ blurOutputHorz, blurOutputVert);
+ blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
+ }
+ if(blurShaderHorz != null && blurShaderVert != null) {
+ if(15 != lastBgBlurFactor) {
+ blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)15);
+ blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)15);
+ lastBgBlurFactor = 15;
+ }
+ GL11.glPushMatrix();
+ blurShaderHorz.loadShader(0);
+ blurShaderVert.loadShader(0);
+ GlStateManager.enableDepth();
+ GL11.glPopMatrix();
+
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+ }
+
+ /**
+ * Renders a subsection of the blurred framebuffer on to the corresponding section of the screen.
+ * Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight]
+ */
+ public void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) {
+ if(!OpenGlHelper.isFramebufferEnabled()) return;
+
+ float uMin = x/(float)width;
+ float uMax = (x+blurWidth)/(float)width;
+ float vMin = (height-y)/(float)height;
+ float vMax = (height-y-blurHeight)/(float)height;
+
+ blurOutputVert.bindFramebufferTexture();
+ GlStateManager.color(1f, 1f, 1f, 1f);
+ //Utils.setScreen(width*f, height*f, f);
+ Utils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax);
+ //Utils.setScreen(width, height, f);
+ blurOutputVert.unbindFramebufferTexture();
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index b2b19189..b4fce512 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -1,1117 +1,1229 @@ -package io.github.moulberry.notenoughupdates.profileviewer; - -import com.google.common.base.Splitter; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import io.github.moulberry.notenoughupdates.NEUManager; -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.util.Constants; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -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.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; - -import javax.annotation.Nullable; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Consumer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class ProfileViewer { - - private final NEUManager manager; - - public ProfileViewer(NEUManager manager) { - this.manager = manager; - } - - - private static HashMap<String, String> petRarityToNumMap = new HashMap<>(); - static { - petRarityToNumMap.put("COMMON", "0"); - petRarityToNumMap.put("UNCOMMON", "1"); - petRarityToNumMap.put("RARE", "2"); - petRarityToNumMap.put("EPIC", "3"); - petRarityToNumMap.put("LEGENDARY", "4"); - } - - private static final LinkedHashMap<String, ItemStack> skillToSkillDisplayMap = new LinkedHashMap<>(); - static { - skillToSkillDisplayMap.put("skill_taming", Utils.createItemStack(Items.spawn_egg, EnumChatFormatting.LIGHT_PURPLE+"Taming")); - skillToSkillDisplayMap.put("skill_mining", Utils.createItemStack(Items.stone_pickaxe, EnumChatFormatting.GRAY+"Mining")); - skillToSkillDisplayMap.put("skill_foraging", Utils.createItemStack(Item.getItemFromBlock(Blocks.sapling), EnumChatFormatting.DARK_GREEN+"Foraging")); - skillToSkillDisplayMap.put("skill_enchanting", Utils.createItemStack(Item.getItemFromBlock(Blocks.enchanting_table), EnumChatFormatting.GREEN+"Enchanting")); - skillToSkillDisplayMap.put("skill_carpentry", Utils.createItemStack(Item.getItemFromBlock(Blocks.crafting_table), EnumChatFormatting.DARK_RED+"Carpentry")); - skillToSkillDisplayMap.put("skill_farming", Utils.createItemStack(Items.golden_hoe, EnumChatFormatting.YELLOW+"Farming")); - skillToSkillDisplayMap.put("skill_combat", Utils.createItemStack(Items.stone_sword, EnumChatFormatting.RED+"Combat")); - skillToSkillDisplayMap.put("skill_fishing", Utils.createItemStack(Items.fishing_rod, EnumChatFormatting.AQUA+"Fishing")); - skillToSkillDisplayMap.put("skill_alchemy", Utils.createItemStack(Items.brewing_stand, EnumChatFormatting.BLUE+"Alchemy")); - skillToSkillDisplayMap.put("skill_runecrafting", Utils.createItemStack(Items.magma_cream, EnumChatFormatting.DARK_PURPLE+"Runecrafting")); - //skillToSkillDisplayMap.put("skill_catacombs", Utils.createItemStack(Item.getItemFromBlock(Blocks.deadbush), EnumChatFormatting.GOLD+"Catacombs")); - skillToSkillDisplayMap.put("slayer_zombie", Utils.createItemStack(Items.rotten_flesh, EnumChatFormatting.GOLD+"Rev Slayer")); - skillToSkillDisplayMap.put("slayer_spider", Utils.createItemStack(Items.spider_eye, EnumChatFormatting.GOLD+"Tara Slayer")); - skillToSkillDisplayMap.put("slayer_wolf", Utils.createItemStack(Items.bone, EnumChatFormatting.GOLD+"Sven Slayer")); - } - - private static final ItemStack CAT_FARMING = Utils.createItemStack(Items.golden_hoe, EnumChatFormatting.YELLOW+"Farming"); - private static final ItemStack CAT_MINING = Utils.createItemStack(Items.stone_pickaxe, EnumChatFormatting.GRAY+"Mining"); - private static final ItemStack CAT_COMBAT = Utils.createItemStack(Items.stone_sword, EnumChatFormatting.RED+"Combat"); - private static final ItemStack CAT_FORAGING = Utils.createItemStack(Item.getItemFromBlock(Blocks.sapling), EnumChatFormatting.DARK_GREEN+"Foraging"); - private static final ItemStack CAT_FISHING = Utils.createItemStack(Items.fishing_rod, EnumChatFormatting.AQUA+"Fishing"); - - private static final LinkedHashMap<ItemStack, List<String>> collectionCatToCollectionMap = new LinkedHashMap<>(); - static { - collectionCatToCollectionMap.put(CAT_FARMING, - Utils.createList("WHEAT", "CARROT_ITEM", "POTATO_ITEM", "PUMPKIN", "MELON", "SEEDS", "MUSHROOM_COLLECTION", - "INK_SACK:3", "CACTUS", "SUGAR_CANE", "FEATHER", "LEATHER", "PORK", "RAW_CHICKEN", "MUTTON", - "RABBIT", "NETHER_STALK")); - collectionCatToCollectionMap.put(CAT_MINING, - Utils.createList("COBBLESTONE", "COAL", "IRON_INGOT", "GOLD_INGOT", "DIAMOND", "INK_SACK:4", - "EMERALD", "REDSTONE", "QUARTZ", "OBSIDIAN", "GLOWSTONE_DUST", "GRAVEL", "ICE", "NETHERRACK", - "SAND", "ENDER_STONE")); - collectionCatToCollectionMap.put(CAT_COMBAT, - Utils.createList("ROTTEN_FLESH", "BONE", "STRING", "SPIDER_EYE", "SULPHUR", "ENDER_PEARL", - "GHAST_TEAR", "SLIME_BALL", "BLAZE_ROD", "MAGMA_CREAM")); - collectionCatToCollectionMap.put(CAT_FORAGING, - Utils.createList("LOG", "LOG:1", "LOG:2", "LOG_2:1", "LOG_2", "LOG:3")); - collectionCatToCollectionMap.put(CAT_FISHING, - Utils.createList("RAW_FISH", "RAW_FISH:1", "RAW_FISH:2", "RAW_FISH:3", "PRISMARINE_SHARD", - "PRISMARINE_CRYSTALS", "CLAY_BALL", "WATER_LILY", "INK_SACK", "SPONGE")); - } - - private static final LinkedHashMap<ItemStack, List<String>> collectionCatToMinionMap = new LinkedHashMap<>(); - static { - collectionCatToMinionMap.put(CAT_FARMING, - Utils.createList("WHEAT", "CARROT", "POTATO", "PUMPKIN", "MELON", null, "MUSHROOM", - "COCOA", "CACTUS", "SUGAR_CANE", "CHICKEN", "COW", "PIG", null, "SHEEP", - "RABBIT", "NETHER_WARTS")); - collectionCatToMinionMap.put(CAT_MINING, - Utils.createList("COBBLESTONE", "COAL", "IRON", "GOLD", "DIAMOND", "LAPIS", - "EMERALD", "REDSTONE", "QUARTZ", "OBSIDIAN", "GLOWSTONE", "GRAVEL", "ICE", null, - "SAND", "ENDER_STONE")); - collectionCatToMinionMap.put(CAT_COMBAT, - Utils.createList("ZOMBIE", "SKELETON", "SPIDER", "CAVESPIDER", "CREEPER", "ENDERMAN", - "GHAST", "SLIME", "BLAZE", "MAGMA_CUBE")); - collectionCatToMinionMap.put(CAT_FORAGING, - Utils.createList("OAK", "SPRUCE", "BIRCH", "DARK_OAK", "ACACIA", "JUNGLE")); - collectionCatToMinionMap.put(CAT_FISHING, - Utils.createList("FISHING", null, null, null, null, - null, "CLAY", null, null, null)); - } - - private static final LinkedHashMap<String, ItemStack> collectionToCollectionDisplayMap = new LinkedHashMap<>(); - static { - /** FARMING COLLECTIONS **/ - collectionToCollectionDisplayMap.put("WHEAT", Utils.createItemStack(Items.wheat, - EnumChatFormatting.YELLOW+"Wheat")); - collectionToCollectionDisplayMap.put("CARROT_ITEM", Utils.createItemStack(Items.carrot, - EnumChatFormatting.YELLOW+"Carrot")); - collectionToCollectionDisplayMap.put("POTATO_ITEM", Utils.createItemStack(Items.potato, - EnumChatFormatting.YELLOW+"Potato")); - collectionToCollectionDisplayMap.put("PUMPKIN", Utils.createItemStack(Item.getItemFromBlock(Blocks.pumpkin), - EnumChatFormatting.YELLOW+"Pumpkin")); - collectionToCollectionDisplayMap.put("MELON", Utils.createItemStack(Items.melon, - EnumChatFormatting.YELLOW+"Melon")); - collectionToCollectionDisplayMap.put("SEEDS", Utils.createItemStack(Items.wheat_seeds, - EnumChatFormatting.YELLOW+"Seeds")); - collectionToCollectionDisplayMap.put("MUSHROOM_COLLECTION", - Utils.createItemStack(Item.getItemFromBlock(Blocks.red_mushroom) - , EnumChatFormatting.YELLOW+"Mushroom")); - collectionToCollectionDisplayMap.put("INK_SACK:3", Utils.createItemStack(Items.dye, - EnumChatFormatting.YELLOW+"Cocoa Beans", 3)); - collectionToCollectionDisplayMap.put("CACTUS", Utils.createItemStack(Item.getItemFromBlock(Blocks.cactus), - EnumChatFormatting.YELLOW+"Cactus")); - collectionToCollectionDisplayMap.put("SUGAR_CANE", Utils.createItemStack(Items.reeds, - EnumChatFormatting.YELLOW+"Sugar Cane")); - collectionToCollectionDisplayMap.put("FEATHER", Utils.createItemStack(Items.feather, - EnumChatFormatting.YELLOW+"Feather")); - collectionToCollectionDisplayMap.put("LEATHER", Utils.createItemStack(Items.leather, - EnumChatFormatting.YELLOW+"Leather")); - collectionToCollectionDisplayMap.put("PORK", Utils.createItemStack(Items.porkchop, - EnumChatFormatting.YELLOW+"Porkchop")); - collectionToCollectionDisplayMap.put("RAW_CHICKEN", Utils.createItemStack(Items.chicken, - EnumChatFormatting.YELLOW+"Chicken")); - collectionToCollectionDisplayMap.put("MUTTON", Utils.createItemStack(Items.mutton, - EnumChatFormatting.YELLOW+"Mutton")); - collectionToCollectionDisplayMap.put("RABBIT", Utils.createItemStack(Items.rabbit, - EnumChatFormatting.YELLOW+"Rabbit")); - collectionToCollectionDisplayMap.put("NETHER_STALK", Utils.createItemStack(Items.nether_wart, - EnumChatFormatting.YELLOW+"Nether Wart")); - - /** MINING COLLECTIONS **/ - collectionToCollectionDisplayMap.put("COBBLESTONE", Utils.createItemStack(Item.getItemFromBlock(Blocks.cobblestone), - EnumChatFormatting.GRAY+"Cobblestone")); - collectionToCollectionDisplayMap.put("COAL", Utils.createItemStack(Items.coal, - EnumChatFormatting.GRAY+"Coal")); - collectionToCollectionDisplayMap.put("IRON_INGOT", Utils.createItemStack(Items.iron_ingot, - EnumChatFormatting.GRAY+"Iron Ingot")); - collectionToCollectionDisplayMap.put("GOLD_INGOT", Utils.createItemStack(Items.gold_ingot, - EnumChatFormatting.GRAY+"Gold Ingot")); - collectionToCollectionDisplayMap.put("DIAMOND", Utils.createItemStack(Items.diamond, - EnumChatFormatting.GRAY+"Diamond")); - collectionToCollectionDisplayMap.put("INK_SACK:4", Utils.createItemStack(Items.dye, - EnumChatFormatting.GRAY+"Lapis Lazuli", 4)); - collectionToCollectionDisplayMap.put("EMERALD", Utils.createItemStack(Items.emerald, - EnumChatFormatting.GRAY+"Emerald")); - collectionToCollectionDisplayMap.put("REDSTONE", Utils.createItemStack(Items.redstone, - EnumChatFormatting.GRAY+"Redstone")); - collectionToCollectionDisplayMap.put("QUARTZ", Utils.createItemStack(Items.quartz, - EnumChatFormatting.GRAY+"Nether Quartz")); - collectionToCollectionDisplayMap.put("OBSIDIAN", Utils.createItemStack(Item.getItemFromBlock(Blocks.obsidian), - EnumChatFormatting.GRAY+"Obsidian")); - collectionToCollectionDisplayMap.put("GLOWSTONE_DUST", Utils.createItemStack(Items.glowstone_dust, - EnumChatFormatting.GRAY+"Glowstone")); - collectionToCollectionDisplayMap.put("GRAVEL", Utils.createItemStack(Item.getItemFromBlock(Blocks.gravel), - EnumChatFormatting.GRAY+"Gravel")); - collectionToCollectionDisplayMap.put("ICE", Utils.createItemStack(Item.getItemFromBlock(Blocks.ice), - EnumChatFormatting.GRAY+"Ice")); - collectionToCollectionDisplayMap.put("NETHERRACK", Utils.createItemStack(Item.getItemFromBlock(Blocks.netherrack), - EnumChatFormatting.GRAY+"Netherrack")); - collectionToCollectionDisplayMap.put("SAND", Utils.createItemStack(Item.getItemFromBlock(Blocks.sand), - EnumChatFormatting.GRAY+"Sand")); - collectionToCollectionDisplayMap.put("ENDER_STONE", Utils.createItemStack(Item.getItemFromBlock(Blocks.end_stone), - EnumChatFormatting.GRAY+"End Stone")); - - /** COMBAT COLLECTIONS **/ - collectionToCollectionDisplayMap.put("ROTTEN_FLESH", Utils.createItemStack(Items.rotten_flesh, - EnumChatFormatting.RED+"Rotten Flesh")); - collectionToCollectionDisplayMap.put("BONE", Utils.createItemStack(Items.bone, - EnumChatFormatting.RED+"Bone")); - collectionToCollectionDisplayMap.put("STRING", Utils.createItemStack(Items.string, - EnumChatFormatting.RED+"String")); - collectionToCollectionDisplayMap.put("SPIDER_EYE", Utils.createItemStack(Items.spider_eye, - EnumChatFormatting.RED+"Spider Eye")); - collectionToCollectionDisplayMap.put("SULPHUR", Utils.createItemStack(Items.gunpowder, - EnumChatFormatting.RED+"Gunpowder")); - collectionToCollectionDisplayMap.put("ENDER_PEARL", Utils.createItemStack(Items.ender_pearl, - EnumChatFormatting.RED+"Ender Pearl")); - collectionToCollectionDisplayMap.put("GHAST_TEAR", Utils.createItemStack(Items.ghast_tear, - EnumChatFormatting.RED+"Ghast Tear")); - collectionToCollectionDisplayMap.put("SLIME_BALL", Utils.createItemStack(Items.slime_ball, - EnumChatFormatting.RED+"Slimeball")); - collectionToCollectionDisplayMap.put("BLAZE_ROD", Utils.createItemStack(Items.blaze_rod, - EnumChatFormatting.RED+"Blaze Rod")); - collectionToCollectionDisplayMap.put("MAGMA_CREAM", Utils.createItemStack(Items.magma_cream, - EnumChatFormatting.RED+"Magma Cream")); - - /** FORAGING COLLECTIONS **/ - collectionToCollectionDisplayMap.put("LOG", Utils.createItemStack(Item.getItemFromBlock(Blocks.log), - EnumChatFormatting.DARK_GREEN+"Oak")); - collectionToCollectionDisplayMap.put("LOG:1", Utils.createItemStack(Item.getItemFromBlock(Blocks.log), - EnumChatFormatting.DARK_GREEN+"Birch", 1)); - collectionToCollectionDisplayMap.put("LOG:2", Utils.createItemStack(Item.getItemFromBlock(Blocks.log), - EnumChatFormatting.DARK_GREEN+"Spruce", 2)); - collectionToCollectionDisplayMap.put("LOG_2:1", Utils.createItemStack(Item.getItemFromBlock(Blocks.log2), - EnumChatFormatting.DARK_GREEN+"Dark Oak", 1)); - collectionToCollectionDisplayMap.put("LOG_2", Utils.createItemStack(Item.getItemFromBlock(Blocks.log2), - EnumChatFormatting.DARK_GREEN+"Acacia")); - collectionToCollectionDisplayMap.put("LOG:3", Utils.createItemStack(Item.getItemFromBlock(Blocks.log), - EnumChatFormatting.DARK_GREEN+"Jungle", 3)); - - /** FISHING COLLECTIONS **/ - collectionToCollectionDisplayMap.put("RAW_FISH", Utils.createItemStack(Items.fish, - EnumChatFormatting.AQUA+"Fish")); - collectionToCollectionDisplayMap.put("RAW_FISH:1", Utils.createItemStack(Items.fish, - EnumChatFormatting.AQUA+"Salmon", 1)); - collectionToCollectionDisplayMap.put("RAW_FISH:2", Utils.createItemStack(Items.fish, - EnumChatFormatting.AQUA+"Clownfish", 2)); - collectionToCollectionDisplayMap.put("RAW_FISH:3", Utils.createItemStack(Items.fish, - EnumChatFormatting.AQUA+"Pufferfish", 3)); - collectionToCollectionDisplayMap.put("PRISMARINE_SHARD", Utils.createItemStack(Items.prismarine_shard, - EnumChatFormatting.AQUA+"Prismarine Shard")); - collectionToCollectionDisplayMap.put("PRISMARINE_CRYSTALS", Utils.createItemStack(Items.prismarine_crystals, - EnumChatFormatting.AQUA+"Prismarine Crystals")); - collectionToCollectionDisplayMap.put("CLAY_BALL", Utils.createItemStack(Items.clay_ball, - EnumChatFormatting.AQUA+"Clay")); - collectionToCollectionDisplayMap.put("WATER_LILY", Utils.createItemStack(Item.getItemFromBlock(Blocks.waterlily), - EnumChatFormatting.AQUA+"Lilypad")); - collectionToCollectionDisplayMap.put("INK_SACK", Utils.createItemStack(Items.dye, - EnumChatFormatting.AQUA+"Ink Sack")); - collectionToCollectionDisplayMap.put("SPONGE", Utils.createItemStack(Item.getItemFromBlock(Blocks.sponge), - EnumChatFormatting.AQUA+"Sponge")); - } - - public static LinkedHashMap<ItemStack, List<String>> getCollectionCatToMinionMap() { - return collectionCatToMinionMap; - } - - public static LinkedHashMap<String, ItemStack> getCollectionToCollectionDisplayMap() { - return collectionToCollectionDisplayMap; - } - - public static LinkedHashMap<ItemStack, List<String>> getCollectionCatToCollectionMap() { - return collectionCatToCollectionMap; - } - - public static Map<String, ItemStack> getSkillToSkillDisplayMap() { - return Collections.unmodifiableMap(skillToSkillDisplayMap); - } - - public static class Level { - public float level = 0; - public float maxXpForLevel = 0; - public boolean maxed = false; - } - - public static Level getLevel(JsonArray levelingArray, float xp, int levelCap, boolean cumulative) { - Level levelObj = new Level(); - for(int level=0; level<levelingArray.size(); level++) { - float levelXp = levelingArray.get(level).getAsFloat(); - if(levelXp > xp) { - if(cumulative) { - float previous = 0; - if(level > 0) previous = levelingArray.get(level-1).getAsFloat(); - levelObj.maxXpForLevel = (levelXp-previous); - levelObj.level = 1 + level + (xp-levelXp)/levelObj.maxXpForLevel; - } else { - levelObj.maxXpForLevel = levelXp; - levelObj.level = level + xp/levelXp; - } - if(levelObj.level > levelCap) { - levelObj.level = levelCap; - levelObj.maxed = true; - } - return levelObj; - } else { - if(!cumulative) xp -= levelXp; - } - } - levelObj.level = levelingArray.size(); - if(levelObj.level > levelCap) { - levelObj.level = levelCap; - } - levelObj.maxed = true; - return levelObj; - } - - public class Profile { - private final String uuid; - private String latestProfile = null; - - private JsonArray playerInformation = null; - private JsonObject basicInfo = null; - - private final HashMap<String, JsonObject> profileMap = new HashMap<>(); - private final HashMap<String, JsonObject> petsInfoMap = new HashMap<>(); - private final HashMap<String, List<JsonObject>> coopProfileMap = new HashMap<>(); - private final HashMap<String, JsonObject> skillInfoMap = new HashMap<>(); - private final HashMap<String, JsonObject> inventoryInfoMap = new HashMap<>(); - private final HashMap<String, JsonObject> collectionInfoMap = new HashMap<>(); - private List<String> profileIds = new ArrayList<>(); - private JsonObject playerStatus = null; - private HashMap<String, PlayerStats.Stats> stats = new HashMap<>(); - private HashMap<String, PlayerStats.Stats> passiveStats = new HashMap<>(); - private HashMap<String, Long> networth = new HashMap<>(); - - public Profile(String uuid) { - this.uuid = uuid; - } - - private AtomicBoolean updatingPlayerInfoState = new AtomicBoolean(false); - private long lastPlayerInfoState = 0; - private AtomicBoolean updatingPlayerStatusState = new AtomicBoolean(false); - - public JsonObject getPlayerStatus() { - if(playerStatus != null) return playerStatus; - if(updatingPlayerStatusState.get()) return null; - - updatingPlayerStatusState.set(true); - - HashMap<String, String> args = new HashMap<>(); - args.put("uuid", ""+uuid); - manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "status", - args, jsonObject -> { - if(jsonObject == null) return; - - updatingPlayerStatusState.set(false); - if(jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { - playerStatus = jsonObject.get("session").getAsJsonObject(); - } - }, () -> updatingPlayerStatusState.set(false) - ); - - return null; - } - - public long getNetWorth(String profileId) { - if(profileId == null) profileId = latestProfile; - if(networth.get(profileId) != null) return networth.get(profileId); - if(getProfileInformation(profileId) == null) return -1; - if(getInventoryInfo(profileId) == null) return -1; - - JsonObject inventoryInfo = getInventoryInfo(profileId); - JsonObject profileInfo = getProfileInformation(profileId); - - HashMap<String, Long> mostExpensiveInternal = new HashMap<>(); - - long networth = 0; - for(Map.Entry<String, JsonElement> entry : inventoryInfo.entrySet()) { - if(entry.getValue().isJsonArray()) { - for(JsonElement element : entry.getValue().getAsJsonArray()) { - if(element != null && element.isJsonObject()) { - JsonObject item = element.getAsJsonObject(); - String internalname = item.get("internalname").getAsString(); - - if(manager.auctionManager.isVanillaItem(internalname)) continue; - - JsonObject bzInfo = manager.auctionManager.getBazaarInfo(internalname); - - int auctionPrice; - if(bzInfo != null && bzInfo.has("curr_sell")) { - auctionPrice = (int)bzInfo.get("curr_sell").getAsFloat(); - } else { - auctionPrice = (int)manager.auctionManager.getItemAvgBin(internalname); - if(auctionPrice <= 0) { - auctionPrice = manager.auctionManager.getLowestBin(internalname); - } - } - - try { - if(item.has("item_contents")) { - JsonArray bytesArr = item.get("item_contents").getAsJsonArray(); - byte[] bytes = new byte[bytesArr.size()]; - for (int bytesArrI = 0; bytesArrI < bytesArr.size(); bytesArrI++) { - bytes[bytesArrI] = bytesArr.get(bytesArrI).getAsByte(); - } - NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes)); - NBTTagList items = contents_nbt.getTagList("i", 10); - for(int j=0; j<items.tagCount(); j++) { - if(items.getCompoundTagAt(j).getKeySet().size() > 0) { - NBTTagCompound nbt = items.getCompoundTagAt(j).getCompoundTag("tag"); - String internalname2 = manager.getInternalnameFromNBT(nbt); - if(internalname2 != null) { - if(manager.auctionManager.isVanillaItem(internalname2)) continue; - - JsonObject bzInfo2 = manager.auctionManager.getBazaarInfo(internalname2); - - int auctionPrice2; - if(bzInfo2 != null && bzInfo2.has("curr_sell")) { - auctionPrice2 = (int)bzInfo2.get("curr_sell").getAsFloat(); - } else { - auctionPrice2 = (int)manager.auctionManager.getItemAvgBin(internalname2); - if(auctionPrice2 <= 0) { - auctionPrice2 = manager.auctionManager.getLowestBin(internalname2); - } - } - - int count2 = items.getCompoundTagAt(j).getByte("Count"); - - mostExpensiveInternal.put(internalname2, auctionPrice2 * count2 + mostExpensiveInternal.getOrDefault(internalname2, 0L)); - networth += auctionPrice2 * count2; - } - } - } - } - } catch(IOException ignored) {} - - int count = 1; - if(element.getAsJsonObject().has("count")) { - count = element.getAsJsonObject().get("count").getAsInt(); - } - mostExpensiveInternal.put(internalname, auctionPrice * count + mostExpensiveInternal.getOrDefault(internalname, 0L)); - networth += auctionPrice * count; - } - } - } - } - if(networth == 0) return -1; - - //System.out.println(profileId); - for(Map.Entry<String, Long> entry : mostExpensiveInternal.entrySet()) { - //System.out.println(entry.getKey() + ":" + entry.getValue()); - } - - networth = (int)(networth*1.3f); - - JsonObject petsInfo = getPetsInfo(profileId); - if(petsInfo != null && petsInfo.has("pets")) { - if(petsInfo.get("pets").isJsonArray()) { - JsonArray pets = petsInfo.get("pets").getAsJsonArray(); - for(JsonElement element : pets) { - if(element.isJsonObject()) { - JsonObject pet = element.getAsJsonObject(); - - String petname = pet.get("type").getAsString(); - String tier = pet.get("tier").getAsString(); - String tierNum = petRarityToNumMap.get(tier); - if(tierNum != null) { - String internalname2 = petname+";"+tierNum; - JsonObject info2 = manager.auctionManager.getItemAuctionInfo(internalname2); - if(info2 == null || !info2.has("price") || !info2.has("count")) continue; - int auctionPrice2 = (int)(info2.get("price").getAsFloat() / info2.get("count").getAsFloat()); - - networth += auctionPrice2; - } - } - } - } - } - - float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0); - float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0); - - networth += bankBalance+purseBalance; - - this.networth.put(profileId, networth); - return networth; - } - - public String getLatestProfile() { - return latestProfile; - } - - public JsonArray getPlayerInformation(Runnable runnable) { - if (playerInformation != null) return playerInformation; - - long currentTime = System.currentTimeMillis(); - - if (currentTime - lastPlayerInfoState < 15*1000 && updatingPlayerInfoState.get()) return null; - - lastPlayerInfoState = currentTime; - updatingPlayerInfoState.set(true); - - HashMap<String, String> args = new HashMap<>(); - args.put("uuid", "" + uuid); - manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/profiles", - args, jsonObject -> { - updatingPlayerInfoState.set(false); - - if (jsonObject == null) return; - if (jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { - playerInformation = jsonObject.get("profiles").getAsJsonArray(); - if (playerInformation == null) return; - String backup = null; - long backupLastSave = 0; - - profileIds.clear(); - - for (int i = 0; i < playerInformation.size(); i++) { - JsonObject profile = playerInformation.get(i).getAsJsonObject(); - - if (!profile.has("members")) continue; - JsonObject members = profile.get("members").getAsJsonObject(); - - if (members.has(uuid)) { - JsonObject member = members.get(uuid).getAsJsonObject(); - - if(member.has("coop_invitation")) { - JsonObject coop_invitation = member.get("coop_invitation").getAsJsonObject(); - if(!coop_invitation.get("confirmed").getAsBoolean()) { - continue; - } - } - - String cute_name = profile.get("cute_name").getAsString(); - if (backup == null) backup = cute_name; - profileIds.add(cute_name); - if (member.has("last_save")) { - long last_save = member.get("last_save").getAsLong(); - if (last_save > backupLastSave) { - backupLastSave = last_save; - backup = cute_name; - } - } - - } - } - latestProfile = backup; - if (runnable != null) runnable.run(); - } - }, () -> { - updatingPlayerInfoState.set(false); - } - ); - - return null; - } - - public List<String> getProfileIds() { - return profileIds; - } - - public JsonObject getProfileInformation(String profileId) { - JsonArray playerInfo = getPlayerInformation(() -> {}); - if(playerInfo == null) return null; - if(profileId == null) profileId = latestProfile; - if(profileMap.containsKey(profileId)) return profileMap.get(profileId); - - for(int i=0; i<playerInformation.size(); i++) { - if(!playerInformation.get(i).isJsonObject()) { - playerInformation = null; - return null; - } - JsonObject profile = playerInformation.get(i).getAsJsonObject(); - if(profile.get("cute_name").getAsString().equalsIgnoreCase(profileId)) { - if(!profile.has("members")) return null; - JsonObject members = profile.get("members").getAsJsonObject(); - if(!members.has(uuid)) continue; - JsonObject profileInfo = members.get(uuid).getAsJsonObject(); - if(profile.has("banking")) { - profileInfo.add("banking", profile.get("banking").getAsJsonObject()); - } - profileMap.put(profileId, profileInfo); - return profileInfo; - } - } - - return null; - } - - public List<JsonObject> getCoopProfileInformation(String profileId) { - JsonArray playerInfo = getPlayerInformation(() -> {}); - if(playerInfo == null) return null; - if(profileId == null) profileId = latestProfile; - if(coopProfileMap.containsKey(profileId)) return coopProfileMap.get(profileId); - - for(int i=0; i<playerInformation.size(); i++) { - if(!playerInformation.get(i).isJsonObject()) { - playerInformation = null; - return null; - } - JsonObject profile = playerInformation.get(i).getAsJsonObject(); - if(profile.get("cute_name").getAsString().equalsIgnoreCase(profileId)) { - if(!profile.has("members")) return null; - JsonObject members = profile.get("members").getAsJsonObject(); - if(!members.has(uuid)) return null; - List<JsonObject> coopList = new ArrayList<>(); - for(Map.Entry<String, JsonElement> islandMember : members.entrySet()) { - if(!islandMember.getKey().equals(uuid)) { - JsonObject coopProfileInfo = islandMember.getValue().getAsJsonObject(); - coopList.add(coopProfileInfo); - } - } - coopProfileMap.put(profileId, coopList); - return coopList; - } - } - - return null; - } - - public void resetCache() { - playerInformation = null; - basicInfo = null; - playerStatus = null; - stats.clear(); - passiveStats.clear(); - profileIds.clear(); - profileMap.clear(); - coopProfileMap.clear(); - petsInfoMap.clear(); - skillInfoMap.clear(); - inventoryInfoMap.clear(); - collectionInfoMap.clear(); - networth.clear(); - } - - public int getCap(JsonObject leveling, String skillName) { - JsonElement capsElement = Utils.getElement(leveling, "leveling_caps"); - if(capsElement == null || !capsElement.isJsonObject()) { - return 50; - } - JsonObject caps = capsElement.getAsJsonObject(); - if(caps.has(skillName)) { - return caps.get(skillName).getAsInt(); - } - return 50; - } - - public JsonObject getSkillInfo(String profileId) { - JsonObject profileInfo = getProfileInformation(profileId); - if(profileInfo == null) return null; - if(profileId == null) profileId = latestProfile; - if(skillInfoMap.containsKey(profileId)) return skillInfoMap.get(profileId); - JsonObject leveling = Constants.LEVELING; - if(leveling == null) return null; - - float experience_skill_taming = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_taming"), 0); - float experience_skill_mining = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_mining"), 0); - float experience_skill_foraging = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_foraging"), 0); - float experience_skill_enchanting = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_enchanting"), 0); - float experience_skill_carpentry = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_carpentry"), 0); - float experience_skill_farming = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_farming"), 0); - float experience_skill_combat = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_combat"), 0); - float experience_skill_fishing = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_fishing"), 0); - float experience_skill_alchemy = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_alchemy"), 0); - float experience_skill_runecrafting = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_runecrafting"), 0); - - float experience_skill_catacombs = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.experience"), 0); - - float experience_slayer_zombie = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.xp"), 0); - float experience_slayer_spider = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.xp"), 0); - float experience_slayer_wolf = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.xp"), 0); - - float totalSkillXP = experience_skill_taming + experience_skill_mining + experience_skill_foraging - + experience_skill_enchanting + experience_skill_carpentry + experience_skill_farming - + experience_skill_combat + experience_skill_fishing + experience_skill_alchemy - + experience_skill_runecrafting; - - if(totalSkillXP <= 0) { - return null; - } - - JsonObject skillInfo = new JsonObject(); - - skillInfo.addProperty("experience_skill_taming", experience_skill_taming); - skillInfo.addProperty("experience_skill_mining", experience_skill_mining); - skillInfo.addProperty("experience_skill_foraging", experience_skill_foraging); - skillInfo.addProperty("experience_skill_enchanting", experience_skill_enchanting); - skillInfo.addProperty("experience_skill_carpentry", experience_skill_carpentry); - skillInfo.addProperty("experience_skill_farming", experience_skill_farming); - skillInfo.addProperty("experience_skill_combat", experience_skill_combat); - skillInfo.addProperty("experience_skill_fishing", experience_skill_fishing); - skillInfo.addProperty("experience_skill_alchemy", experience_skill_alchemy); - skillInfo.addProperty("experience_skill_runecrafting", experience_skill_runecrafting); - - skillInfo.addProperty("experience_skill_catacombs", experience_skill_catacombs); - - skillInfo.addProperty("experience_slayer_zombie", experience_slayer_zombie); - skillInfo.addProperty("experience_slayer_spider", experience_slayer_spider); - skillInfo.addProperty("experience_slayer_wolf", experience_slayer_wolf); - - JsonArray levelingArray = Utils.getElement(leveling, "leveling_xp").getAsJsonArray(); - int farmingCap = getCap(leveling, "farming") + (int)Utils.getElementAsFloat( - Utils.getElement(profileInfo, "jacob2.perks.farming_level_cap"), 0); - Level level_skill_taming = getLevel(levelingArray, experience_skill_taming, getCap(leveling, "taming"), false); - Level level_skill_mining = getLevel(levelingArray, experience_skill_mining, getCap(leveling, "mining"), false); - Level level_skill_foraging = getLevel(levelingArray, experience_skill_foraging, getCap(leveling, "foraging"), false); - Level level_skill_enchanting = getLevel(levelingArray, experience_skill_enchanting, getCap(leveling, "enchanting"), false); - Level level_skill_carpentry = getLevel(levelingArray, experience_skill_carpentry,getCap(leveling, "carpetry"), false); - Level level_skill_farming = getLevel(levelingArray, experience_skill_farming, farmingCap, false); - Level level_skill_combat = getLevel(levelingArray, experience_skill_combat, getCap(leveling, "combat"), false); - Level level_skill_fishing = getLevel(levelingArray, experience_skill_fishing, getCap(leveling, "fishing"), false); - Level level_skill_alchemy = getLevel(levelingArray, experience_skill_alchemy, getCap(leveling, "alchemy"), false); - Level level_skill_runecrafting = getLevel(Utils.getElement(leveling, "runecrafting_xp").getAsJsonArray(), - experience_skill_runecrafting, getCap(leveling, "runecrafting"), false); - - Level level_skill_catacombs = getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(), - experience_skill_catacombs, getCap(leveling, "catacombs"), false); - - Level level_slayer_zombie = getLevel(Utils.getElement(leveling, "slayer_xp.zombie").getAsJsonArray(), - experience_slayer_zombie, 9,true); - Level level_slayer_spider = getLevel(Utils.getElement(leveling, "slayer_xp.spider").getAsJsonArray(), - experience_slayer_spider, 9,true); - Level level_slayer_wolf = getLevel(Utils.getElement(leveling, "slayer_xp.wolf").getAsJsonArray(), - experience_slayer_wolf, 9,true); - - skillInfo.addProperty("level_skill_taming", level_skill_taming.level); - skillInfo.addProperty("level_skill_mining", level_skill_mining.level); - skillInfo.addProperty("level_skill_foraging", level_skill_foraging.level); - skillInfo.addProperty("level_skill_enchanting", level_skill_enchanting.level); - skillInfo.addProperty("level_skill_carpentry", level_skill_carpentry.level); - skillInfo.addProperty("level_skill_farming", level_skill_farming.level); - skillInfo.addProperty("level_skill_combat", level_skill_combat.level); - skillInfo.addProperty("level_skill_fishing", level_skill_fishing.level); - skillInfo.addProperty("level_skill_alchemy", level_skill_alchemy.level); - skillInfo.addProperty("level_skill_runecrafting", level_skill_runecrafting.level); - - skillInfo.addProperty("level_skill_catacombs", level_skill_catacombs.level); - - skillInfo.addProperty("level_slayer_zombie", level_slayer_zombie.level); - skillInfo.addProperty("level_slayer_spider", level_slayer_spider.level); - skillInfo.addProperty("level_slayer_wolf", level_slayer_wolf.level); - - skillInfo.addProperty("maxed_skill_taming", level_skill_taming.maxed); - skillInfo.addProperty("maxed_skill_mining", level_skill_mining.maxed); - skillInfo.addProperty("maxed_skill_foraging", level_skill_foraging.maxed); - skillInfo.addProperty("maxed_skill_enchanting", level_skill_enchanting.maxed); - skillInfo.addProperty("maxed_skill_carpentry", level_skill_carpentry.maxed); - skillInfo.addProperty("maxed_skill_farming", level_skill_farming.maxed); - skillInfo.addProperty("maxed_skill_combat", level_skill_combat.maxed); - skillInfo.addProperty("maxed_skill_fishing", level_skill_fishing.maxed); - skillInfo.addProperty("maxed_skill_alchemy", level_skill_alchemy.maxed); - skillInfo.addProperty("maxed_skill_runecrafting", level_skill_runecrafting.maxed); - - skillInfo.addProperty("maxed_skill_catacombs", level_skill_catacombs.maxed); - - skillInfo.addProperty("maxed_slayer_zombie", level_slayer_zombie.maxed); - skillInfo.addProperty("maxed_slayer_spider", level_slayer_spider.maxed); - skillInfo.addProperty("maxed_slayer_wolf", level_slayer_wolf.maxed); - - skillInfo.addProperty("maxxp_skill_taming", level_skill_taming.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_mining", level_skill_mining.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_foraging", level_skill_foraging.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_enchanting", level_skill_enchanting.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_carpentry", level_skill_carpentry.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_farming", level_skill_farming.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_combat", level_skill_combat.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_fishing", level_skill_fishing.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_alchemy", level_skill_alchemy.maxXpForLevel); - skillInfo.addProperty("maxxp_skill_runecrafting", level_skill_runecrafting.maxXpForLevel); - - skillInfo.addProperty("maxxp_skill_catacombs", level_skill_catacombs.maxXpForLevel); - - skillInfo.addProperty("maxxp_slayer_zombie", level_slayer_zombie.maxXpForLevel); - skillInfo.addProperty("maxxp_slayer_spider", level_slayer_spider.maxXpForLevel); - skillInfo.addProperty("maxxp_slayer_wolf", level_slayer_wolf.maxXpForLevel); - - return skillInfo; - } - - public JsonObject getInventoryInfo(String profileId) { - JsonObject profileInfo = getProfileInformation(profileId); - if(profileInfo == null) return null; - if(profileId == null) profileId = latestProfile; - if(inventoryInfoMap.containsKey(profileId)) return inventoryInfoMap.get(profileId); - - String inv_armor_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "inv_armor.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String fishing_bag_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "fishing_bag.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String quiver_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "quiver.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String ender_chest_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "ender_chest_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String wardrobe_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "wardrobe_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String potion_bag_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "potion_bag.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String inv_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "inv_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String talisman_bag_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "talisman_bag.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - String candy_inventory_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "candy_inventory_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA="); - - JsonObject inventoryInfo = new JsonObject(); - - String[] inv_names = new String[]{"inv_armor", "fishing_bag", "quiver", "ender_chest_contents", "wardrobe_contents", - "potion_bag", "inv_contents", "talisman_bag", "candy_inventory_contents"}; - String[] inv_bytes = new String[]{inv_armor_bytes, fishing_bag_bytes, quiver_bytes, ender_chest_contents_bytes, wardrobe_contents_bytes, - potion_bag_bytes, inv_contents_bytes, talisman_bag_bytes, candy_inventory_contents_bytes}; - for(int i=0; i<inv_bytes.length; i++) { - try { - String bytes = inv_bytes[i]; - - JsonArray contents = new JsonArray(); - NBTTagCompound inv_contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(Base64.getDecoder().decode(bytes))); - NBTTagList items = inv_contents_nbt.getTagList("i", 10); - for(int j=0; j<items.tagCount(); j++) { - JsonObject item = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j)); - contents.add(item); - } - inventoryInfo.add(inv_names[i], contents); - } catch(IOException e) { - inventoryInfo.add(inv_names[i], new JsonArray()); - } - } - - inventoryInfoMap.put(profileId, inventoryInfo); - - return inventoryInfo; - } - - public JsonObject getPetsInfo(String profileId) { - JsonObject profileInfo = getProfileInformation(profileId); - if(profileInfo == null) return null; - if(petsInfoMap.containsKey(profileId)) return petsInfoMap.get(profileId); - - JsonObject petsInfo = new JsonObject(); - JsonElement petsElement = profileInfo.get("pets"); - if(petsElement != null && petsElement.isJsonArray()) { - JsonObject activePet = null; - JsonArray pets = petsElement.getAsJsonArray(); - for(int i=0; i<pets.size(); i++) { - JsonObject pet = pets.get(i).getAsJsonObject(); - if(pet.has("active") && pet.get("active").getAsJsonPrimitive().getAsBoolean()) { - activePet = pet; - break; - } - } - petsInfo.add("active_pet", activePet); - petsInfo.add("pets", pets); - petsInfoMap.put(profileId, petsInfo); - return petsInfo; - } - return null; - } - - private final Pattern COLL_TIER_PATTERN = Pattern.compile("_(-?[0-9]+)"); - public JsonObject getCollectionInfo(String profileId) { - JsonObject profileInfo = getProfileInformation(profileId); - if(profileInfo == null) return null; - JsonObject resourceCollectionInfo = getResourceCollectionInformation(); - if(resourceCollectionInfo == null) return null; - if(profileId == null) profileId = latestProfile; - if(collectionInfoMap.containsKey(profileId)) return collectionInfoMap.get(profileId); - - JsonElement unlocked_coll_tiers_element = Utils.getElement(profileInfo, "unlocked_coll_tiers"); - JsonElement crafted_generators_element = Utils.getElement(profileInfo, "crafted_generators"); - JsonElement collectionInfoElement = Utils.getElement(profileInfo, "collection"); - - if(unlocked_coll_tiers_element == null || collectionInfoElement == null) { - return null; - } - - JsonObject collectionInfo = new JsonObject(); - JsonObject collectionTiers = new JsonObject(); - JsonObject minionTiers = new JsonObject(); - JsonObject personalAmounts = new JsonObject(); - JsonObject totalAmounts = new JsonObject(); - - if(collectionInfoElement.isJsonObject()) { - personalAmounts = collectionInfoElement.getAsJsonObject(); - } - - for(Map.Entry<String, JsonElement> entry : personalAmounts.entrySet()) { - totalAmounts.addProperty(entry.getKey(), entry.getValue().getAsInt()); - } - - List<JsonObject> coopProfiles = getCoopProfileInformation(profileId); - if(coopProfiles != null) { - for(JsonObject coopProfile : coopProfiles) { - JsonElement coopCollectionInfoElement = Utils.getElement(coopProfile, "collection"); - if(coopCollectionInfoElement != null && coopCollectionInfoElement.isJsonObject()) { - for(Map.Entry<String, JsonElement> entry : coopCollectionInfoElement.getAsJsonObject().entrySet()) { - float existing = Utils.getElementAsFloat(totalAmounts.get(entry.getKey()), 0); - totalAmounts.addProperty(entry.getKey(), existing+entry.getValue().getAsInt()); - } - } - } - } - - if(unlocked_coll_tiers_element.isJsonArray()) { - JsonArray unlocked_coll_tiers = unlocked_coll_tiers_element.getAsJsonArray(); - for(int i=0; i<unlocked_coll_tiers.size(); i++) { - String unlocked = unlocked_coll_tiers.get(i).getAsString(); - - Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked); - - if(matcher.find()) { - String tier_str = matcher.group(1); - int tier = Integer.parseInt(tier_str); - String coll = unlocked.substring(0, unlocked.length()-(matcher.group().length())); - if(!collectionTiers.has(coll) || collectionTiers.get(coll).getAsInt() < tier) { - collectionTiers.addProperty(coll, tier); - } - } - } - } - - if(crafted_generators_element != null && crafted_generators_element.isJsonArray()) { - JsonArray crafted_generators = crafted_generators_element.getAsJsonArray(); - for(int i=0; i<crafted_generators.size(); i++) { - String unlocked = crafted_generators.get(i).getAsString(); - - Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked); - - if(matcher.find()) { - String tier_str = matcher.group(1); - int tier = Integer.parseInt(tier_str); - String coll = unlocked.substring(0, unlocked.length()-(matcher.group().length())); - if(!minionTiers.has(coll) || minionTiers.get(coll).getAsInt() < tier) { - minionTiers.addProperty(coll, tier); - } - } - } - } - - JsonObject maxAmount = new JsonObject(); - JsonObject updatedCollectionTiers = new JsonObject(); - for(Map.Entry<String, JsonElement> totalAmountsEntry : totalAmounts.entrySet()) { - String collName = totalAmountsEntry.getKey(); - int collTier = (int)Utils.getElementAsFloat(collectionTiers.get(collName), 0); - - int currentAmount = (int)Utils.getElementAsFloat(totalAmounts.get(collName), 0); - if(currentAmount > 0) { - for(Map.Entry<String, JsonElement> resourceEntry : resourceCollectionInfo.entrySet()) { - JsonElement tiersElement = Utils.getElement(resourceEntry.getValue(), "items."+collName+".tiers"); - if(tiersElement != null && tiersElement.isJsonArray()) { - JsonArray tiers = tiersElement.getAsJsonArray(); - int maxTierAcquired = -1; - int maxAmountRequired = -1; - for(int i=0; i<tiers.size(); i++) { - JsonObject tierInfo = tiers.get(i).getAsJsonObject(); - int tier = tierInfo.get("tier").getAsInt(); - int amountRequired = tierInfo.get("amountRequired").getAsInt(); - if(currentAmount >= amountRequired) { - maxTierAcquired = tier; - } - maxAmountRequired = amountRequired; - } - if(maxTierAcquired >= 0 && maxTierAcquired > collTier) { - updatedCollectionTiers.addProperty(collName, maxTierAcquired); - } - maxAmount.addProperty(collName, maxAmountRequired); - } - } - } - } - - for(Map.Entry<String, JsonElement> collectionTiersEntry : updatedCollectionTiers.entrySet()) { - collectionTiers.add(collectionTiersEntry.getKey(), collectionTiersEntry.getValue()); - } - - collectionInfo.add("minion_tiers", minionTiers); - collectionInfo.add("max_amounts", maxAmount); - collectionInfo.add("personal_amounts", personalAmounts); - collectionInfo.add("total_amounts", totalAmounts); - collectionInfo.add("collection_tiers", collectionTiers); - - return collectionInfo; - } - - public PlayerStats.Stats getPassiveStats(String profileId) { - if(passiveStats.get(profileId) != null) return passiveStats.get(profileId); - JsonObject profileInfo = getProfileInformation(profileId); - if(profileInfo == null) return null; - - PlayerStats.Stats passiveStats = PlayerStats.getPassiveBonuses(getSkillInfo(profileId), profileInfo); - - if(passiveStats != null) { - passiveStats.add(PlayerStats.getBaseStats()); - } - - this.passiveStats.put(profileId, passiveStats); - - return passiveStats; - } - - public PlayerStats.Stats getStats(String profileId) { - //if(stats.get(profileId) != null) return stats.get(profileId); - JsonObject profileInfo = getProfileInformation(profileId); - if(profileInfo == null) { - return null; - } - - PlayerStats.Stats stats = PlayerStats.getStats(getSkillInfo(profileId), getInventoryInfo(profileId), getCollectionInfo(profileId), - getPetsInfo(profileId), profileInfo); - this.stats.put(profileId, stats); - return stats; - } - - public String getUuid() { - return uuid; - } - - public @Nullable JsonObject getHypixelProfile() { - if(uuidToHypixelProfile.containsKey(uuid)) return uuidToHypixelProfile.get(uuid); - return null; - } - } - - private HashMap<String, JsonObject> nameToHypixelProfile = new HashMap<>(); - private HashMap<String, JsonObject> uuidToHypixelProfile = new HashMap<>(); - private HashMap<String, Profile> uuidToProfileMap = new HashMap<>(); - - public void getHypixelProfile(String name, Consumer<JsonObject> callback) { - String nameF = name.toLowerCase(); - HashMap<String, String> args = new HashMap<>(); - args.put("name", ""+nameF); - manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "player", - args, jsonObject -> { - if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean() - && jsonObject.get("player").isJsonObject()) { - nameToUuid.put(nameF, jsonObject.get("player").getAsJsonObject().get("uuid").getAsString()); - uuidToHypixelProfile.put(jsonObject.get("player").getAsJsonObject().get("uuid").getAsString(), jsonObject.get("player").getAsJsonObject()); - if(callback != null) callback.accept(jsonObject); - } else { - if(callback != null) callback.accept(null); - } - } - ); - } - - private final HashMap<String, String> nameToUuid = new HashMap<>(); - - public void putNameUuid(String name, String uuid) { - nameToUuid.put(name, uuid); - } - - public void getPlayerUUID(String name, Consumer<String> uuidCallback) { - String nameF = name.toLowerCase(); - if(nameToUuid.containsKey(nameF)) { - uuidCallback.accept(nameToUuid.get(nameF)); - return; - } - - manager.hypixelApi.getApiAsync("https://api.mojang.com/users/profiles/minecraft/"+nameF, - (jsonObject) -> { - if(jsonObject.has("id") && jsonObject.get("id").isJsonPrimitive() && - ((JsonPrimitive)jsonObject.get("id")).isString()) { - String uuid = jsonObject.get("id").getAsString(); - nameToUuid.put(nameF, uuid); - uuidCallback.accept(uuid); - return; - } - uuidCallback.accept(null); - }, () -> uuidCallback.accept(null) - ); - } - - public void getProfileByName(String name, Consumer<Profile> callback) { - String nameF = name.toLowerCase(); - - if(nameToUuid.containsKey(nameF) && nameToUuid.get(nameF) == null) { - callback.accept(null); - return; - } - - getPlayerUUID(nameF, (uuid) -> { - if(uuid == null) { - getHypixelProfile(nameF, jsonObject -> { - if(jsonObject != null) { - callback.accept(getProfileReset(nameToUuid.get(nameF), ignored -> {})); - } else { - callback.accept(null); - nameToUuid.put(nameF, null); - } - }); - } else { - if(!uuidToHypixelProfile.containsKey(uuid)) { - getHypixelProfile(nameF, jsonObject -> {}); - } - callback.accept(getProfileReset(uuid, ignored -> {})); - } - }); - - return; - } - - public Profile getProfileRaw(String uuid) { - return uuidToProfileMap.get(uuid); - } - - public Profile getProfile(String uuid, Consumer<Profile> callback) { - Profile profile = uuidToProfileMap.computeIfAbsent(uuid, k -> new Profile(uuid)); - if(profile.playerInformation != null) { - callback.accept(profile); - } else { - profile.getPlayerInformation(() -> callback.accept(profile)); - } - return profile; - } - - public Profile getProfileReset(String uuid, Consumer<Profile> callback) { - if(uuidToProfileMap.containsKey(uuid)) uuidToProfileMap.get(uuid).resetCache(); - return getProfile(uuid, callback); - } - - private static JsonObject resourceCollection = null; - private static AtomicBoolean updatingResourceCollection = new AtomicBoolean(false); - public static JsonObject getResourceCollectionInformation() { - if(resourceCollection != null) return resourceCollection; - if(updatingResourceCollection.get()) return null; - - updatingResourceCollection.set(true); - - HashMap<String, String> args = new HashMap<>(); - NotEnoughUpdates.INSTANCE.manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "resources/skyblock/collections", - args, jsonObject -> { - updatingResourceCollection.set(false); - if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { - resourceCollection = jsonObject.get("collections").getAsJsonObject(); - } - }, () -> { - updatingResourceCollection.set(false); - } - ); - - return null; - } - -} +package io.github.moulberry.notenoughupdates.profileviewer;
+
+import com.google.common.base.Splitter;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+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.util.EnumChatFormatting;
+
+import javax.annotation.Nullable;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class ProfileViewer {
+
+ private final NEUManager manager;
+
+ public ProfileViewer(NEUManager manager) {
+ this.manager = manager;
+ }
+
+
+ private static HashMap<String, String> petRarityToNumMap = new HashMap<>();
+ static {
+ petRarityToNumMap.put("COMMON", "0");
+ petRarityToNumMap.put("UNCOMMON", "1");
+ petRarityToNumMap.put("RARE", "2");
+ petRarityToNumMap.put("EPIC", "3");
+ petRarityToNumMap.put("LEGENDARY", "4");
+ }
+
+ private static final LinkedHashMap<String, ItemStack> skillToSkillDisplayMap = new LinkedHashMap<>();
+ static {
+ skillToSkillDisplayMap.put("skill_taming", Utils.createItemStack(Items.spawn_egg, EnumChatFormatting.LIGHT_PURPLE+"Taming"));
+ skillToSkillDisplayMap.put("skill_mining", Utils.createItemStack(Items.stone_pickaxe, EnumChatFormatting.GRAY+"Mining"));
+ skillToSkillDisplayMap.put("skill_foraging", Utils.createItemStack(Item.getItemFromBlock(Blocks.sapling), EnumChatFormatting.DARK_GREEN+"Foraging"));
+ skillToSkillDisplayMap.put("skill_enchanting", Utils.createItemStack(Item.getItemFromBlock(Blocks.enchanting_table), EnumChatFormatting.GREEN+"Enchanting"));
+ skillToSkillDisplayMap.put("skill_carpentry", Utils.createItemStack(Item.getItemFromBlock(Blocks.crafting_table), EnumChatFormatting.DARK_RED+"Carpentry"));
+ skillToSkillDisplayMap.put("skill_farming", Utils.createItemStack(Items.golden_hoe, EnumChatFormatting.YELLOW+"Farming"));
+ skillToSkillDisplayMap.put("skill_combat", Utils.createItemStack(Items.stone_sword, EnumChatFormatting.RED+"Combat"));
+ skillToSkillDisplayMap.put("skill_fishing", Utils.createItemStack(Items.fishing_rod, EnumChatFormatting.AQUA+"Fishing"));
+ skillToSkillDisplayMap.put("skill_alchemy", Utils.createItemStack(Items.brewing_stand, EnumChatFormatting.BLUE+"Alchemy"));
+ skillToSkillDisplayMap.put("skill_runecrafting", Utils.createItemStack(Items.magma_cream, EnumChatFormatting.DARK_PURPLE+"Runecrafting"));
+ //skillToSkillDisplayMap.put("skill_catacombs", Utils.createItemStack(Item.getItemFromBlock(Blocks.deadbush), EnumChatFormatting.GOLD+"Catacombs"));
+ skillToSkillDisplayMap.put("slayer_zombie", Utils.createItemStack(Items.rotten_flesh, EnumChatFormatting.GOLD+"Rev Slayer"));
+ skillToSkillDisplayMap.put("slayer_spider", Utils.createItemStack(Items.spider_eye, EnumChatFormatting.GOLD+"Tara Slayer"));
+ skillToSkillDisplayMap.put("slayer_wolf", Utils.createItemStack(Items.bone, EnumChatFormatting.GOLD+"Sven Slayer"));
+ skillToSkillDisplayMap.put("slayer_enderman", Utils.createItemStack(Items.ender_pearl, EnumChatFormatting.GOLD+"Ender Slayer"));
+ }
+
+ private static final ItemStack CAT_FARMING = Utils.createItemStack(Items.golden_hoe, EnumChatFormatting.YELLOW+"Farming");
+ private static final ItemStack CAT_MINING = Utils.createItemStack(Items.stone_pickaxe, EnumChatFormatting.GRAY+"Mining");
+ private static final ItemStack CAT_COMBAT = Utils.createItemStack(Items.stone_sword, EnumChatFormatting.RED+"Combat");
+ private static final ItemStack CAT_FORAGING = Utils.createItemStack(Item.getItemFromBlock(Blocks.sapling), EnumChatFormatting.DARK_GREEN+"Foraging");
+ private static final ItemStack CAT_FISHING = Utils.createItemStack(Items.fishing_rod, EnumChatFormatting.AQUA+"Fishing");
+
+ private static final LinkedHashMap<ItemStack, List<String>> collectionCatToCollectionMap = new LinkedHashMap<>();
+ static {
+ collectionCatToCollectionMap.put(CAT_FARMING,
+ Utils.createList("WHEAT", "CARROT_ITEM", "POTATO_ITEM", "PUMPKIN", "MELON", "SEEDS", "MUSHROOM_COLLECTION",
+ "INK_SACK:3", "CACTUS", "SUGAR_CANE", "FEATHER", "LEATHER", "PORK", "RAW_CHICKEN", "MUTTON",
+ "RABBIT", "NETHER_STALK"));
+ collectionCatToCollectionMap.put(CAT_MINING,
+ Utils.createList("COBBLESTONE", "COAL", "IRON_INGOT", "GOLD_INGOT", "DIAMOND", "INK_SACK:4",
+ "EMERALD", "REDSTONE", "QUARTZ", "OBSIDIAN", "GLOWSTONE_DUST", "GRAVEL", "ICE", "NETHERRACK",
+ "SAND", "ENDER_STONE", "MITHRIL_ORE", "HARD_STONE", "GEMSTONE_COLLECTION"));
+ collectionCatToCollectionMap.put(CAT_COMBAT,
+ Utils.createList("ROTTEN_FLESH", "BONE", "STRING", "SPIDER_EYE", "SULPHUR", "ENDER_PEARL",
+ "GHAST_TEAR", "SLIME_BALL", "BLAZE_ROD", "MAGMA_CREAM"));
+ collectionCatToCollectionMap.put(CAT_FORAGING,
+ Utils.createList("LOG", "LOG:1", "LOG:2", "LOG_2:1", "LOG_2", "LOG:3"));
+ collectionCatToCollectionMap.put(CAT_FISHING,
+ Utils.createList("RAW_FISH", "RAW_FISH:1", "RAW_FISH:2", "RAW_FISH:3", "PRISMARINE_SHARD",
+ "PRISMARINE_CRYSTALS", "CLAY_BALL", "WATER_LILY", "INK_SACK", "SPONGE"));
+ }
+
+ private static final LinkedHashMap<ItemStack, List<String>> collectionCatToMinionMap = new LinkedHashMap<>();
+ static {
+ collectionCatToMinionMap.put(CAT_FARMING,
+ Utils.createList("WHEAT", "CARROT", "POTATO", "PUMPKIN", "MELON", null, "MUSHROOM",
+ "COCOA", "CACTUS", "SUGAR_CANE", "CHICKEN", "COW", "PIG", null, "SHEEP",
+ "RABBIT", "NETHER_WARTS"));
+ collectionCatToMinionMap.put(CAT_MINING,
+ Utils.createList("COBBLESTONE", "COAL", "IRON", "GOLD", "DIAMOND", "LAPIS",
+ "EMERALD", "REDSTONE", "QUARTZ", "OBSIDIAN", "GLOWSTONE", "GRAVEL", "ICE", null,
+ "SAND", "ENDER_STONE", "MITHRIL", "HARD_STONE", null));
+ collectionCatToMinionMap.put(CAT_COMBAT,
+ Utils.createList("ZOMBIE", "SKELETON", "SPIDER", "CAVESPIDER", "CREEPER", "ENDERMAN",
+ "GHAST", "SLIME", "BLAZE", "MAGMA_CUBE"));
+ collectionCatToMinionMap.put(CAT_FORAGING,
+ Utils.createList("OAK", "SPRUCE", "BIRCH", "DARK_OAK", "ACACIA", "JUNGLE"));
+ collectionCatToMinionMap.put(CAT_FISHING,
+ Utils.createList("FISHING", null, null, null, null,
+ null, "CLAY", null, null, null));
+ }
+
+ private static final LinkedHashMap<String, ItemStack> collectionToCollectionDisplayMap = new LinkedHashMap<>();
+ static {
+ /** FARMING COLLECTIONS **/
+ collectionToCollectionDisplayMap.put("WHEAT", Utils.createItemStack(Items.wheat,
+ EnumChatFormatting.YELLOW+"Wheat"));
+ collectionToCollectionDisplayMap.put("CARROT_ITEM", Utils.createItemStack(Items.carrot,
+ EnumChatFormatting.YELLOW+"Carrot"));
+ collectionToCollectionDisplayMap.put("POTATO_ITEM", Utils.createItemStack(Items.potato,
+ EnumChatFormatting.YELLOW+"Potato"));
+ collectionToCollectionDisplayMap.put("PUMPKIN", Utils.createItemStack(Item.getItemFromBlock(Blocks.pumpkin),
+ EnumChatFormatting.YELLOW+"Pumpkin"));
+ collectionToCollectionDisplayMap.put("MELON", Utils.createItemStack(Items.melon,
+ EnumChatFormatting.YELLOW+"Melon"));
+ collectionToCollectionDisplayMap.put("SEEDS", Utils.createItemStack(Items.wheat_seeds,
+ EnumChatFormatting.YELLOW+"Seeds"));
+ collectionToCollectionDisplayMap.put("MUSHROOM_COLLECTION",
+ Utils.createItemStack(Item.getItemFromBlock(Blocks.red_mushroom)
+ , EnumChatFormatting.YELLOW+"Mushroom"));
+ collectionToCollectionDisplayMap.put("INK_SACK:3", Utils.createItemStack(Items.dye,
+ EnumChatFormatting.YELLOW+"Cocoa Beans", 3));
+ collectionToCollectionDisplayMap.put("CACTUS", Utils.createItemStack(Item.getItemFromBlock(Blocks.cactus),
+ EnumChatFormatting.YELLOW+"Cactus"));
+ collectionToCollectionDisplayMap.put("SUGAR_CANE", Utils.createItemStack(Items.reeds,
+ EnumChatFormatting.YELLOW+"Sugar Cane"));
+ collectionToCollectionDisplayMap.put("FEATHER", Utils.createItemStack(Items.feather,
+ EnumChatFormatting.YELLOW+"Feather"));
+ collectionToCollectionDisplayMap.put("LEATHER", Utils.createItemStack(Items.leather,
+ EnumChatFormatting.YELLOW+"Leather"));
+ collectionToCollectionDisplayMap.put("PORK", Utils.createItemStack(Items.porkchop,
+ EnumChatFormatting.YELLOW+"Porkchop"));
+ collectionToCollectionDisplayMap.put("RAW_CHICKEN", Utils.createItemStack(Items.chicken,
+ EnumChatFormatting.YELLOW+"Chicken"));
+ collectionToCollectionDisplayMap.put("MUTTON", Utils.createItemStack(Items.mutton,
+ EnumChatFormatting.YELLOW+"Mutton"));
+ collectionToCollectionDisplayMap.put("RABBIT", Utils.createItemStack(Items.rabbit,
+ EnumChatFormatting.YELLOW+"Rabbit"));
+ collectionToCollectionDisplayMap.put("NETHER_STALK", Utils.createItemStack(Items.nether_wart,
+ EnumChatFormatting.YELLOW+"Nether Wart"));
+
+ /** MINING COLLECTIONS **/
+ collectionToCollectionDisplayMap.put("COBBLESTONE", Utils.createItemStack(Item.getItemFromBlock(Blocks.cobblestone),
+ EnumChatFormatting.GRAY+"Cobblestone"));
+ collectionToCollectionDisplayMap.put("COAL", Utils.createItemStack(Items.coal,
+ EnumChatFormatting.GRAY+"Coal"));
+ collectionToCollectionDisplayMap.put("IRON_INGOT", Utils.createItemStack(Items.iron_ingot,
+ EnumChatFormatting.GRAY+"Iron Ingot"));
+ collectionToCollectionDisplayMap.put("GOLD_INGOT", Utils.createItemStack(Items.gold_ingot,
+ EnumChatFormatting.GRAY+"Gold Ingot"));
+ collectionToCollectionDisplayMap.put("DIAMOND", Utils.createItemStack(Items.diamond,
+ EnumChatFormatting.GRAY+"Diamond"));
+ collectionToCollectionDisplayMap.put("INK_SACK:4", Utils.createItemStack(Items.dye,
+ EnumChatFormatting.GRAY+"Lapis Lazuli", 4));
+ collectionToCollectionDisplayMap.put("EMERALD", Utils.createItemStack(Items.emerald,
+ EnumChatFormatting.GRAY+"Emerald"));
+ collectionToCollectionDisplayMap.put("REDSTONE", Utils.createItemStack(Items.redstone,
+ EnumChatFormatting.GRAY+"Redstone"));
+ collectionToCollectionDisplayMap.put("QUARTZ", Utils.createItemStack(Items.quartz,
+ EnumChatFormatting.GRAY+"Nether Quartz"));
+ collectionToCollectionDisplayMap.put("OBSIDIAN", Utils.createItemStack(Item.getItemFromBlock(Blocks.obsidian),
+ EnumChatFormatting.GRAY+"Obsidian"));
+ collectionToCollectionDisplayMap.put("GLOWSTONE_DUST", Utils.createItemStack(Items.glowstone_dust,
+ EnumChatFormatting.GRAY+"Glowstone"));
+ collectionToCollectionDisplayMap.put("GRAVEL", Utils.createItemStack(Item.getItemFromBlock(Blocks.gravel),
+ EnumChatFormatting.GRAY+"Gravel"));
+ collectionToCollectionDisplayMap.put("ICE", Utils.createItemStack(Item.getItemFromBlock(Blocks.ice),
+ EnumChatFormatting.GRAY+"Ice"));
+ collectionToCollectionDisplayMap.put("NETHERRACK", Utils.createItemStack(Item.getItemFromBlock(Blocks.netherrack),
+ EnumChatFormatting.GRAY+"Netherrack"));
+ collectionToCollectionDisplayMap.put("SAND", Utils.createItemStack(Item.getItemFromBlock(Blocks.sand),
+ EnumChatFormatting.GRAY+"Sand"));
+ collectionToCollectionDisplayMap.put("ENDER_STONE", Utils.createItemStack(Item.getItemFromBlock(Blocks.end_stone),
+ EnumChatFormatting.GRAY+"End Stone"));
+ collectionToCollectionDisplayMap.put("MITHRIL_ORE", Utils.createItemStack(Items.prismarine_crystals,
+ EnumChatFormatting.GRAY+"Mithril"));
+ collectionToCollectionDisplayMap.put("HARD_STONE", Utils.createItemStack(Item.getItemFromBlock(Blocks.stone),
+ EnumChatFormatting.GRAY+"Hard Stone"));
+ ItemStack gemstone = Utils.createItemStack(Item.getItemFromBlock(Blocks.stained_glass),
+ EnumChatFormatting.GRAY+"Gem Stones");
+ gemstone.setItemDamage(14);
+ collectionToCollectionDisplayMap.put("GEMSTONE_COLLECTION", gemstone);
+
+
+ /** COMBAT COLLECTIONS **/
+ collectionToCollectionDisplayMap.put("ROTTEN_FLESH", Utils.createItemStack(Items.rotten_flesh,
+ EnumChatFormatting.RED+"Rotten Flesh"));
+ collectionToCollectionDisplayMap.put("BONE", Utils.createItemStack(Items.bone,
+ EnumChatFormatting.RED+"Bone"));
+ collectionToCollectionDisplayMap.put("STRING", Utils.createItemStack(Items.string,
+ EnumChatFormatting.RED+"String"));
+ collectionToCollectionDisplayMap.put("SPIDER_EYE", Utils.createItemStack(Items.spider_eye,
+ EnumChatFormatting.RED+"Spider Eye"));
+ collectionToCollectionDisplayMap.put("SULPHUR", Utils.createItemStack(Items.gunpowder,
+ EnumChatFormatting.RED+"Gunpowder"));
+ collectionToCollectionDisplayMap.put("ENDER_PEARL", Utils.createItemStack(Items.ender_pearl,
+ EnumChatFormatting.RED+"Ender Pearl"));
+ collectionToCollectionDisplayMap.put("GHAST_TEAR", Utils.createItemStack(Items.ghast_tear,
+ EnumChatFormatting.RED+"Ghast Tear"));
+ collectionToCollectionDisplayMap.put("SLIME_BALL", Utils.createItemStack(Items.slime_ball,
+ EnumChatFormatting.RED+"Slimeball"));
+ collectionToCollectionDisplayMap.put("BLAZE_ROD", Utils.createItemStack(Items.blaze_rod,
+ EnumChatFormatting.RED+"Blaze Rod"));
+ collectionToCollectionDisplayMap.put("MAGMA_CREAM", Utils.createItemStack(Items.magma_cream,
+ EnumChatFormatting.RED+"Magma Cream"));
+
+ /** FORAGING COLLECTIONS **/
+ collectionToCollectionDisplayMap.put("LOG", Utils.createItemStack(Item.getItemFromBlock(Blocks.log),
+ EnumChatFormatting.DARK_GREEN+"Oak"));
+ collectionToCollectionDisplayMap.put("LOG:1", Utils.createItemStack(Item.getItemFromBlock(Blocks.log),
+ EnumChatFormatting.DARK_GREEN+"Spruce", 1));
+ collectionToCollectionDisplayMap.put("LOG:2", Utils.createItemStack(Item.getItemFromBlock(Blocks.log),
+ EnumChatFormatting.DARK_GREEN+"Birch", 2));
+ collectionToCollectionDisplayMap.put("LOG_2:1", Utils.createItemStack(Item.getItemFromBlock(Blocks.log2),
+ EnumChatFormatting.DARK_GREEN+"Dark Oak", 1));
+ collectionToCollectionDisplayMap.put("LOG_2", Utils.createItemStack(Item.getItemFromBlock(Blocks.log2),
+ EnumChatFormatting.DARK_GREEN+"Acacia"));
+ collectionToCollectionDisplayMap.put("LOG:3", Utils.createItemStack(Item.getItemFromBlock(Blocks.log),
+ EnumChatFormatting.DARK_GREEN+"Jungle", 3));
+
+ /** FISHING COLLECTIONS **/
+ collectionToCollectionDisplayMap.put("RAW_FISH", Utils.createItemStack(Items.fish,
+ EnumChatFormatting.AQUA+"Fish"));
+ collectionToCollectionDisplayMap.put("RAW_FISH:1", Utils.createItemStack(Items.fish,
+ EnumChatFormatting.AQUA+"Salmon", 1));
+ collectionToCollectionDisplayMap.put("RAW_FISH:2", Utils.createItemStack(Items.fish,
+ EnumChatFormatting.AQUA+"Clownfish", 2));
+ collectionToCollectionDisplayMap.put("RAW_FISH:3", Utils.createItemStack(Items.fish,
+ EnumChatFormatting.AQUA+"Pufferfish", 3));
+ collectionToCollectionDisplayMap.put("PRISMARINE_SHARD", Utils.createItemStack(Items.prismarine_shard,
+ EnumChatFormatting.AQUA+"Prismarine Shard"));
+ collectionToCollectionDisplayMap.put("PRISMARINE_CRYSTALS", Utils.createItemStack(Items.prismarine_crystals,
+ EnumChatFormatting.AQUA+"Prismarine Crystals"));
+ collectionToCollectionDisplayMap.put("CLAY_BALL", Utils.createItemStack(Items.clay_ball,
+ EnumChatFormatting.AQUA+"Clay"));
+ collectionToCollectionDisplayMap.put("WATER_LILY", Utils.createItemStack(Item.getItemFromBlock(Blocks.waterlily),
+ EnumChatFormatting.AQUA+"Lilypad"));
+ collectionToCollectionDisplayMap.put("INK_SACK", Utils.createItemStack(Items.dye,
+ EnumChatFormatting.AQUA+"Ink Sack"));
+ collectionToCollectionDisplayMap.put("SPONGE", Utils.createItemStack(Item.getItemFromBlock(Blocks.sponge),
+ EnumChatFormatting.AQUA+"Sponge"));
+ }
+
+ public static LinkedHashMap<ItemStack, List<String>> getCollectionCatToMinionMap() {
+ return collectionCatToMinionMap;
+ }
+
+ public static LinkedHashMap<String, ItemStack> getCollectionToCollectionDisplayMap() {
+ return collectionToCollectionDisplayMap;
+ }
+
+ public static LinkedHashMap<ItemStack, List<String>> getCollectionCatToCollectionMap() {
+ return collectionCatToCollectionMap;
+ }
+
+ public static Map<String, ItemStack> getSkillToSkillDisplayMap() {
+ return Collections.unmodifiableMap(skillToSkillDisplayMap);
+ }
+
+ public static class Level {
+ public float level = 0;
+ public float maxXpForLevel = 0;
+ public boolean maxed = false;
+ }
+
+ public static Level getLevel(JsonArray levelingArray, float xp, int levelCap, boolean cumulative) {
+ Level levelObj = new Level();
+ for(int level=0; level<levelingArray.size(); level++) {
+ float levelXp = levelingArray.get(level).getAsFloat();
+ if(levelXp > xp) {
+ if(cumulative) {
+ float previous = 0;
+ if(level > 0) previous = levelingArray.get(level-1).getAsFloat();
+ levelObj.maxXpForLevel = (levelXp-previous);
+ levelObj.level = 1 + level + (xp-levelXp)/levelObj.maxXpForLevel;
+ } else {
+ levelObj.maxXpForLevel = levelXp;
+ levelObj.level = level + xp/levelXp;
+ }
+ if(levelObj.level > levelCap) {
+ levelObj.level = levelCap;
+ levelObj.maxed = true;
+ }
+ return levelObj;
+ } else {
+ if(!cumulative) xp -= levelXp;
+ }
+ }
+ levelObj.level = levelingArray.size();
+ if(levelObj.level > levelCap) {
+ levelObj.level = levelCap;
+ }
+ levelObj.maxed = true;
+ return levelObj;
+ }
+
+ public class Profile {
+ private final String uuid;
+ private String latestProfile = null;
+
+ private JsonArray playerInformation = null;
+ private JsonObject basicInfo = null;
+
+ private final HashMap<String, JsonObject> profileMap = new HashMap<>();
+ private final HashMap<String, JsonObject> petsInfoMap = new HashMap<>();
+ private final HashMap<String, List<JsonObject>> coopProfileMap = new HashMap<>();
+ private final HashMap<String, JsonObject> skillInfoMap = new HashMap<>();
+ private final HashMap<String, JsonObject> inventoryInfoMap = new HashMap<>();
+ private final HashMap<String, JsonObject> collectionInfoMap = new HashMap<>();
+ private List<String> profileIds = new ArrayList<>();
+ private JsonObject playerStatus = null;
+ private HashMap<String, PlayerStats.Stats> stats = new HashMap<>();
+ private HashMap<String, PlayerStats.Stats> passiveStats = new HashMap<>();
+ private HashMap<String, Long> networth = new HashMap<>();
+
+ public Profile(String uuid) {
+ this.uuid = uuid;
+ }
+
+ private AtomicBoolean updatingPlayerInfoState = new AtomicBoolean(false);
+ private long lastPlayerInfoState = 0;
+ private AtomicBoolean updatingPlayerStatusState = new AtomicBoolean(false);
+
+ public JsonObject getPlayerStatus() {
+ if(playerStatus != null) return playerStatus;
+ if(updatingPlayerStatusState.get()) return null;
+
+ updatingPlayerStatusState.set(true);
+
+ HashMap<String, String> args = new HashMap<>();
+ args.put("uuid", ""+uuid);
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "status",
+ args, jsonObject -> {
+ if(jsonObject == null) return;
+
+ updatingPlayerStatusState.set(false);
+ if(jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) {
+ playerStatus = jsonObject.get("session").getAsJsonObject();
+ }
+ }, () -> updatingPlayerStatusState.set(false)
+ );
+
+ return null;
+ }
+
+ public long getNetWorth(String profileId) {
+ if(profileId == null) profileId = latestProfile;
+ if(networth.get(profileId) != null) return networth.get(profileId);
+ if(getProfileInformation(profileId) == null) return -1;
+ if(getInventoryInfo(profileId) == null) return -1;
+
+ JsonObject inventoryInfo = getInventoryInfo(profileId);
+ JsonObject profileInfo = getProfileInformation(profileId);
+
+ HashMap<String, Long> mostExpensiveInternal = new HashMap<>();
+
+ long networth = 0;
+ for(Map.Entry<String, JsonElement> entry : inventoryInfo.entrySet()) {
+ if(entry.getValue().isJsonArray()) {
+ for(JsonElement element : entry.getValue().getAsJsonArray()) {
+ if(element != null && element.isJsonObject()) {
+ JsonObject item = element.getAsJsonObject();
+ String internalname = item.get("internalname").getAsString();
+
+ if(manager.auctionManager.isVanillaItem(internalname)) continue;
+
+ JsonObject bzInfo = manager.auctionManager.getBazaarInfo(internalname);
+
+ int auctionPrice;
+ if(bzInfo != null && bzInfo.has("curr_sell")) {
+ auctionPrice = (int)bzInfo.get("curr_sell").getAsFloat();
+ } else {
+ auctionPrice = (int)manager.auctionManager.getItemAvgBin(internalname);
+ if(auctionPrice <= 0) {
+ auctionPrice = manager.auctionManager.getLowestBin(internalname);
+ }
+ }
+
+ try {
+ if(item.has("item_contents")) {
+ JsonArray bytesArr = item.get("item_contents").getAsJsonArray();
+ byte[] bytes = new byte[bytesArr.size()];
+ for (int bytesArrI = 0; bytesArrI < bytesArr.size(); bytesArrI++) {
+ bytes[bytesArrI] = bytesArr.get(bytesArrI).getAsByte();
+ }
+ NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
+ NBTTagList items = contents_nbt.getTagList("i", 10);
+ for(int j=0; j<items.tagCount(); j++) {
+ if(items.getCompoundTagAt(j).getKeySet().size() > 0) {
+ NBTTagCompound nbt = items.getCompoundTagAt(j).getCompoundTag("tag");
+ String internalname2 = manager.getInternalnameFromNBT(nbt);
+ if(internalname2 != null) {
+ if(manager.auctionManager.isVanillaItem(internalname2)) continue;
+
+ JsonObject bzInfo2 = manager.auctionManager.getBazaarInfo(internalname2);
+
+ int auctionPrice2;
+ if(bzInfo2 != null && bzInfo2.has("curr_sell")) {
+ auctionPrice2 = (int)bzInfo2.get("curr_sell").getAsFloat();
+ } else {
+ auctionPrice2 = (int)manager.auctionManager.getItemAvgBin(internalname2);
+ if(auctionPrice2 <= 0) {
+ auctionPrice2 = manager.auctionManager.getLowestBin(internalname2);
+ }
+ }
+
+ int count2 = items.getCompoundTagAt(j).getByte("Count");
+
+ mostExpensiveInternal.put(internalname2, auctionPrice2 * count2 + mostExpensiveInternal.getOrDefault(internalname2, 0L));
+ networth += auctionPrice2 * count2;
+ }
+ }
+ }
+ }
+ } catch(IOException ignored) {}
+
+ int count = 1;
+ if(element.getAsJsonObject().has("count")) {
+ count = element.getAsJsonObject().get("count").getAsInt();
+ }
+ mostExpensiveInternal.put(internalname, auctionPrice * count + mostExpensiveInternal.getOrDefault(internalname, 0L));
+ networth += auctionPrice * count;
+ }
+ }
+ }
+ }
+ if(networth == 0) return -1;
+
+ //System.out.println(profileId);
+ for(Map.Entry<String, Long> entry : mostExpensiveInternal.entrySet()) {
+ //System.out.println(entry.getKey() + ":" + entry.getValue());
+ }
+
+ networth = (int)(networth*1.3f);
+
+ JsonObject petsInfo = getPetsInfo(profileId);
+ if(petsInfo != null && petsInfo.has("pets")) {
+ if(petsInfo.get("pets").isJsonArray()) {
+ JsonArray pets = petsInfo.get("pets").getAsJsonArray();
+ for(JsonElement element : pets) {
+ if(element.isJsonObject()) {
+ JsonObject pet = element.getAsJsonObject();
+
+ String petname = pet.get("type").getAsString();
+ String tier = pet.get("tier").getAsString();
+ String tierNum = petRarityToNumMap.get(tier);
+ if(tierNum != null) {
+ String internalname2 = petname+";"+tierNum;
+ JsonObject info2 = manager.auctionManager.getItemAuctionInfo(internalname2);
+ if(info2 == null || !info2.has("price") || !info2.has("count")) continue;
+ int auctionPrice2 = (int)(info2.get("price").getAsFloat() / info2.get("count").getAsFloat());
+
+ networth += auctionPrice2;
+ }
+ }
+ }
+ }
+ }
+
+ float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0);
+ float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
+
+ networth += bankBalance+purseBalance;
+
+ this.networth.put(profileId, networth);
+ return networth;
+ }
+
+ public String getLatestProfile() {
+ return latestProfile;
+ }
+
+ public JsonArray getPlayerInformation(Runnable runnable) {
+ if (playerInformation != null) return playerInformation;
+
+ long currentTime = System.currentTimeMillis();
+
+ if (currentTime - lastPlayerInfoState < 15*1000 && updatingPlayerInfoState.get()) return null;
+
+ lastPlayerInfoState = currentTime;
+ updatingPlayerInfoState.set(true);
+
+ HashMap<String, String> args = new HashMap<>();
+ args.put("uuid", "" + uuid);
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/profiles",
+ args, jsonObject -> {
+ updatingPlayerInfoState.set(false);
+
+ if (jsonObject == null) return;
+ if (jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) {
+ playerInformation = jsonObject.get("profiles").getAsJsonArray();
+ if (playerInformation == null) return;
+ String backup = null;
+ long backupLastSave = 0;
+
+ profileIds.clear();
+
+ for (int i = 0; i < playerInformation.size(); i++) {
+ JsonObject profile = playerInformation.get(i).getAsJsonObject();
+
+ if (!profile.has("members")) continue;
+ JsonObject members = profile.get("members").getAsJsonObject();
+
+ if (members.has(uuid)) {
+ JsonObject member = members.get(uuid).getAsJsonObject();
+
+ if(member.has("coop_invitation")) {
+ JsonObject coop_invitation = member.get("coop_invitation").getAsJsonObject();
+ if(!coop_invitation.get("confirmed").getAsBoolean()) {
+ continue;
+ }
+ }
+
+ String cute_name = profile.get("cute_name").getAsString();
+ if (backup == null) backup = cute_name;
+ profileIds.add(cute_name);
+ if (member.has("last_save")) {
+ long last_save = member.get("last_save").getAsLong();
+ if (last_save > backupLastSave) {
+ backupLastSave = last_save;
+ backup = cute_name;
+ }
+ }
+
+ }
+ }
+ latestProfile = backup;
+ if (runnable != null) runnable.run();
+ }
+ }, () -> {
+ updatingPlayerInfoState.set(false);
+ }
+ );
+
+ return null;
+ }
+
+ public List<String> getProfileIds() {
+ return profileIds;
+ }
+
+ public JsonObject getProfileInformation(String profileId) {
+ JsonArray playerInfo = getPlayerInformation(() -> {});
+ if(playerInfo == null) return null;
+ if(profileId == null) profileId = latestProfile;
+ if(profileMap.containsKey(profileId)) return profileMap.get(profileId);
+
+ for(int i=0; i<playerInformation.size(); i++) {
+ if(!playerInformation.get(i).isJsonObject()) {
+ playerInformation = null;
+ return null;
+ }
+ JsonObject profile = playerInformation.get(i).getAsJsonObject();
+ if(profile.get("cute_name").getAsString().equalsIgnoreCase(profileId)) {
+ if(!profile.has("members")) return null;
+ JsonObject members = profile.get("members").getAsJsonObject();
+ if(!members.has(uuid)) continue;
+ JsonObject profileInfo = members.get(uuid).getAsJsonObject();
+ if(profile.has("banking")) {
+ profileInfo.add("banking", profile.get("banking").getAsJsonObject());
+ }
+ profileMap.put(profileId, profileInfo);
+ return profileInfo;
+ }
+ }
+
+ return null;
+ }
+
+ public List<JsonObject> getCoopProfileInformation(String profileId) {
+ JsonArray playerInfo = getPlayerInformation(() -> {});
+ if(playerInfo == null) return null;
+ if(profileId == null) profileId = latestProfile;
+ if(coopProfileMap.containsKey(profileId)) return coopProfileMap.get(profileId);
+
+ for(int i=0; i<playerInformation.size(); i++) {
+ if(!playerInformation.get(i).isJsonObject()) {
+ playerInformation = null;
+ return null;
+ }
+ JsonObject profile = playerInformation.get(i).getAsJsonObject();
+ if(profile.get("cute_name").getAsString().equalsIgnoreCase(profileId)) {
+ if(!profile.has("members")) return null;
+ JsonObject members = profile.get("members").getAsJsonObject();
+ if(!members.has(uuid)) return null;
+ List<JsonObject> coopList = new ArrayList<>();
+ for(Map.Entry<String, JsonElement> islandMember : members.entrySet()) {
+ if(!islandMember.getKey().equals(uuid)) {
+ JsonObject coopProfileInfo = islandMember.getValue().getAsJsonObject();
+ coopList.add(coopProfileInfo);
+ }
+ }
+ coopProfileMap.put(profileId, coopList);
+ return coopList;
+ }
+ }
+
+ return null;
+ }
+
+ public void resetCache() {
+ playerInformation = null;
+ basicInfo = null;
+ playerStatus = null;
+ stats.clear();
+ passiveStats.clear();
+ profileIds.clear();
+ profileMap.clear();
+ coopProfileMap.clear();
+ petsInfoMap.clear();
+ skillInfoMap.clear();
+ inventoryInfoMap.clear();
+ collectionInfoMap.clear();
+ networth.clear();
+ }
+
+ public int getCap(JsonObject leveling, String skillName) {
+ JsonElement capsElement = Utils.getElement(leveling, "leveling_caps");
+ if(capsElement == null || !capsElement.isJsonObject()) {
+ return 50;
+ }
+ JsonObject caps = capsElement.getAsJsonObject();
+ if(caps.has(skillName)) {
+ return caps.get(skillName).getAsInt();
+ }
+ return 50;
+ }
+
+ public JsonObject getSkillInfo(String profileId) {
+ JsonObject profileInfo = getProfileInformation(profileId);
+ if(profileInfo == null) return null;
+ if(profileId == null) profileId = latestProfile;
+ if(skillInfoMap.containsKey(profileId)) return skillInfoMap.get(profileId);
+ JsonObject leveling = Constants.LEVELING;
+ if(leveling == null) return null;
+
+ float experience_skill_taming = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_taming"), 0);
+ float experience_skill_mining = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_mining"), 0);
+ float experience_skill_foraging = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_foraging"), 0);
+ float experience_skill_enchanting = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_enchanting"), 0);
+ float experience_skill_carpentry = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_carpentry"), 0);
+ float experience_skill_farming = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_farming"), 0);
+ float experience_skill_combat = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_combat"), 0);
+ float experience_skill_fishing = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_fishing"), 0);
+ float experience_skill_alchemy = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_alchemy"), 0);
+ float experience_skill_runecrafting = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_runecrafting"), 0);
+
+ float experience_skill_catacombs = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.experience"), 0);
+
+ float experience_slayer_zombie = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.xp"), 0);
+ float experience_slayer_spider = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.xp"), 0);
+ float experience_slayer_wolf = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.xp"), 0);
+ float experience_slayer_enderman = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.enderman.xp"), 0);
+
+
+ float totalSkillXP = experience_skill_taming + experience_skill_mining + experience_skill_foraging
+ + experience_skill_enchanting + experience_skill_carpentry + experience_skill_farming
+ + experience_skill_combat + experience_skill_fishing + experience_skill_alchemy
+ + experience_skill_runecrafting;
+
+ if(totalSkillXP <= 0) {
+ return null;
+ }
+
+ JsonObject skillInfo = new JsonObject();
+
+ skillInfo.addProperty("experience_skill_taming", experience_skill_taming);
+ skillInfo.addProperty("experience_skill_mining", experience_skill_mining);
+ skillInfo.addProperty("experience_skill_foraging", experience_skill_foraging);
+ skillInfo.addProperty("experience_skill_enchanting", experience_skill_enchanting);
+ skillInfo.addProperty("experience_skill_carpentry", experience_skill_carpentry);
+ skillInfo.addProperty("experience_skill_farming", experience_skill_farming);
+ skillInfo.addProperty("experience_skill_combat", experience_skill_combat);
+ skillInfo.addProperty("experience_skill_fishing", experience_skill_fishing);
+ skillInfo.addProperty("experience_skill_alchemy", experience_skill_alchemy);
+ skillInfo.addProperty("experience_skill_runecrafting", experience_skill_runecrafting);
+
+ skillInfo.addProperty("experience_skill_catacombs", experience_skill_catacombs);
+
+ skillInfo.addProperty("experience_slayer_zombie", experience_slayer_zombie);
+ skillInfo.addProperty("experience_slayer_spider", experience_slayer_spider);
+ skillInfo.addProperty("experience_slayer_wolf", experience_slayer_wolf);
+ skillInfo.addProperty("experience_slayer_enderman", experience_slayer_enderman);
+
+ JsonArray levelingArray = Utils.getElement(leveling, "leveling_xp").getAsJsonArray();
+ int farmingCap = getCap(leveling, "farming") + (int)Utils.getElementAsFloat(
+ Utils.getElement(profileInfo, "jacob2.perks.farming_level_cap"), 0);
+ Level level_skill_taming = getLevel(levelingArray, experience_skill_taming, getCap(leveling, "taming"), false);
+ Level level_skill_mining = getLevel(levelingArray, experience_skill_mining, getCap(leveling, "mining"), false);
+ Level level_skill_foraging = getLevel(levelingArray, experience_skill_foraging, getCap(leveling, "foraging"), false);
+ Level level_skill_enchanting = getLevel(levelingArray, experience_skill_enchanting, getCap(leveling, "enchanting"), false);
+ Level level_skill_carpentry = getLevel(levelingArray, experience_skill_carpentry,getCap(leveling, "carpentry"), false);
+ Level level_skill_farming = getLevel(levelingArray, experience_skill_farming, farmingCap, false);
+ Level level_skill_combat = getLevel(levelingArray, experience_skill_combat, getCap(leveling, "combat"), false);
+ Level level_skill_fishing = getLevel(levelingArray, experience_skill_fishing, getCap(leveling, "fishing"), false);
+ Level level_skill_alchemy = getLevel(levelingArray, experience_skill_alchemy, getCap(leveling, "alchemy"), false);
+ Level level_skill_runecrafting = getLevel(Utils.getElement(leveling, "runecrafting_xp").getAsJsonArray(),
+ experience_skill_runecrafting, getCap(leveling, "runecrafting"), false);
+
+ Level level_skill_catacombs = getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(),
+ experience_skill_catacombs, getCap(leveling, "catacombs"), false);
+
+ Level level_slayer_zombie = getLevel(Utils.getElement(leveling, "slayer_xp.zombie").getAsJsonArray(),
+ experience_slayer_zombie, 9,true);
+ Level level_slayer_spider = getLevel(Utils.getElement(leveling, "slayer_xp.spider").getAsJsonArray(),
+ experience_slayer_spider, 9,true);
+ Level level_slayer_wolf = getLevel(Utils.getElement(leveling, "slayer_xp.wolf").getAsJsonArray(),
+ experience_slayer_wolf, 9,true);
+ Level level_slayer_enderman = getLevel(Utils.getElement(leveling, "slayer_xp.enderman").getAsJsonArray(),
+ experience_slayer_enderman, 9,true);
+
+ skillInfo.addProperty("level_skill_taming", level_skill_taming.level);
+ skillInfo.addProperty("level_skill_mining", level_skill_mining.level);
+ skillInfo.addProperty("level_skill_foraging", level_skill_foraging.level);
+ skillInfo.addProperty("level_skill_enchanting", level_skill_enchanting.level);
+ skillInfo.addProperty("level_skill_carpentry", level_skill_carpentry.level);
+ skillInfo.addProperty("level_skill_farming", level_skill_farming.level);
+ skillInfo.addProperty("level_skill_combat", level_skill_combat.level);
+ skillInfo.addProperty("level_skill_fishing", level_skill_fishing.level);
+ skillInfo.addProperty("level_skill_alchemy", level_skill_alchemy.level);
+ skillInfo.addProperty("level_skill_runecrafting", level_skill_runecrafting.level);
+
+ skillInfo.addProperty("level_skill_catacombs", level_skill_catacombs.level);
+
+ skillInfo.addProperty("level_slayer_zombie", level_slayer_zombie.level);
+ skillInfo.addProperty("level_slayer_spider", level_slayer_spider.level);
+ skillInfo.addProperty("level_slayer_wolf", level_slayer_wolf.level);
+ skillInfo.addProperty("level_slayer_enderman", level_slayer_enderman.level);
+
+ skillInfo.addProperty("maxed_skill_taming", level_skill_taming.maxed);
+ skillInfo.addProperty("maxed_skill_mining", level_skill_mining.maxed);
+ skillInfo.addProperty("maxed_skill_foraging", level_skill_foraging.maxed);
+ skillInfo.addProperty("maxed_skill_enchanting", level_skill_enchanting.maxed);
+ skillInfo.addProperty("maxed_skill_carpentry", level_skill_carpentry.maxed);
+ skillInfo.addProperty("maxed_skill_farming", level_skill_farming.maxed);
+ skillInfo.addProperty("maxed_skill_combat", level_skill_combat.maxed);
+ skillInfo.addProperty("maxed_skill_fishing", level_skill_fishing.maxed);
+ skillInfo.addProperty("maxed_skill_alchemy", level_skill_alchemy.maxed);
+ skillInfo.addProperty("maxed_skill_runecrafting", level_skill_runecrafting.maxed);
+
+ skillInfo.addProperty("maxed_skill_catacombs", level_skill_catacombs.maxed);
+
+ skillInfo.addProperty("maxed_slayer_zombie", level_slayer_zombie.maxed);
+ skillInfo.addProperty("maxed_slayer_spider", level_slayer_spider.maxed);
+ skillInfo.addProperty("maxed_slayer_wolf", level_slayer_wolf.maxed);
+ skillInfo.addProperty("maxed_slayer_enderman", level_slayer_enderman.maxed);
+
+ skillInfo.addProperty("maxxp_skill_taming", level_skill_taming.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_mining", level_skill_mining.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_foraging", level_skill_foraging.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_enchanting", level_skill_enchanting.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_carpentry", level_skill_carpentry.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_farming", level_skill_farming.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_combat", level_skill_combat.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_fishing", level_skill_fishing.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_alchemy", level_skill_alchemy.maxXpForLevel);
+ skillInfo.addProperty("maxxp_skill_runecrafting", level_skill_runecrafting.maxXpForLevel);
+
+ skillInfo.addProperty("maxxp_skill_catacombs", level_skill_catacombs.maxXpForLevel);
+
+ skillInfo.addProperty("maxxp_slayer_zombie", level_slayer_zombie.maxXpForLevel);
+ skillInfo.addProperty("maxxp_slayer_spider", level_slayer_spider.maxXpForLevel);
+ skillInfo.addProperty("maxxp_slayer_wolf", level_slayer_wolf.maxXpForLevel);
+ skillInfo.addProperty("maxxp_slayer_enderman", level_slayer_enderman.maxXpForLevel);
+
+ return skillInfo;
+ }
+
+ public JsonObject getInventoryInfo(String profileId) {
+ JsonObject profileInfo = getProfileInformation(profileId);
+ if(profileInfo == null) return null;
+ if(profileId == null) profileId = latestProfile;
+ if(inventoryInfoMap.containsKey(profileId)) return inventoryInfoMap.get(profileId);
+
+ String inv_armor_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "inv_armor.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String fishing_bag_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "fishing_bag.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String quiver_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "quiver.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String ender_chest_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "ender_chest_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ //Todo clean this up
+ //Fake string is so for I loop works the same
+ String backpack_contents_json_fake = "fake should fix later";
+ JsonObject backpack_contents_json = (JsonObject) Utils.getElement(profileInfo, "backpack_contents");
+ JsonObject backpack_icons = (JsonObject) Utils.getElement(profileInfo, "backpack_icons");
+ String personal_vault_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "personal_vault_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String wardrobe_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "wardrobe_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String potion_bag_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "potion_bag.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String inv_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "inv_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String talisman_bag_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "talisman_bag.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ String candy_inventory_contents_bytes = Utils.getElementAsString(Utils.getElement(profileInfo, "candy_inventory_contents.data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+
+ JsonObject inventoryInfo = new JsonObject();
+
+ String[] inv_names = new String[]{"inv_armor", "fishing_bag", "quiver", "ender_chest_contents", "backpack_contents", "personal_vault_contents", "wardrobe_contents",
+ "potion_bag", "inv_contents", "talisman_bag", "candy_inventory_contents"};
+ String[] inv_bytes = new String[]{inv_armor_bytes, fishing_bag_bytes, quiver_bytes, ender_chest_contents_bytes, backpack_contents_json_fake, personal_vault_contents_bytes, wardrobe_contents_bytes,
+ potion_bag_bytes, inv_contents_bytes, talisman_bag_bytes, candy_inventory_contents_bytes};
+ for(int i=0; i<inv_bytes.length; i++) {
+ try {
+ String bytes = inv_bytes[i];
+
+ JsonArray contents = new JsonArray();
+
+ if(inv_names[i].equals("backpack_contents")){
+ JsonObject temp = getBackpackData(backpack_contents_json, backpack_icons);
+ contents = (JsonArray) temp.get("contents");
+ inventoryInfo.add("backpack_sizes", temp.get("backpack_sizes"));
+
+ } else {
+
+ NBTTagCompound inv_contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(Base64.getDecoder().decode(bytes)));
+ NBTTagList items = inv_contents_nbt.getTagList("i", 10);
+ for (int j = 0; j < items.tagCount(); j++) {
+ JsonObject item = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
+ contents.add(item);
+ }
+ }
+ inventoryInfo.add(inv_names[i], contents);
+ } catch(IOException e) {
+ inventoryInfo.add(inv_names[i], new JsonArray());
+ }
+ }
+
+ inventoryInfoMap.put(profileId, inventoryInfo);
+
+ return inventoryInfo;
+ }
+
+ public boolean checkIfValidJson(JsonElement element){
+ return element != null;
+ }
+
+ public JsonObject getBackpackData(JsonObject backpack_contents_json, JsonObject backpack_icons) {
+
+ JsonArray contents = new JsonArray();
+ if(!(checkIfValidJson(backpack_contents_json) && checkIfValidJson(backpack_icons))){
+ JsonObject bundledReturn = new JsonObject();
+ bundledReturn.add("contents", new JsonArray());
+ bundledReturn.add("backpack_sizes", new JsonArray());
+
+ return bundledReturn;
+ }
+
+ String[] backpackArray = new String[0];
+
+ //Create backpack array which sizes up
+ for(Map.Entry<String, JsonElement> backpackIcon : backpack_icons.entrySet()) {
+ if(backpackIcon.getValue() instanceof JsonObject){
+ JsonObject backpackData = (JsonObject)backpack_contents_json.get(backpackIcon.getKey());
+ String bytes = Utils.getElementAsString(backpackData.get("data"), "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=");
+ backpackArray = growArray(bytes, Integer.parseInt(backpackIcon.getKey()), backpackArray);
+ }
+ }
+
+
+ //reduce backpack array to filter out not existent backpacks
+ {
+ int backpackCount = 0;
+ String[] tempBackpackArray = new String[0];
+ for (String s : backpackArray) {
+ if (s != null) {
+ backpackCount++;
+ String[] veryTempBackpackArray = new String[tempBackpackArray.length + 1];
+ System.arraycopy(tempBackpackArray, 0, veryTempBackpackArray, 0, tempBackpackArray.length);
+
+ veryTempBackpackArray[veryTempBackpackArray.length - 1] = s;
+ tempBackpackArray = veryTempBackpackArray;
+ }
+ }
+ backpackArray = tempBackpackArray;
+ }
+
+ JsonArray backpackSizes = new JsonArray();
+
+ for (String backpack : backpackArray) {
+ try {
+ NBTTagCompound inv_contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(Base64.getDecoder().decode(backpack)));
+ NBTTagList items = inv_contents_nbt.getTagList("i", 10);
+
+ backpackSizes.add(new JsonPrimitive(items.tagCount()));
+ for (int j = 0; j < items.tagCount(); j++) {
+ JsonObject item = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
+ contents.add(item);
+ }
+ } catch (IOException ignored) {
+ }
+ }
+
+
+ JsonObject bundledReturn = new JsonObject();
+ bundledReturn.add("contents", contents);
+ bundledReturn.add("backpack_sizes", backpackSizes);
+
+ return bundledReturn;
+ }
+
+ public String[] growArray(String bytes, int index, String[] oldArray){
+ int newSize = Math.max(index+1, oldArray.length);
+
+ String[] newArray = new String[newSize];
+ for (int i = 0; i < oldArray.length; i++) {
+ newArray[i] = oldArray[i];
+ }
+ newArray[index] = bytes;
+
+ return newArray;
+ }
+
+
+
+ public JsonObject getPetsInfo(String profileId) {
+ JsonObject profileInfo = getProfileInformation(profileId);
+ if(profileInfo == null) return null;
+ if(petsInfoMap.containsKey(profileId)) return petsInfoMap.get(profileId);
+
+ JsonObject petsInfo = new JsonObject();
+ JsonElement petsElement = profileInfo.get("pets");
+ if(petsElement != null && petsElement.isJsonArray()) {
+ JsonObject activePet = null;
+ JsonArray pets = petsElement.getAsJsonArray();
+ for(int i=0; i<pets.size(); i++) {
+ JsonObject pet = pets.get(i).getAsJsonObject();
+ if(pet.has("active") && pet.get("active").getAsJsonPrimitive().getAsBoolean()) {
+ activePet = pet;
+ break;
+ }
+ }
+ petsInfo.add("active_pet", activePet);
+ petsInfo.add("pets", pets);
+ petsInfoMap.put(profileId, petsInfo);
+ return petsInfo;
+ }
+ return null;
+ }
+
+ private final Pattern COLL_TIER_PATTERN = Pattern.compile("_(-?[0-9]+)");
+ public JsonObject getCollectionInfo(String profileId) {
+ JsonObject profileInfo = getProfileInformation(profileId);
+ if(profileInfo == null) return null;
+ JsonObject resourceCollectionInfo = getResourceCollectionInformation();
+ if(resourceCollectionInfo == null) return null;
+ if(profileId == null) profileId = latestProfile;
+ if(collectionInfoMap.containsKey(profileId)) return collectionInfoMap.get(profileId);
+
+ JsonElement unlocked_coll_tiers_element = Utils.getElement(profileInfo, "unlocked_coll_tiers");
+ JsonElement crafted_generators_element = Utils.getElement(profileInfo, "crafted_generators");
+ JsonElement collectionInfoElement = Utils.getElement(profileInfo, "collection");
+
+ if(unlocked_coll_tiers_element == null || collectionInfoElement == null) {
+ return null;
+ }
+
+ JsonObject collectionInfo = new JsonObject();
+ JsonObject collectionTiers = new JsonObject();
+ JsonObject minionTiers = new JsonObject();
+ JsonObject personalAmounts = new JsonObject();
+ JsonObject totalAmounts = new JsonObject();
+
+ if(collectionInfoElement.isJsonObject()) {
+ personalAmounts = collectionInfoElement.getAsJsonObject();
+ }
+
+ for(Map.Entry<String, JsonElement> entry : personalAmounts.entrySet()) {
+ totalAmounts.addProperty(entry.getKey(), entry.getValue().getAsInt());
+ }
+
+ List<JsonObject> coopProfiles = getCoopProfileInformation(profileId);
+ if(coopProfiles != null) {
+ for(JsonObject coopProfile : coopProfiles) {
+ JsonElement coopCollectionInfoElement = Utils.getElement(coopProfile, "collection");
+ if(coopCollectionInfoElement != null && coopCollectionInfoElement.isJsonObject()) {
+ for(Map.Entry<String, JsonElement> entry : coopCollectionInfoElement.getAsJsonObject().entrySet()) {
+ float existing = Utils.getElementAsFloat(totalAmounts.get(entry.getKey()), 0);
+ totalAmounts.addProperty(entry.getKey(), existing+entry.getValue().getAsInt());
+ }
+ }
+ }
+ }
+
+ if(unlocked_coll_tiers_element.isJsonArray()) {
+ JsonArray unlocked_coll_tiers = unlocked_coll_tiers_element.getAsJsonArray();
+ for(int i=0; i<unlocked_coll_tiers.size(); i++) {
+ String unlocked = unlocked_coll_tiers.get(i).getAsString();
+
+ Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked);
+
+ if(matcher.find()) {
+ String tier_str = matcher.group(1);
+ int tier = Integer.parseInt(tier_str);
+ String coll = unlocked.substring(0, unlocked.length()-(matcher.group().length()));
+ if(!collectionTiers.has(coll) || collectionTiers.get(coll).getAsInt() < tier) {
+ collectionTiers.addProperty(coll, tier);
+ }
+ }
+ }
+ }
+
+ if(crafted_generators_element != null && crafted_generators_element.isJsonArray()) {
+ JsonArray crafted_generators = crafted_generators_element.getAsJsonArray();
+ for(int i=0; i<crafted_generators.size(); i++) {
+ String unlocked = crafted_generators.get(i).getAsString();
+
+ Matcher matcher = COLL_TIER_PATTERN.matcher(unlocked);
+
+ if(matcher.find()) {
+ String tier_str = matcher.group(1);
+ int tier = Integer.parseInt(tier_str);
+ String coll = unlocked.substring(0, unlocked.length()-(matcher.group().length()));
+ if(!minionTiers.has(coll) || minionTiers.get(coll).getAsInt() < tier) {
+ minionTiers.addProperty(coll, tier);
+ }
+ }
+ }
+ }
+
+ JsonObject maxAmount = new JsonObject();
+ JsonObject updatedCollectionTiers = new JsonObject();
+ for(Map.Entry<String, JsonElement> totalAmountsEntry : totalAmounts.entrySet()) {
+ String collName = totalAmountsEntry.getKey();
+ int collTier = (int)Utils.getElementAsFloat(collectionTiers.get(collName), 0);
+
+ int currentAmount = (int)Utils.getElementAsFloat(totalAmounts.get(collName), 0);
+ if(currentAmount > 0) {
+ for(Map.Entry<String, JsonElement> resourceEntry : resourceCollectionInfo.entrySet()) {
+ JsonElement tiersElement = Utils.getElement(resourceEntry.getValue(), "items."+collName+".tiers");
+ if(tiersElement != null && tiersElement.isJsonArray()) {
+ JsonArray tiers = tiersElement.getAsJsonArray();
+ int maxTierAcquired = -1;
+ int maxAmountRequired = -1;
+ for(int i=0; i<tiers.size(); i++) {
+ JsonObject tierInfo = tiers.get(i).getAsJsonObject();
+ int tier = tierInfo.get("tier").getAsInt();
+ int amountRequired = tierInfo.get("amountRequired").getAsInt();
+ if(currentAmount >= amountRequired) {
+ maxTierAcquired = tier;
+ }
+ maxAmountRequired = amountRequired;
+ }
+ if(maxTierAcquired >= 0 && maxTierAcquired > collTier) {
+ updatedCollectionTiers.addProperty(collName, maxTierAcquired);
+ }
+ maxAmount.addProperty(collName, maxAmountRequired);
+ }
+ }
+ }
+ }
+
+ for(Map.Entry<String, JsonElement> collectionTiersEntry : updatedCollectionTiers.entrySet()) {
+ collectionTiers.add(collectionTiersEntry.getKey(), collectionTiersEntry.getValue());
+ }
+
+ collectionInfo.add("minion_tiers", minionTiers);
+ collectionInfo.add("max_amounts", maxAmount);
+ collectionInfo.add("personal_amounts", personalAmounts);
+ collectionInfo.add("total_amounts", totalAmounts);
+ collectionInfo.add("collection_tiers", collectionTiers);
+
+ return collectionInfo;
+ }
+
+ public PlayerStats.Stats getPassiveStats(String profileId) {
+ if(passiveStats.get(profileId) != null) return passiveStats.get(profileId);
+ JsonObject profileInfo = getProfileInformation(profileId);
+ if(profileInfo == null) return null;
+
+ PlayerStats.Stats passiveStats = PlayerStats.getPassiveBonuses(getSkillInfo(profileId), profileInfo);
+
+ if(passiveStats != null) {
+ passiveStats.add(PlayerStats.getBaseStats());
+ }
+
+ this.passiveStats.put(profileId, passiveStats);
+
+ return passiveStats;
+ }
+
+ public PlayerStats.Stats getStats(String profileId) {
+ //if(stats.get(profileId) != null) return stats.get(profileId);
+ JsonObject profileInfo = getProfileInformation(profileId);
+ if(profileInfo == null) {
+ return null;
+ }
+
+ PlayerStats.Stats stats = PlayerStats.getStats(getSkillInfo(profileId), getInventoryInfo(profileId), getCollectionInfo(profileId),
+ getPetsInfo(profileId), profileInfo);
+ this.stats.put(profileId, stats);
+ return stats;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public @Nullable JsonObject getHypixelProfile() {
+ if(uuidToHypixelProfile.containsKey(uuid)) return uuidToHypixelProfile.get(uuid);
+ return null;
+ }
+ }
+
+ private HashMap<String, JsonObject> nameToHypixelProfile = new HashMap<>();
+ private HashMap<String, JsonObject> uuidToHypixelProfile = new HashMap<>();
+ private HashMap<String, Profile> uuidToProfileMap = new HashMap<>();
+
+ public void getHypixelProfile(String name, Consumer<JsonObject> callback) {
+ String nameF = name.toLowerCase();
+ HashMap<String, String> args = new HashMap<>();
+ args.put("name", ""+nameF);
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "player",
+ args, jsonObject -> {
+ if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean()
+ && jsonObject.get("player").isJsonObject()) {
+ nameToUuid.put(nameF, jsonObject.get("player").getAsJsonObject().get("uuid").getAsString());
+ uuidToHypixelProfile.put(jsonObject.get("player").getAsJsonObject().get("uuid").getAsString(), jsonObject.get("player").getAsJsonObject());
+ if(callback != null) callback.accept(jsonObject);
+ } else {
+ if(callback != null) callback.accept(null);
+ }
+ }
+ );
+ }
+
+ private final HashMap<String, String> nameToUuid = new HashMap<>();
+
+ public void putNameUuid(String name, String uuid) {
+ nameToUuid.put(name, uuid);
+ }
+
+ public void getPlayerUUID(String name, Consumer<String> uuidCallback) {
+ String nameF = name.toLowerCase();
+ if(nameToUuid.containsKey(nameF)) {
+ uuidCallback.accept(nameToUuid.get(nameF));
+ return;
+ }
+
+ manager.hypixelApi.getApiAsync("https://api.mojang.com/users/profiles/minecraft/"+nameF,
+ (jsonObject) -> {
+ if(jsonObject.has("id") && jsonObject.get("id").isJsonPrimitive() &&
+ ((JsonPrimitive)jsonObject.get("id")).isString()) {
+ String uuid = jsonObject.get("id").getAsString();
+ nameToUuid.put(nameF, uuid);
+ uuidCallback.accept(uuid);
+ return;
+ }
+ uuidCallback.accept(null);
+ }, () -> uuidCallback.accept(null)
+ );
+ }
+
+ public void getProfileByName(String name, Consumer<Profile> callback) {
+ String nameF = name.toLowerCase();
+
+ if(nameToUuid.containsKey(nameF) && nameToUuid.get(nameF) == null) {
+ callback.accept(null);
+ return;
+ }
+
+ getPlayerUUID(nameF, (uuid) -> {
+ if(uuid == null) {
+ getHypixelProfile(nameF, jsonObject -> {
+ if(jsonObject != null) {
+ callback.accept(getProfileReset(nameToUuid.get(nameF), ignored -> {}));
+ } else {
+ callback.accept(null);
+ nameToUuid.put(nameF, null);
+ }
+ });
+ } else {
+ if(!uuidToHypixelProfile.containsKey(uuid)) {
+ getHypixelProfile(nameF, jsonObject -> {});
+ }
+ callback.accept(getProfileReset(uuid, ignored -> {}));
+ }
+ });
+
+ return;
+ }
+
+ public Profile getProfileRaw(String uuid) {
+ return uuidToProfileMap.get(uuid);
+ }
+
+ public Profile getProfile(String uuid, Consumer<Profile> callback) {
+ Profile profile = uuidToProfileMap.computeIfAbsent(uuid, k -> new Profile(uuid));
+ if(profile.playerInformation != null) {
+ callback.accept(profile);
+ } else {
+ profile.getPlayerInformation(() -> callback.accept(profile));
+ }
+ return profile;
+ }
+
+ public Profile getProfileReset(String uuid, Consumer<Profile> callback) {
+ if(uuidToProfileMap.containsKey(uuid)) uuidToProfileMap.get(uuid).resetCache();
+ return getProfile(uuid, callback);
+ }
+
+ private static JsonObject resourceCollection = null;
+ private static AtomicBoolean updatingResourceCollection = new AtomicBoolean(false);
+ public static JsonObject getResourceCollectionInformation() {
+ if(resourceCollection != null) return resourceCollection;
+ if(updatingResourceCollection.get()) return null;
+
+ updatingResourceCollection.set(true);
+
+ HashMap<String, String> args = new HashMap<>();
+ NotEnoughUpdates.INSTANCE.manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "resources/skyblock/collections",
+ args, jsonObject -> {
+ updatingResourceCollection.set(false);
+ if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) {
+ resourceCollection = jsonObject.get("collections").getAsJsonObject();
+ }
+ }, () -> {
+ updatingResourceCollection.set(false);
+ }
+ );
+
+ return null;
+ }
+
+}
|