From b09f774d422263ce15b97d6d0804beddf856176d Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 27 Feb 2022 11:53:57 -0500 Subject: feat: improve formating :) --- .../moulberry/notenoughupdates/CustomItems.java | 175 +- .../notenoughupdates/ItemPriceInformation.java | 571 +- .../github/moulberry/notenoughupdates/NEUApi.java | 8 +- .../notenoughupdates/NEUEventListener.java | 5082 +++++------ .../moulberry/notenoughupdates/NEUManager.java | 2913 ++++--- .../moulberry/notenoughupdates/NEUOverlay.java | 5411 ++++++------ .../notenoughupdates/NotEnoughUpdates.java | 666 +- .../notenoughupdates/auction/APIManager.java | 1790 ++-- .../notenoughupdates/auction/CustomAH.java | 3814 ++++---- .../notenoughupdates/auction/CustomAHGui.java | 12 +- .../collectionlog/CollectionConstant.java | 12 +- .../collectionlog/GuiCollectionLog.java | 181 +- .../commands/ClientCommandBase.java | 32 +- .../notenoughupdates/commands/Commands.java | 78 +- .../notenoughupdates/commands/ScreenCommand.java | 26 +- .../commands/dev/DevTestCommand.java | 283 +- .../commands/dev/DungeonWinTestCommand.java | 20 +- .../commands/dev/NullzeeSphereCommand.java | 53 +- .../commands/dev/PackDevCommand.java | 73 +- .../commands/dev/StatsCommand.java | 270 +- .../commands/dungeon/DhCommand.java | 14 +- .../commands/dungeon/DnCommand.java | 17 +- .../commands/dungeon/JoinDungeonCommand.java | 51 +- .../commands/dungeon/MapCommand.java | 215 +- .../commands/help/FeaturesCommand.java | 60 +- .../commands/help/HelpCommand.java | 113 +- .../commands/help/LinksCommand.java | 33 +- .../commands/help/SettingsCommand.java | 31 +- .../commands/help/StorageViewerWhyCommand.java | 29 +- .../notenoughupdates/commands/misc/AhCommand.java | 41 +- .../commands/misc/ButtonsCommand.java | 12 +- .../commands/misc/CalendarCommand.java | 18 +- .../commands/misc/CollectionLogCommand.java | 14 +- .../commands/misc/CosmeticsCommand.java | 22 +- .../commands/misc/CustomizeCommand.java | 42 +- .../commands/misc/GamemodesCommand.java | 16 +- .../commands/profile/CataCommand.java | 16 +- .../commands/profile/PeekCommand.java | 481 +- .../commands/profile/PvCommand.java | 22 +- .../commands/profile/ViewProfileCommand.java | 114 +- .../commands/repo/ReloadRepoCommand.java | 34 +- .../commands/repo/RepoModeCommand.java | 19 +- .../commands/repo/ResetRepoCommand.java | 14 +- .../notenoughupdates/core/BackgroundBlur.java | 481 +- .../notenoughupdates/core/ChromaColour.java | 172 +- .../notenoughupdates/core/GlScissorStack.java | 132 +- .../notenoughupdates/core/GuiElement.java | 6 +- .../notenoughupdates/core/GuiElementBoolean.java | 202 +- .../notenoughupdates/core/GuiElementColour.java | 785 +- .../notenoughupdates/core/GuiElementTextField.java | 1162 +-- .../core/GuiScreenElementWrapper.java | 42 +- .../notenoughupdates/core/config/Config.java | 2 +- .../core/config/GuiPositionEditor.java | 212 +- .../core/config/KeybindHelper.java | 76 +- .../notenoughupdates/core/config/Position.java | 364 +- .../notenoughupdates/core/config/PositionNew.java | 330 +- .../core/config/annotations/Category.java | 4 +- .../core/config/annotations/ConfigAccordionId.java | 2 +- .../config/annotations/ConfigEditorAccordion.java | 2 +- .../config/annotations/ConfigEditorButton.java | 4 +- .../annotations/ConfigEditorDraggableList.java | 2 +- .../config/annotations/ConfigEditorDropdown.java | 4 +- .../core/config/annotations/ConfigEditorFSR.java | 4 +- .../config/annotations/ConfigEditorKeybind.java | 2 +- .../config/annotations/ConfigEditorSlider.java | 6 +- .../core/config/annotations/ConfigOption.java | 6 +- .../core/config/gui/GuiOptionEditor.java | 73 +- .../core/config/gui/GuiOptionEditorAccordion.java | 113 +- .../core/config/gui/GuiOptionEditorBoolean.java | 60 +- .../core/config/gui/GuiOptionEditorButton.java | 102 +- .../core/config/gui/GuiOptionEditorColour.java | 90 +- .../config/gui/GuiOptionEditorDraggableList.java | 552 +- .../core/config/gui/GuiOptionEditorDropdown.java | 307 +- .../core/config/gui/GuiOptionEditorFSR.java | 97 +- .../core/config/gui/GuiOptionEditorKeybind.java | 131 +- .../core/config/gui/GuiOptionEditorSlider.java | 239 +- .../core/config/gui/GuiOptionEditorText.java | 144 +- .../core/config/gui/GuiPositionEditor.java | 328 +- .../core/config/struct/ConfigProcessor.java | 351 +- .../core/util/GuiElementSlider.java | 213 +- .../notenoughupdates/core/util/MiscUtils.java | 158 +- .../notenoughupdates/core/util/Splitters.java | 2 +- .../notenoughupdates/core/util/StringUtils.java | 54 +- .../notenoughupdates/core/util/lerp/LerpUtils.java | 32 +- .../core/util/lerp/LerpingFloat.java | 98 +- .../core/util/lerp/LerpingInteger.java | 142 +- .../core/util/render/RenderUtils.java | 772 +- .../core/util/render/TextRenderUtils.java | 507 +- .../notenoughupdates/cosmetics/CapeManager.java | 651 +- .../notenoughupdates/cosmetics/CapeNode.java | 708 +- .../notenoughupdates/cosmetics/GuiCosmetics.java | 1180 +-- .../notenoughupdates/cosmetics/NEUCape.java | 2548 +++--- .../notenoughupdates/cosmetics/ShaderManager.java | 277 +- .../notenoughupdates/dungeons/DungeonBlocks.java | 495 +- .../notenoughupdates/dungeons/DungeonMap.java | 3051 +++---- .../notenoughupdates/dungeons/DungeonWin.java | 834 +- .../dungeons/GuiDungeonMapEditor.java | 1525 ++-- .../notenoughupdates/events/NEUEvent.java | 8 +- .../events/OnBlockBreakSoundEffect.java | 60 +- .../notenoughupdates/gamemodes/GuiGamemodes.java | 589 +- .../notenoughupdates/gamemodes/SBGamemodes.java | 637 +- .../infopanes/CollectionLogInfoPane.java | 951 +- .../notenoughupdates/infopanes/DevInfoPane.java | 1767 ++-- .../infopanes/FlipperInfoPane.java | 187 +- .../notenoughupdates/infopanes/HTMLInfoPane.java | 716 +- .../notenoughupdates/infopanes/InfoPane.java | 90 +- .../infopanes/ScrollableInfoPane.java | 40 +- .../notenoughupdates/infopanes/TextInfoPane.java | 105 +- .../notenoughupdates/itemeditor/GuiElement.java | 14 +- .../itemeditor/GuiElementButton.java | 46 +- .../itemeditor/GuiElementText.java | 66 +- .../itemeditor/GuiElementTextField.java | 1009 +-- .../notenoughupdates/itemeditor/NEUItemEditor.java | 747 +- .../notenoughupdates/mbgui/MBAnchorPoint.java | 94 +- .../notenoughupdates/mbgui/MBDeserializer.java | 10 +- .../notenoughupdates/mbgui/MBGuiElement.java | 14 +- .../notenoughupdates/mbgui/MBGuiGroup.java | 104 +- .../notenoughupdates/mbgui/MBGuiGroupAligned.java | 96 +- .../notenoughupdates/mbgui/MBGuiGroupFloating.java | 239 +- .../miscfeatures/AuctionBINWarning.java | 478 +- .../miscfeatures/AuctionSortModeWarning.java | 92 +- .../miscfeatures/BetterContainers.java | 959 +- .../miscfeatures/CollectionLogManager.java | 56 +- .../miscfeatures/CrystalMetalDetectorSolver.java | 298 +- .../miscfeatures/CrystalOverlay.java | 758 +- .../miscfeatures/CustomItemEffects.java | 2434 +++--- .../miscfeatures/CustomSkulls.java | 569 +- .../miscfeatures/DamageCommas.java | 170 +- .../miscfeatures/DwarvenMinesWaypoints.java | 425 +- .../miscfeatures/EnchantingSolvers.java | 1052 +-- .../notenoughupdates/miscfeatures/FairySouls.java | 587 +- .../miscfeatures/FancyPortals.java | 512 +- .../miscfeatures/FishingHelper.java | 1164 +-- .../miscfeatures/ItemCooldowns.java | 370 +- .../miscfeatures/ItemCustomizeManager.java | 500 +- .../miscfeatures/ItemRarityHalo.java | 518 +- .../notenoughupdates/miscfeatures/MiningStuff.java | 350 +- .../miscfeatures/NPCRetexturing.java | 112 +- .../miscfeatures/NullzeeSphere.java | 514 +- .../miscfeatures/PetInfoOverlay.java | 2189 ++--- .../notenoughupdates/miscfeatures/SlotLocking.java | 1237 +-- .../miscfeatures/StorageManager.java | 1280 +-- .../miscfeatures/StreamerMode.java | 52 +- .../notenoughupdates/miscfeatures/SunTzu.java | 137 +- .../customblockzones/CrystalHollowsTextures.java | 32 +- .../customblockzones/CustomBiomes.java | 255 +- .../customblockzones/CustomBlockSounds.java | 156 +- .../customblockzones/DwarvenMinesTextures.java | 321 +- .../customblockzones/IslandZoneSubdivider.java | 2 +- .../customblockzones/LocationChangeEvent.java | 14 +- .../customblockzones/SpecialBlockZone.java | 113 +- .../miscgui/AccessoryBagOverlay.java | 1990 +++-- .../notenoughupdates/miscgui/CalendarOverlay.java | 2742 +++--- .../notenoughupdates/miscgui/GuiCustomEnchant.java | 3426 ++++---- .../notenoughupdates/miscgui/GuiEnchantColour.java | 1131 +-- .../miscgui/GuiInvButtonEditor.java | 1600 ++-- .../notenoughupdates/miscgui/GuiItemCustomize.java | 779 +- .../notenoughupdates/miscgui/GuiItemRecipe.java | 403 +- .../notenoughupdates/miscgui/GuiPriceGraph.java | 919 +- .../miscgui/InventoryStorageSelector.java | 901 +- .../notenoughupdates/miscgui/KatSitterOverlay.java | 124 +- .../miscgui/NEUOverlayPlacements.java | 426 +- .../notenoughupdates/miscgui/StorageOverlay.java | 4270 ++++----- .../notenoughupdates/miscgui/TradeWindow.java | 2132 ++--- .../miscgui/tutorials/NeuConfigTutorial.java | 6 +- .../miscgui/tutorials/NeuTutorial.java | 251 +- .../miscgui/tutorials/TutorialBase.java | 640 +- .../mixins/MixinAbstractClientPlayer.java | 46 +- .../notenoughupdates/mixins/MixinContainer.java | 8 +- .../mixins/MixinEffectRenderer.java | 26 +- .../notenoughupdates/mixins/MixinEntity.java | 24 +- .../mixins/MixinEntityAgeable.java | 16 +- .../notenoughupdates/mixins/MixinEntityPlayer.java | 74 +- .../mixins/MixinEntityPlayerSP.java | 24 +- .../mixins/MixinEntityRenderer.java | 267 +- .../notenoughupdates/mixins/MixinGuiChest.java | 82 +- .../notenoughupdates/mixins/MixinGuiContainer.java | 546 +- .../notenoughupdates/mixins/MixinGuiIngame.java | 67 +- .../notenoughupdates/mixins/MixinGuiInventory.java | 14 +- .../notenoughupdates/mixins/MixinGuiScreen.java | 8 +- .../mixins/MixinInventoryEffectRenderer.java | 18 +- .../mixins/MixinInventoryPlayer.java | 20 +- .../mixins/MixinItemCameraTransforms.java | 8 +- .../notenoughupdates/mixins/MixinItemRenderer.java | 20 +- .../notenoughupdates/mixins/MixinItemStack.java | 69 +- .../mixins/MixinLayerArmorBase.java | 84 +- .../mixins/MixinLayerCustomHead.java | 92 +- .../mixins/MixinLoadingScreenRenderer.java | 12 +- .../notenoughupdates/mixins/MixinMinecraft.java | 10 +- .../notenoughupdates/mixins/MixinMouseHelper.java | 14 +- .../mixins/MixinNetHandlerPlayClient.java | 150 +- .../mixins/MixinPlayerControllerMP.java | 31 +- .../notenoughupdates/mixins/MixinRender.java | 24 +- .../notenoughupdates/mixins/MixinRenderFish.java | 271 +- .../notenoughupdates/mixins/MixinRenderGlobal.java | 164 +- .../notenoughupdates/mixins/MixinRenderItem.java | 353 +- .../notenoughupdates/mixins/MixinRenderList.java | 16 +- .../mixins/MixinRendererLivingEntity.java | 35 +- .../mixins/MixinTextureManager.java | 12 +- .../mixins/MixinTileEntitySkullRenderer.java | 25 +- .../mixins/MixinTileEntitySpecialRenderer.java | 40 +- .../mixins/MixinVboRenderList.java | 16 +- .../notenoughupdates/mixins/MixinWorld.java | 36 +- .../notenoughupdates/mixins/MixinWorldClient.java | 16 +- .../notenoughupdates/options/NEUConfig.java | 1095 +-- .../notenoughupdates/options/NEUConfigEditor.java | 1540 ++-- .../options/seperateSections/AHGraph.java | 136 +- .../options/seperateSections/AHTweaks.java | 158 +- .../options/seperateSections/AccessoryBag.java | 14 +- .../options/seperateSections/ApiKey.java | 14 +- .../options/seperateSections/Calendar.java | 80 +- .../options/seperateSections/CustomArmour.java | 46 +- .../options/seperateSections/DungeonMapConfig.java | 266 +- .../options/seperateSections/Dungeons.java | 443 +- .../options/seperateSections/Enchanting.java | 358 +- .../options/seperateSections/Fishing.java | 400 +- .../options/seperateSections/ImprovedSBMenu.java | 72 +- .../options/seperateSections/InventoryButtons.java | 46 +- .../options/seperateSections/ItemOverlays.java | 685 +- .../options/seperateSections/Itemlist.java | 186 +- .../options/seperateSections/LocationEdit.java | 358 +- .../options/seperateSections/Mining.java | 1221 +-- .../options/seperateSections/Misc.java | 272 +- .../options/seperateSections/MiscOverlays.java | 636 +- .../options/seperateSections/NeuAuctionHouse.java | 66 +- .../options/seperateSections/Notifications.java | 44 +- .../options/seperateSections/PetOverlay.java | 190 +- .../options/seperateSections/SkillOverlays.java | 559 +- .../options/seperateSections/SlayerOverlay.java | 117 +- .../options/seperateSections/SlotLocking.java | 130 +- .../options/seperateSections/StorageGUI.java | 456 +- .../options/seperateSections/Toolbar.java | 170 +- .../options/seperateSections/TooltipTweaks.java | 258 +- .../options/seperateSections/TradeMenu.java | 32 +- .../overlays/AuctionSearchOverlay.java | 1124 +-- .../overlays/BonemerangOverlay.java | 187 +- .../overlays/CombatSkillOverlay.java | 461 +- .../overlays/CrystalHollowOverlay.java | 810 +- .../notenoughupdates/overlays/FarmingOverlay.java | 963 ++- .../overlays/FishingSkillOverlay.java | 674 +- .../notenoughupdates/overlays/FuelBar.java | 308 +- .../notenoughupdates/overlays/MiningOverlay.java | 1321 +-- .../overlays/MiningSkillOverlay.java | 662 +- .../notenoughupdates/overlays/OverlayManager.java | 524 +- .../overlays/RancherBootOverlay.java | 288 +- .../notenoughupdates/overlays/SlayerOverlay.java | 428 +- .../notenoughupdates/overlays/TextOverlay.java | 321 +- .../overlays/TextOverlayStyle.java | 8 +- .../notenoughupdates/overlays/TimersOverlay.java | 1244 +-- .../profileviewer/GuiProfileViewer.java | 9145 +++++++++++--------- .../notenoughupdates/profileviewer/Panorama.java | 303 +- .../profileviewer/PlayerStats.java | 1227 +-- .../profileviewer/ProfileViewer.java | 2470 +++--- .../notenoughupdates/recipes/CraftingOverlay.java | 242 +- .../notenoughupdates/recipes/CraftingRecipe.java | 252 +- .../notenoughupdates/recipes/ForgeRecipe.java | 437 +- .../notenoughupdates/recipes/Ingredient.java | 126 +- .../notenoughupdates/recipes/NeuRecipe.java | 58 +- .../notenoughupdates/recipes/RecipeGenerator.java | 314 +- .../notenoughupdates/recipes/RecipeSlot.java | 34 +- .../recipes/VillagerTradeRecipe.java | 251 +- .../notenoughupdates/util/AllowEmptyHTMLTag.java | 112 +- .../moulberry/notenoughupdates/util/Constants.java | 106 +- .../moulberry/notenoughupdates/util/Debouncer.java | 38 +- .../util/DiscordMarkdownBuilder.java | 34 +- .../notenoughupdates/util/GuiTextures.java | 230 +- .../notenoughupdates/util/HastebinUploader.java | 86 +- .../notenoughupdates/util/HotmInformation.java | 323 +- .../notenoughupdates/util/HypixelApi.java | 316 +- .../notenoughupdates/util/LerpingFloat.java | 98 +- .../notenoughupdates/util/NEUResourceManager.java | 48 +- .../notenoughupdates/util/ProfileApiSyncer.java | 129 +- .../util/RequestFocusListener.java | 72 +- .../util/ReverseWorldRenderer.java | 1069 +-- .../moulberry/notenoughupdates/util/SBInfo.java | 661 +- .../notenoughupdates/util/SpecialColour.java | 172 +- .../moulberry/notenoughupdates/util/TexLoc.java | 88 +- .../moulberry/notenoughupdates/util/Utils.java | 3159 +++---- .../notenoughupdates/util/XPInformation.java | 445 +- 279 files changed, 70580 insertions(+), 63343 deletions(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java index f94a0633..28686073 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java @@ -7,89 +7,100 @@ import io.github.moulberry.notenoughupdates.util.Constants; import net.minecraft.util.EnumChatFormatting; public class CustomItems { - /* - * So it has come to this, huh? Snooping through the source to find all my carefully crafted easter eggs. You - * cheated not only the game, but yourself. You didn't grow. You didn't improve. You took a - * shortcut and gained nothing. You experienced a hollow victory. Nothing was risked and nothing was gained. - * It's sad that you don't know the difference. - */ + /* + * So it has come to this, huh? Snooping through the source to find all my carefully crafted easter eggs. You + * cheated not only the game, but yourself. You didn't grow. You didn't improve. You took a + * shortcut and gained nothing. You experienced a hollow victory. Nothing was risked and nothing was gained. + * It's sad that you don't know the difference. + */ - public static JsonObject NULLZEE = create( - "NULLZEE", - "dirt", - "Nullzee242 Youtube Channel", - "Dirt, AOTD. Dirt, AOTD.", - "Dirt, AOTD. Dirt, AOTD.", - "Ooh, Dirt to Midas! Let's shake it up a little.", - "", - "Also, did you know that only 8.7% of the people watching are subscribed?", - "It's OK, everyone makes mistakes", - "Also follow -> twitch.tv/nullzeelive", - "Also -> discord.gg/nullzee"); - public static JsonObject DUCTTAPE = create( - "DUCTTAPE", - "iron_shovel", - "You ever accidentally bury your duct tape?", - "No problem! Our team of experts specialise in", - "subterranean duct tape excavation. That's right:", - "your buried duct tape problems are a thing of the past,", - "all for the low price of $7.99 or a subscription", - "to the Ducttapedigger youtube channel!"); - public static JsonObject SPINAXX = create( - "SPINAXX", - "emerald", - "Spinaxx", - "Famous streamer btw :)"); - public static JsonObject RUNE = create("RUNE", "paper", "No.", "I hate runes."); - public static JsonObject TWOBEETWOTEE = create("2B2T", "bedrock", "Minecraft's oldest anarchy Minecraft server in Minecraft.", - "This Minecraft anarchy server is the oldest server,", - "being a server since 2010 when Minecraft was a game with a server.", - "It is complete anarchy in Minecraft which means that there is total anarchy.", - "Hacking is allowed in Minecraft on this anarchy server which", - "is the oldest anarchy server in Minecraft, 2b2t. Hack. Steal. Cheat. Lie.", - "On the oldest anarchy server in Minecraft. 2b2t. The worst server in Minecraft,", - "where there are no rules. On the oldest anarchy server in Minecraft.", - "In this Minecraft anarchy server, there have been numerous Minecraft", - "incursions on the server, some of which I, a player on this Minecraft", - "anarchy server in Minecraft, have participated in. One of this server's", - "most infamous Minecraft players on the oldest Minecraft"); - public static JsonObject LEOCTHL = create("LEOCTHL", "dragon_egg", "--- Stats below may not be entirely accurate ---", - "17 legendary dragon pets", - "24 epic dragon pets", - "18 epic golem pets", - "12 legendary golem pets", - "39 legendary phoenix pets", - "", - "get flexed"); - public static JsonObject CREDITS = Constants.MISC.getAsJsonObject("credits"); - public static JsonObject IRONM00N = create( - "IRONM00N", - "end_stone", - "IRONM00N", - "Your life has been a lie,", - "the moon is made out of iron." - ); - public static JsonObject NOPO = create( - "nopo", - "writable_book", - "Nopo", - "We do a lil Chatting" - ); + public static JsonObject NULLZEE = create( + "NULLZEE", + "dirt", + "Nullzee242 Youtube Channel", + "Dirt, AOTD. Dirt, AOTD.", + "Dirt, AOTD. Dirt, AOTD.", + "Ooh, Dirt to Midas! Let's shake it up a little.", + "", + "Also, did you know that only 8.7% of the people watching are subscribed?", + "It's OK, everyone makes mistakes", + "Also follow -> twitch.tv/nullzeelive", + "Also -> discord.gg/nullzee" + ); + public static JsonObject DUCTTAPE = create( + "DUCTTAPE", + "iron_shovel", + "You ever accidentally bury your duct tape?", + "No problem! Our team of experts specialise in", + "subterranean duct tape excavation. That's right:", + "your buried duct tape problems are a thing of the past,", + "all for the low price of $7.99 or a subscription", + "to the Ducttapedigger youtube channel!" + ); + public static JsonObject SPINAXX = create( + "SPINAXX", + "emerald", + "Spinaxx", + "Famous streamer btw :)" + ); + public static JsonObject RUNE = create("RUNE", "paper", "No.", "I hate runes."); + public static JsonObject TWOBEETWOTEE = create( + "2B2T", + "bedrock", + "Minecraft's oldest anarchy Minecraft server in Minecraft.", + "This Minecraft anarchy server is the oldest server,", + "being a server since 2010 when Minecraft was a game with a server.", + "It is complete anarchy in Minecraft which means that there is total anarchy.", + "Hacking is allowed in Minecraft on this anarchy server which", + "is the oldest anarchy server in Minecraft, 2b2t. Hack. Steal. Cheat. Lie.", + "On the oldest anarchy server in Minecraft. 2b2t. The worst server in Minecraft,", + "where there are no rules. On the oldest anarchy server in Minecraft.", + "In this Minecraft anarchy server, there have been numerous Minecraft", + "incursions on the server, some of which I, a player on this Minecraft", + "anarchy server in Minecraft, have participated in. One of this server's", + "most infamous Minecraft players on the oldest Minecraft" + ); + public static JsonObject LEOCTHL = create( + "LEOCTHL", + "dragon_egg", + "--- Stats below may not be entirely accurate ---", + "17 legendary dragon pets", + "24 epic dragon pets", + "18 epic golem pets", + "12 legendary golem pets", + "39 legendary phoenix pets", + "", + "get flexed" + ); + public static JsonObject CREDITS = Constants.MISC.getAsJsonObject("credits"); + public static JsonObject IRONM00N = create( + "IRONM00N", + "end_stone", + "IRONM00N", + "Your life has been a lie,", + "the moon is made out of iron." + ); + public static JsonObject NOPO = create( + "nopo", + "writable_book", + "Nopo", + "We do a lil Chatting" + ); - /* - * SHAAAAAAAAAAAAAAAAAAME - */ + /* + * SHAAAAAAAAAAAAAAAAAAME + */ - private static JsonObject create(String internalname, String itemid, String displayname, String... lore) { - JsonObject json = new JsonObject(); - json.addProperty("itemid", itemid); - json.addProperty("internalname", internalname); - json.addProperty("displayname", EnumChatFormatting.RED + displayname); - JsonArray jsonlore = new JsonArray(); - for (String line : lore) { - jsonlore.add(new JsonPrimitive(EnumChatFormatting.GRAY + line)); - } - json.add("lore", jsonlore); - return json; - } + private static JsonObject create(String internalname, String itemid, String displayname, String... lore) { + JsonObject json = new JsonObject(); + json.addProperty("itemid", itemid); + json.addProperty("internalname", internalname); + json.addProperty("displayname", EnumChatFormatting.RED + displayname); + JsonArray jsonlore = new JsonArray(); + for (String line : lore) { + jsonlore.add(new JsonPrimitive(EnumChatFormatting.GRAY + line)); + } + json.add("lore", jsonlore); + return json; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index 2a1d1766..1804831b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -20,290 +20,335 @@ import java.util.Locale; import java.util.Set; public class ItemPriceInformation { - private static File file; - private static HashSet auctionableItems = null; - private static Gson gson; + private static File file; + private static HashSet auctionableItems = null; + private static Gson gson; - public static boolean addToTooltip(List tooltip, String internalname, ItemStack stack) { - return addToTooltip(tooltip, internalname, stack, true); - } + public static boolean addToTooltip(List tooltip, String internalname, ItemStack stack) { + return addToTooltip(tooltip, internalname, stack, true); + } - public static void init(File saveLocation, Gson neuGson) { - file = saveLocation; - gson = neuGson; - if (file.exists()) { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { - auctionableItems = gson.fromJson(reader, HashSet.class); - } catch (Exception ignored) {} - } - } + public static void init(File saveLocation, Gson neuGson) { + file = saveLocation; + gson = neuGson; + if (file.exists()) { + try ( + BufferedReader reader = new BufferedReader(new InputStreamReader( + new FileInputStream(file), + StandardCharsets.UTF_8 + )) + ) { + auctionableItems = gson.fromJson(reader, HashSet.class); + } catch (Exception ignored) { + } + } + } - public static void updateAuctionableItemsList() { - Set items = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfoKeySet(); - if (!items.isEmpty()) { - auctionableItems = (HashSet) items; - try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) { - //noinspection ResultOfMethodCallIgnored - file.createNewFile(); - writer.write(gson.toJson(items)); - } catch (IOException ignored) {} - } - } + public static void updateAuctionableItemsList() { + Set items = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfoKeySet(); + if (!items.isEmpty()) { + auctionableItems = (HashSet) items; + try ( + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( + new FileOutputStream(file), + StandardCharsets.UTF_8 + )) + ) { + //noinspection ResultOfMethodCallIgnored + file.createNewFile(); + writer.write(gson.toJson(items)); + } catch (IOException ignored) { + } + } + } - public static boolean addToTooltip(List tooltip, String internalname, ItemStack stack, boolean useStackSize) { - if (stack.getTagCompound().hasKey("disableNeuTooltip") && stack.getTagCompound().getBoolean("disableNeuTooltip")) { - return false; - } - if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKey && !KeybindHelper.isKeyDown(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKeyKeybind)) { - return false; - } - if (internalname.equals("SKYBLOCK_MENU")) { - return false; - } - JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); - JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname); - float lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname); + public static boolean addToTooltip(List tooltip, String internalname, ItemStack stack, boolean useStackSize) { + if (stack.getTagCompound().hasKey("disableNeuTooltip") && stack.getTagCompound().getBoolean("disableNeuTooltip")) { + return false; + } + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKey && + !KeybindHelper.isKeyDown(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKeyKeybind)) { + return false; + } + if (internalname.equals("SKYBLOCK_MENU")) { + return false; + } + JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); + JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname); + float lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname); - int lowestBin = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname); - APIManager.CraftInfo craftCost = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(internalname); + int lowestBin = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname); + APIManager.CraftInfo craftCost = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(internalname); - boolean auctionItem = lowestBin > 0 || lowestBinAvg > 0; - boolean auctionInfoErrored = auctionInfo == null; - if (auctionItem) { - long currentTime = System.currentTimeMillis(); - long lastUpdate = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLastLowestBinUpdateTime(); - //check if info is older than 10 minutes - if (currentTime - lastUpdate > 600 * 1000) { - tooltip.add(EnumChatFormatting.RED + "[NEU] Price info is outdated."); - tooltip.add(EnumChatFormatting.RED + "It will be updated again as soon as possible."); - } - } + boolean auctionItem = lowestBin > 0 || lowestBinAvg > 0; + boolean auctionInfoErrored = auctionInfo == null; + if (auctionItem) { + long currentTime = System.currentTimeMillis(); + long lastUpdate = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLastLowestBinUpdateTime(); + //check if info is older than 10 minutes + if (currentTime - lastUpdate > 600 * 1000) { + tooltip.add(EnumChatFormatting.RED + "[NEU] Price info is outdated."); + tooltip.add(EnumChatFormatting.RED + "It will be updated again as soon as possible."); + } + } - boolean bazaarItem = bazaarInfo != null; + boolean bazaarItem = bazaarInfo != null; - NumberFormat format = NumberFormat.getInstance(Locale.US); - boolean shortNumber = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.shortNumberFormatPrices; - if (bazaarItem) { - List lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoBaz; + NumberFormat format = NumberFormat.getInstance(Locale.US); + boolean shortNumber = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.shortNumberFormatPrices; + if (bazaarItem) { + List lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoBaz; - boolean added = false; + boolean added = false; - boolean shiftPressed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT); + boolean shiftPressed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT); - int stackMultiplier = 1; - int shiftStackMultiplier = useStackSize && stack.stackSize > 1 ? stack.stackSize : 64; - if (shiftPressed) { - stackMultiplier = shiftStackMultiplier; - } + int stackMultiplier = 1; + int shiftStackMultiplier = useStackSize && stack.stackSize > 1 ? stack.stackSize : 64; + if (shiftPressed) { + stackMultiplier = shiftStackMultiplier; + } - //values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"} - for (int lineId : lines) { - switch (lineId) { - case 0: - if (bazaarInfo.has("avg_buy")) { - if (!added) { - tooltip.add(""); - if (!shiftPressed) - tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); - added = true; - } - int bazaarBuyPrice = (int) bazaarInfo.get("avg_buy").getAsFloat() * stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Buy: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarBuyPrice > 1000 ? Utils.shortNumberFormat(bazaarBuyPrice, 0) : format.format(bazaarBuyPrice)) + " coins"); - } - break; - case 1: - if (bazaarInfo.has("avg_sell")) { - if (!added) { - tooltip.add(""); - if (!shiftPressed) - tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); - added = true; - } - int bazaarSellPrice = (int) bazaarInfo.get("avg_sell").getAsFloat() * stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Sell: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarSellPrice > 1000 ? Utils.shortNumberFormat(bazaarSellPrice, 0) : format.format(bazaarSellPrice)) + " coins"); - } - break; - case 2: - if (bazaarInfo.has("curr_buy")) { - if (!added) { - tooltip.add(""); - if (!shiftPressed) - tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); - added = true; - } - int bazaarInstantBuyPrice = (int) bazaarInfo.get("curr_buy").getAsFloat() * stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Buy: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarInstantBuyPrice > 1000 ? Utils.shortNumberFormat(bazaarInstantBuyPrice, 0) : format.format(bazaarInstantBuyPrice)) + " coins"); - } - break; - case 3: - if (bazaarInfo.has("curr_sell")) { - if (!added) { - tooltip.add(""); - if (!shiftPressed) - tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); - added = true; - } - int bazaarInstantSellPrice = (int) bazaarInfo.get("curr_sell").getAsFloat() * stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Sell: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarInstantSellPrice > 1000 ? Utils.shortNumberFormat(bazaarInstantSellPrice, 0) : format.format(bazaarInstantSellPrice)) + " coins"); - } - break; - case 4: - if (craftCost != null && craftCost.fromRecipe) { - if ((int) craftCost.craftCost == 0) { - continue; - } - if (!added) { - tooltip.add(""); - added = true; - } - float cost = craftCost.craftCost; - if (shiftPressed) cost = cost * shiftStackMultiplier; + //values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"} + for (int lineId : lines) { + switch (lineId) { + case 0: + if (bazaarInfo.has("avg_buy")) { + if (!added) { + tooltip.add(""); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); + added = true; + } + int bazaarBuyPrice = (int) bazaarInfo.get("avg_buy").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Buy: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarBuyPrice > 1000 + ? Utils.shortNumberFormat(bazaarBuyPrice, 0) + : format.format(bazaarBuyPrice)) + " coins"); + } + break; + case 1: + if (bazaarInfo.has("avg_sell")) { + if (!added) { + tooltip.add(""); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); + added = true; + } + int bazaarSellPrice = (int) bazaarInfo.get("avg_sell").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Sell: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarSellPrice > 1000 + ? Utils.shortNumberFormat(bazaarSellPrice, 0) + : format.format(bazaarSellPrice)) + " coins"); + } + break; + case 2: + if (bazaarInfo.has("curr_buy")) { + if (!added) { + tooltip.add(""); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); + added = true; + } + int bazaarInstantBuyPrice = (int) bazaarInfo.get("curr_buy").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Buy: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarInstantBuyPrice > 1000 + ? Utils.shortNumberFormat(bazaarInstantBuyPrice, 0) + : format.format(bazaarInstantBuyPrice)) + + " coins"); + } + break; + case 3: + if (bazaarInfo.has("curr_sell")) { + if (!added) { + tooltip.add(""); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); + added = true; + } + int bazaarInstantSellPrice = (int) bazaarInfo.get("curr_sell").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Sell: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && bazaarInstantSellPrice > 1000 + ? Utils.shortNumberFormat( + bazaarInstantSellPrice, + 0 + ) + : format.format(bazaarInstantSellPrice)) + + " coins"); + } + break; + case 4: + if (craftCost != null && craftCost.fromRecipe) { + if ((int) craftCost.craftCost == 0) { + continue; + } + if (!added) { + tooltip.add(""); + added = true; + } + float cost = craftCost.craftCost; + if (shiftPressed) cost = cost * shiftStackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + (shortNumber && cost > 1000 ? Utils.shortNumberFormat(cost, 0) : format.format((int) cost)) + " coins"); - } - break; - } - } + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + (shortNumber && cost > 1000 ? Utils.shortNumberFormat(cost, 0) : format.format((int) cost)) + " coins"); + } + break; + } + } - return added; - } else if (auctionItem) { - List lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoAuc; + return added; + } else if (auctionItem) { + List lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoAuc; - boolean added = false; + boolean added = false; - for (int lineId : lines) { - switch (lineId) { - case 0: - if (lowestBin > 0) { - if (!added) { - tooltip.add(""); - added = true; - } - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Lowest BIN: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(lowestBin) + " coins"); - } - break; - case 1: - if (auctionInfo != null) { - if (!added) { - tooltip.add(""); - added = true; - } + for (int lineId : lines) { + switch (lineId) { + case 0: + if (lowestBin > 0) { + if (!added) { + tooltip.add(""); + added = true; + } + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Lowest BIN: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(lowestBin) + " coins"); + } + break; + case 1: + if (auctionInfo != null) { + if (!added) { + tooltip.add(""); + added = true; + } - if (auctionInfo.has("clean_price")) { - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price (Clean): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + - (shortNumber && auctionInfo.get("clean_price").getAsFloat() > 1000 ? Utils.shortNumberFormat(auctionInfo.get("clean_price").getAsFloat(), 0) : format.format((int) auctionInfo.get("clean_price").getAsFloat()) - + " coins")); - } else { - int auctionPrice = (int) (auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + - (shortNumber && auctionPrice > 1000 ? Utils.shortNumberFormat(auctionPrice, 0) : format.format(auctionPrice)) + " coins"); - } + if (auctionInfo.has("clean_price")) { + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price (Clean): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + (shortNumber && auctionInfo.get("clean_price").getAsFloat() > 1000 ? Utils.shortNumberFormat( + auctionInfo.get("clean_price").getAsFloat(), + 0 + ) : format.format((int) auctionInfo.get("clean_price").getAsFloat()) + + " coins")); + } else { + int auctionPrice = + (int) (auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + (shortNumber && auctionPrice > 1000 + ? Utils.shortNumberFormat(auctionPrice, 0) + : format.format(auctionPrice)) + " coins"); + } - } - break; - case 2: - if (auctionInfo != null) { - if (!added) { - tooltip.add(""); - added = true; - } - if (auctionInfo.has("clean_price")) { - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales (Clean): " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + - (auctionInfo.get("clean_sales").getAsFloat() < 2 ? format.format(auctionInfo.get("clean_sales").getAsFloat()) + " sale/day" - : format.format(auctionInfo.get("clean_sales").getAsFloat()) + " sales/day")); - } else { - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + - (auctionInfo.get("sales").getAsFloat() < 2 ? format.format(auctionInfo.get("sales").getAsFloat()) + " sale/day" - : format.format(auctionInfo.get("sales").getAsFloat()) + " sales/day")); - } - } - break; - case 3: - if (craftCost != null && craftCost.fromRecipe) { - if ((int) craftCost.craftCost == 0) { - continue; - } - if (!added) { - tooltip.add(""); - added = true; - } - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + - (shortNumber && craftCost.craftCost > 1000 ? Utils.shortNumberFormat(craftCost.craftCost, 0) : format.format((int) craftCost.craftCost)) + " coins"); - } - break; - case 4: - if (lowestBinAvg > 0) { - if (!added) { - tooltip.add(""); - added = true; - } - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AVG Lowest BIN: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + - (shortNumber && lowestBinAvg > 1000 ? Utils.shortNumberFormat(lowestBinAvg, 0) : format.format(lowestBinAvg)) + " coins"); - } - break; - case 5: - if (Constants.ESSENCECOSTS == null) break; - JsonObject essenceCosts = Constants.ESSENCECOSTS; - if (!essenceCosts.has(internalname)) { - break; - } - JsonObject itemCosts = essenceCosts.get(internalname).getAsJsonObject(); - String essenceType = itemCosts.get("type").getAsString(); + } + break; + case 2: + if (auctionInfo != null) { + if (!added) { + tooltip.add(""); + added = true; + } + if (auctionInfo.has("clean_price")) { + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales (Clean): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + (auctionInfo.get("clean_sales").getAsFloat() < 2 ? + format.format(auctionInfo.get("clean_sales").getAsFloat()) + " sale/day" + : + format.format(auctionInfo.get("clean_sales").getAsFloat()) + " sales/day")); + } else { + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + (auctionInfo.get("sales").getAsFloat() < 2 ? format.format(auctionInfo.get("sales").getAsFloat()) + + " sale/day" + : format.format(auctionInfo.get("sales").getAsFloat()) + + " sales/day")); + } + } + break; + case 3: + if (craftCost != null && craftCost.fromRecipe) { + if ((int) craftCost.craftCost == 0) { + continue; + } + if (!added) { + tooltip.add(""); + added = true; + } + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + (shortNumber && craftCost.craftCost > 1000 + ? Utils.shortNumberFormat(craftCost.craftCost, 0) + : format.format((int) craftCost.craftCost)) + " coins"); + } + break; + case 4: + if (lowestBinAvg > 0) { + if (!added) { + tooltip.add(""); + added = true; + } + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AVG Lowest BIN: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + (shortNumber && lowestBinAvg > 1000 + ? Utils.shortNumberFormat(lowestBinAvg, 0) + : format.format(lowestBinAvg)) + " coins"); + } + break; + case 5: + if (Constants.ESSENCECOSTS == null) break; + JsonObject essenceCosts = Constants.ESSENCECOSTS; + if (!essenceCosts.has(internalname)) { + break; + } + JsonObject itemCosts = essenceCosts.get(internalname).getAsJsonObject(); + String essenceType = itemCosts.get("type").getAsString(); - int dungeonItemLevel = -1; - if (stack != null && stack.hasTagCompound() && - stack.getTagCompound().hasKey("ExtraAttributes", 10)) { - NBTTagCompound ea = stack.getTagCompound().getCompoundTag("ExtraAttributes"); + int dungeonItemLevel = -1; + if (stack != null && stack.hasTagCompound() && + stack.getTagCompound().hasKey("ExtraAttributes", 10)) { + NBTTagCompound ea = stack.getTagCompound().getCompoundTag("ExtraAttributes"); - if (ea.hasKey("dungeon_item_level", 99)) { - dungeonItemLevel = ea.getInteger("dungeon_item_level"); - } - } - if (dungeonItemLevel == -1) { - int dungeonizeCost = 0; - if (itemCosts.has("dungeonize")) { - dungeonizeCost = itemCosts.get("dungeonize").getAsInt(); - } - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Dungeonize Cost: " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + dungeonizeCost + " " + essenceType); - } else if (dungeonItemLevel >= 0 && dungeonItemLevel <= 4) { - String costType = (dungeonItemLevel + 1) + ""; + if (ea.hasKey("dungeon_item_level", 99)) { + dungeonItemLevel = ea.getInteger("dungeon_item_level"); + } + } + if (dungeonItemLevel == -1) { + int dungeonizeCost = 0; + if (itemCosts.has("dungeonize")) { + dungeonizeCost = itemCosts.get("dungeonize").getAsInt(); + } + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Dungeonize Cost: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + dungeonizeCost + " " + essenceType); + } else if (dungeonItemLevel >= 0 && dungeonItemLevel <= 4) { + String costType = (dungeonItemLevel + 1) + ""; - int upgradeCost = itemCosts.get(costType).getAsInt(); - StringBuilder star = new StringBuilder(); - for (int i = 0; i <= dungeonItemLevel; i++) { - star.append('\u272A'); - } - tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Upgrade to " + - EnumChatFormatting.GOLD + star + EnumChatFormatting.YELLOW + EnumChatFormatting.BOLD + ": " + - EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + upgradeCost + " " + essenceType); - } - break; - } - } + int upgradeCost = itemCosts.get(costType).getAsInt(); + StringBuilder star = new StringBuilder(); + for (int i = 0; i <= dungeonItemLevel; i++) { + star.append('\u272A'); + } + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Upgrade to " + + EnumChatFormatting.GOLD + star + EnumChatFormatting.YELLOW + EnumChatFormatting.BOLD + ": " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + upgradeCost + " " + essenceType); + } + break; + } + } - return added; - } else if (auctionInfoErrored) { - String message = EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "[NEU] API is down"; - if (auctionableItems != null && !auctionableItems.isEmpty()) { - if (auctionableItems.contains(internalname)) { - tooltip.add(message); - return true; - } - } else { - tooltip.add(message + " and no item data is cached"); - return true; - } - } + return added; + } else if (auctionInfoErrored) { + String message = EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "[NEU] API is down"; + if (auctionableItems != null && !auctionableItems.isEmpty()) { + if (auctionableItems.contains(internalname)) { + tooltip.add(message); + return true; + } + } else { + tooltip.add(message + " and no item data is cached"); + return true; + } + } - return false; - } + return false; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java index df06aae7..d83035d0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java @@ -3,9 +3,9 @@ package io.github.moulberry.notenoughupdates; import net.minecraftforge.fml.relauncher.ReflectionHelper; public class NEUApi { - static boolean disableInventoryButtons = false; + static boolean disableInventoryButtons = false; - public static void setInventoryButtonsToDisabled() { - disableInventoryButtons = true; - } + public static void setInventoryButtonsToDisabled() { + disableInventoryButtons = true; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 6af0d057..84289e34 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -75,332 +75,351 @@ import static io.github.moulberry.notenoughupdates.util.GuiTextures.dungeon_ches public class NEUEventListener { - private final NotEnoughUpdates neu; - - private boolean hoverInv = false; - private boolean focusInv = false; - - private boolean joinedSB = false; - - public NEUEventListener(NotEnoughUpdates neu) { - this.neu = neu; - } - - private void displayUpdateMessageIfOutOfDate() { - File repo = neu.manager.repoLocation; - if (repo.exists()) { - File updateJson = new File(repo, "update.json"); - try { - JsonObject o = neu.manager.getJsonFromFile(updateJson); - - String version = o.get("version").getAsString(); - String preVersion = o.get("pre_version").getAsString(); - - boolean shouldUpdate = !NotEnoughUpdates.VERSION.equalsIgnoreCase(version); - boolean shouldPreUpdate = !NotEnoughUpdates.PRE_VERSION.equalsIgnoreCase(preVersion); - - if (o.has("version_id") && o.get("version_id").isJsonPrimitive()) { - int version_id = o.get("version_id").getAsInt(); - shouldUpdate = version_id > NotEnoughUpdates.VERSION_ID; - } - if (o.has("pre_version_id") && o.get("pre_version_id").isJsonPrimitive()) { - int pre_version_id = o.get("pre_version_id").getAsInt(); - shouldPreUpdate = pre_version_id > NotEnoughUpdates.PRE_VERSION_ID; - } - - if (shouldUpdate) { - String update_msg = o.get("update_msg").getAsString(); - - int first_len = -1; - for (String line : update_msg.split("\n")) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int len = fr.getStringWidth(line); - if (first_len == -1) { - first_len = len; - } - int missing_len = first_len - len; - if (missing_len > 0) { - StringBuilder sb = new StringBuilder(line); - for (int i = 0; i < missing_len / 8; i++) { - sb.insert(0, " "); - } - line = sb.toString(); - } - line = line.replaceAll("\\{version}", version); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(line)); - } - - neu.displayLinks(o); - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - } else if (shouldPreUpdate && NotEnoughUpdates.VERSION_ID == o.get("version").getAsInt()) { - String pre_update_msg = o.get("pre_update_msg").getAsString(); - - int first_len = -1; - for (String line : pre_update_msg.split("\n")) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int len = fr.getStringWidth(line); - if (first_len == -1) { - first_len = len; - } - int missing_len = first_len - len; - if (missing_len > 0) { - StringBuilder sb = new StringBuilder(line); - for (int i = 0; i < missing_len / 8; i++) { - sb.insert(0, " "); - } - line = sb.toString(); - } - line = line.replaceAll("\\{pre_version}", preVersion); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(line)); - } - - neu.displayLinks(o); - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - } - } catch (Exception ignored) {} - } - } - - @SubscribeEvent - public void onWorldLoad(WorldEvent.Unload event) { - NotEnoughUpdates.INSTANCE.saveConfig(); - CrystalMetalDetectorSolver.reset(false); - } - - private static long notificationDisplayMillis = 0; - private static List notificationLines = null; - private static boolean showNotificationOverInv = false; - - private static final Pattern BAD_ITEM_REGEX = Pattern.compile("x[0-9]{1,2}$"); - private static final Pattern SLAYER_XP = Pattern.compile(" (Spider|Zombie|Wolf|Enderman) Slayer LVL (\\d) - (?:Next LVL in ([\\d,]+) XP!|LVL MAXED OUT!)"); - - /** - * 1)Will send the cached message from #sendChatMessage when at least 200ms has passed since the last message. - * This is used in order to prevent the mod spamming messages. - * 2)Adds unique items to the collection log - */ - private boolean preloadedItems = false; - private long lastLongUpdate = 0; - private long lastSkyblockScoreboard = 0; - - private final ExecutorService itemPreloader = Executors.newFixedThreadPool(10); - private final List toPreload = new ArrayList<>(); - - private int inventoryLoadedTicks = 0; - private String loadedInvName = ""; - public static boolean inventoryLoaded = false; - - public static void displayNotification(List lines, boolean showForever) { - displayNotification(lines, showForever, false); - } - - public static void displayNotification(List lines, boolean showForever, boolean overInventory) { - if (showForever) { - notificationDisplayMillis = -420; - } else { - notificationDisplayMillis = System.currentTimeMillis(); - } - notificationLines = lines; - showNotificationOverInv = overInventory; - } - - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if (Minecraft.getMinecraft().currentScreen != null && (Minecraft.getMinecraft().currentScreen instanceof GuiChat - || Minecraft.getMinecraft().currentScreen instanceof GuiEditSign || Minecraft.getMinecraft().currentScreen instanceof GuiScreenBook)) { - Keyboard.enableRepeatEvents(true); - } else { - Keyboard.enableRepeatEvents(false); - } - if (event.phase != TickEvent.Phase.START) return; - if (Minecraft.getMinecraft().theWorld == null) return; - if (Minecraft.getMinecraft().thePlayer == null) return; - - if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { - GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - ContainerChest cc = (ContainerChest) chest.inventorySlots; - - if (!loadedInvName.equals(cc.getLowerChestInventory().getDisplayName().getUnformattedText())) { - loadedInvName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - inventoryLoaded = false; - inventoryLoadedTicks = 3; - } - - if (!inventoryLoaded) { - if (cc.g