aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java75
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java107
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java100
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java45
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java263
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.java134
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DungeonWinTestCommand.java42
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/NullzeeSphereCommand.java61
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.java304
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ReloadRepoCommand.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ResetRepoCommand.java42
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java200
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java40
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java57
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java131
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java60
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java94
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.java52
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.java53
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.java45
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java60
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java75
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalendarCommand.java41
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CosmeticsCommand.java47
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CustomizeCommand.java63
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java94
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/UpdateCommand.java76
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java343
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PvCommand.java41
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java102
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java33
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java42
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java76
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/envcheck/NEUMixinConfigPlugin.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/events/GuiContainerBackgroundDrawnEvent.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.java)22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java35
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java392
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java49
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java211
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java870
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java80
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/GardenNpcPrices.java87
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java115
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MutingComposter.java57
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java61
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PresetWarning.java217
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java336
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java325
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java100
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java46
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java65
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java878
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorCommandHandler.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DhCommand.java)26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java27
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java37
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java32
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerArmorBase.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerCustomHead.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOFDynamicLights.java40
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java57
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Garden.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/commands/dev/EnableStorageCommand.java)35
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Museum.java64
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/CombatSkillOverlay.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java60
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java32
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java319
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java76
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java30
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java58
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java36
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java96
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java51
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java108
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java46
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java90
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java50
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java45
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java208
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java74
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/LRUCache.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java232
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/brigadier/NEUBrigadierHook.kt109
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt256
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.kt78
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/NEUStatsCommand.kt209
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt165
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/SimpleDevCommands.kt110
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt65
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt95
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt52
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.kt53
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.kt48
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt67
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt144
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/FairySoulsCommand.kt62
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/MiscCommands.kt175
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/PeekCommand.kt318
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt87
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt52
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/events/ButtonExclusionZoneEvent.kt69
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/events/RegisterBrigadierCommandEvent.kt52
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/guifeatures/SkyMallDisplay.kt103
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt211
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumCheapestItemOverlay.kt574
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumItemHighlighter.kt121
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/DynamicLightItemsEditor.kt255
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt1
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt217
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/ErrorUtil.kt43
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt116
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/KotlinStringUtils.kt (renamed from src/main/java/io/github/moulberry/notenoughupdates/commands/profile/CataCommand.java)18
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.kt47
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/MuseumUtil.kt113
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt75
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTime.kt122
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/BrigadierRoot.kt103
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/EnumArgumentType.kt64
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/RestArgumentType.kt31
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt179
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/iterate.kt28
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/kotlin/completablefuture.kt (renamed from src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java)37
-rw-r--r--src/main/resources/assets/notenoughupdates/disabled_button.pngbin0 -> 161 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/dynamic_light_items_editor.pngbin0 -> 439 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/enabled_button.pngbin0 -> 158 bytes
-rw-r--r--src/main/resources/mixins.notenoughupdates.json3
-rw-r--r--src/test/kotlin/io/github/moulberry/notenoughupdates/util/RectangleTest.kt49
-rw-r--r--src/test/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTimeTest.kt66
208 files changed, 8368 insertions, 6381 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index 5c3083a3..5eab77f9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -37,7 +37,6 @@ import io.github.moulberry.notenoughupdates.recipes.NeuRecipe;
import io.github.moulberry.notenoughupdates.recipes.RecipeHistory;
import io.github.moulberry.notenoughupdates.util.ApiUtil;
import io.github.moulberry.notenoughupdates.util.Constants;
-import io.github.moulberry.notenoughupdates.util.HotmInformation;
import io.github.moulberry.notenoughupdates.util.ItemResolutionQuery;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.SBInfo;
@@ -103,7 +102,7 @@ public class NEUManager {
private final TreeMap<String, JsonObject> itemMap = new TreeMap<>();
private boolean hasBeenLoadedBefore = false;
- private final TreeMap<String, HashMap<String, List<Integer>>> titleWordMap = new TreeMap<>();
+ public final TreeMap<String, HashMap<String, List<Integer>>> titleWordMap = new TreeMap<>();
private final TreeMap<String, HashMap<String, List<Integer>>> loreWordMap = new TreeMap<>();
public final KeyBinding keybindGive =
@@ -144,7 +143,6 @@ public class NEUManager {
public File configLocation;
public File repoLocation;
public File configFile;
- public HotmInformation hotm;
public KatSitterOverlay katSitterOverlay;
@@ -154,7 +152,6 @@ public class NEUManager {
this.neu = neu;
this.configLocation = configLocation;
this.auctionManager = new APIManager(this);
- this.hotm = new HotmInformation(neu);
this.craftingOverlay = new CraftingOverlay(this);
this.katSitterOverlay = new KatSitterOverlay();
@@ -323,7 +320,7 @@ public class NEUManager {
synchronized (titleWordMap) {
int wordIndex = 0;
for (String str : json.get("displayname").getAsString().split(" ")) {
- str = clean(str);
+ str = cleanForTitleMapSearch(str);
if (!titleWordMap.containsKey(str)) {
titleWordMap.put(str, new HashMap<>());
}
@@ -341,7 +338,7 @@ public class NEUManager {
int wordIndex = 0;
for (JsonElement element : json.get("lore").getAsJsonArray()) {
for (String str : element.getAsString().split(" ")) {
- str = clean(str);
+ str = cleanForTitleMapSearch(str);
if (!loreWordMap.containsKey(str)) {
loreWordMap.put(str, new HashMap<>());
}
@@ -469,8 +466,8 @@ public class NEUManager {
int lastStringMatch = -1;
ArrayList<DebugMatch> debugMatches = new ArrayList<>();
- toSearch = clean(toSearch).toLowerCase();
- query = clean(query).toLowerCase();
+ toSearch = cleanForTitleMapSearch(toSearch).toLowerCase();
+ query = cleanForTitleMapSearch(query).toLowerCase();
String[] splitToSearch = toSearch.split(" ");
String[] queryArray = query.split(" ");
@@ -687,7 +684,7 @@ public class NEUManager {
public Set<String> search(String query, TreeMap<String, HashMap<String, List<Integer>>> wordMap) {
HashMap<String, List<Integer>> matches = null;
- query = clean(query).toLowerCase();
+ query = cleanForTitleMapSearch(query).toLowerCase();
for (String queryWord : query.split(" ")) {
HashMap<String, List<Integer>> matchesToKeep = new HashMap<>();
for (HashMap<String, List<Integer>> wordMatches : subMapWithKeysThatAreSuffixes(queryWord, wordMap).values()) {
@@ -862,7 +859,7 @@ public class NEUManager {
return item;
}
- private String clean(String str) {
+ public static String cleanForTitleMapSearch(String str) {
return str.replaceAll("(\u00a7.)|[^0-9a-zA-Z ]", "").toLowerCase().trim();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 7159ef89..ce7b21b2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -1500,7 +1500,14 @@ public class NEUOverlay extends Gui {
int actualIndex = index + getSlotsXSize() * getSlotsYSize() * page;
List<JsonObject> searchedItems = getSearchedItems();
if (0 <= actualIndex && actualIndex < searchedItems.size()) {
- return searchedItems.get(actualIndex);
+ try {
+ return searchedItems.get(actualIndex);
+ } catch (IndexOutOfBoundsException e) {
+ System.out.println("searchedItems size: " + searchedItems.size());
+ System.out.println("actualIndex: " + actualIndex);
+ e.printStackTrace();
+ return null;
+ }
} else {
return null;
}
@@ -1658,7 +1665,7 @@ public class NEUOverlay extends Gui {
buttonXSize, ySize, 1 - leftPressed, leftPressed, 1 - leftPressed, leftPressed
);
GlStateManager.bindTexture(0);
- Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Prev", fr,
+ Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Prev",
leftSide - 1 + buttonXSize * 300 / 480f + leftPressed,
top + ySize / 2f + leftPressed, false,
(int) (buttonXSize * 240 / 480f), Color.BLACK.getRGB()
@@ -1677,7 +1684,7 @@ public class NEUOverlay extends Gui {
buttonXSize, ySize, 1 - rightPressed, rightPressed, 1 - rightPressed, rightPressed
);
GlStateManager.bindTexture(0);
- Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Next", fr,
+ Utils.drawStringCenteredScaled(EnumChatFormatting.BOLD + "Next",
rightSide + 1 - buttonXSize * 300 / 480f + rightPressed,
top + ySize / 2f + rightPressed, false,
(int) (buttonXSize * 240 / 480f), Color.BLACK.getRGB()
@@ -1692,7 +1699,7 @@ public class NEUOverlay extends Gui {
new Color(50, 50, 50).getRGB()
);
drawRect(leftSide + buttonXSize + 3, top + 1, rightSide - buttonXSize - 3, top + ySize - 1, fg.getRGB());
- Utils.drawStringCenteredScaledMaxWidth(pageText, fr, (leftSide + rightSide) / 2,
+ Utils.drawStringCenteredScaledMaxWidth(pageText, (leftSide + rightSide) / 2,
top + ySize / 2f, false, strMaxLen, Color.BLACK.getRGB()
);
}
@@ -1838,8 +1845,6 @@ public class NEUOverlay extends Gui {
}
GlStateManager.enableDepth();
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
-
Utils.resetGuiScale();
Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.itemlist.paneGuiScale);
@@ -2231,7 +2236,7 @@ public class NEUOverlay extends Gui {
textToDisplay = text;
}
if (textToDisplay != null) {
- Utils.drawHoveringText(textToDisplay, mouseX, mouseY, width, height, -1, fr);
+ Utils.drawHoveringText(textToDisplay, mouseX, mouseY, width, height, -1);
textToDisplay = null;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 25d1002a..8b6c2255 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -25,7 +25,6 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.autosubscribe.AutoLoad;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
-import io.github.moulberry.notenoughupdates.commands.Commands;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.listener.ChatListener;
@@ -44,6 +43,8 @@ import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBlockSounds;
+import io.github.moulberry.notenoughupdates.miscfeatures.inventory.MuseumCheapestItemOverlay;
+import io.github.moulberry.notenoughupdates.miscfeatures.inventory.MuseumItemHighlighter;
import io.github.moulberry.notenoughupdates.miscfeatures.updater.AutoUpdater;
import io.github.moulberry.notenoughupdates.mixins.AccessorMinecraft;
import io.github.moulberry.notenoughupdates.oneconfig.IOneConfigCompat;
@@ -52,6 +53,7 @@ import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.recipes.RecipeGenerator;
import io.github.moulberry.notenoughupdates.util.Utils;
+import io.github.moulberry.notenoughupdates.util.brigadier.BrigadierRoot;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
@@ -158,7 +160,6 @@ public class NotEnoughUpdates {
public Navigation navigation = new Navigation(this);
public GuiScreen openGui = null;
public long lastOpenedGui = 0;
- public Commands commands;
public boolean packDevEnabled = false;
public Color[][] colourMap = null;
public AutoUpdater autoUpdater = new AutoUpdater(this);
@@ -169,6 +170,13 @@ public class NotEnoughUpdates {
private File neuDir;
private boolean hasSkyblockScoreboard;
+ public NotEnoughUpdates() {
+ // Budget Construction Event
+ ((AccessorMinecraft) FMLClientHandler.instance().getClient())
+ .onGetDefaultResourcePacks()
+ .add(new NEURepoResourcePack(null, "neurepo"));
+ }
+
public File getConfigFile() {
return this.configFile;
}
@@ -181,13 +189,6 @@ public class NotEnoughUpdates {
return this.neuDir;
}
- public NotEnoughUpdates() {
- // Budget Construction Event
- ((AccessorMinecraft) FMLClientHandler.instance().getClient())
- .onGetDefaultResourcePacks()
- .add(new NEURepoResourcePack(null, "neurepo"));
- }
-
/**
* Instantiates NEUIo, NEUManager and NEUOverlay instances. Registers keybinds and adds a shutdown hook to clear tmp folder.
*/
@@ -271,6 +272,8 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(navigation);
MinecraftForge.EVENT_BUS.register(new WorldListener(this));
AutoLoad.INSTANCE.provide(supplier -> MinecraftForge.EVENT_BUS.register(supplier.get()));
+ MinecraftForge.EVENT_BUS.register(MuseumItemHighlighter.INSTANCE);
+ MinecraftForge.EVENT_BUS.register(MuseumCheapestItemOverlay.INSTANCE);
if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
IReloadableResourceManager manager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
@@ -281,7 +284,7 @@ public class NotEnoughUpdates {
manager.registerReloadListener(new CustomBlockSounds.ReloaderListener());
}
- this.commands = new Commands();
+ BrigadierRoot.INSTANCE.updateHooks();
BackgroundBlur.registerListener();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
index 5ec3724a..ac60ffd9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -292,7 +292,7 @@ public class APIManager {
.newMoulberryRequest("lowestbin.json.gz")
.gunzip()
.requestJson()
- .thenAccept(jsonObject -> {
+ .thenAcceptAsync(jsonObject -> {
if (lowestBins == null) {
lowestBins = new JsonObject();
}
@@ -465,12 +465,12 @@ public class APIManager {
};
manager.apiUtils.newMoulberryRequest("auctionLast.json.gz")
- .gunzip().requestJson().thenAccept(process);
+ .gunzip().requestJson().thenAcceptAsync(process);
manager.apiUtils
.newMoulberryRequest("auction.json.gz")
.gunzip().requestJson()
- .thenAccept(jsonObject -> {
+ .thenAcceptAsync(jsonObject -> {
if (jsonObject.get("success").getAsBoolean()) {
long apiUpdate = (long) jsonObject.get("time").getAsFloat();
if (lastApiUpdate == apiUpdate) {
@@ -683,7 +683,7 @@ public class APIManager {
manager.apiUtils
.newAnonymousHypixelApiRequest("skyblock/auctions")
.requestJson()
- .thenAccept(jsonObject -> {
+ .thenAcceptAsync(jsonObject -> {
if (jsonObject == null) return;
if (jsonObject.get("success").getAsBoolean()) {
@@ -733,7 +733,7 @@ public class APIManager {
manager.apiUtils
.newAnonymousHypixelApiRequest("skyblock/bazaar")
.requestJson()
- .thenAccept(jsonObject -> {
+ .thenAcceptAsync(jsonObject -> {
if (!jsonObject.get("success").getAsBoolean()) return;
craftCost.clear();
@@ -789,7 +789,7 @@ public class APIManager {
public void updateAvgPrices() {
manager.apiUtils
.newMoulberryRequest("auction_averages/3day.json.gz")
- .gunzip().requestJson().thenAccept((jsonObject) -> {
+ .gunzip().requestJson().thenAcceptAsync((jsonObject) -> {
craftCost.clear();
auctionPricesJson = jsonObject;
lastAuctionAvgUpdate = System.currentTimeMillis();
@@ -797,7 +797,7 @@ public class APIManager {
manager.apiUtils
.newMoulberryRequest("auction_averages_lbin/1day.json.gz")
.gunzip().requestJson()
- .thenAccept((jsonObject) -> {
+ .thenAcceptAsync((jsonObject) -> {
auctionPricesAvgLowestBinJson = jsonObject;
});
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
index 07ec4a59..e1ccdef7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
@@ -580,6 +580,7 @@ public class CustomAH extends Gui {
}
List<String> tooltipToRender = null;
+ int black = Color.BLACK.getRGB();
if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
resetCurrAucIdTimer = System.currentTimeMillis();
GuiChest auctionView = (GuiChest) Minecraft.getMinecraft().currentScreen;
@@ -620,9 +621,7 @@ public class CustomAH extends Gui {
endsInStr = EnumChatFormatting.DARK_PURPLE + prettyTime(
auctionViewEndsIn + lastGuiScreenSwitch - System.currentTimeMillis());
}
- Utils.drawStringCenteredScaledMaxWidth(endsInStr, Minecraft.getMinecraft().fontRendererObj,
- auctionViewLeft + 39, guiTop + 20, false, 70, 4210752
- );
+ Utils.drawStringCenteredScaledMaxWidth(endsInStr, auctionViewLeft + 39, guiTop + 20, false, 70, 4210752);
}
Utils.drawItemStack(leftStack, auctionViewLeft + 31, guiTop + 100);
@@ -790,9 +789,7 @@ public class CustomAH extends Gui {
}
}
- Utils.drawStringCenteredScaledMaxWidth(containerName, Minecraft.getMinecraft().fontRendererObj,
- auctionViewLeft + 39, guiTop + 10, false, 70, 4210752
- );
+ Utils.drawStringCenteredScaledMaxWidth(containerName, auctionViewLeft + 39, guiTop + 10, false, 70, 4210752);
} else if (isEditingPrice()) {
hasPopup = true;
resetCurrAucIdTimer = System.currentTimeMillis();
@@ -810,9 +807,7 @@ public class CustomAH extends Gui {
this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 96, 99);
priceField.drawTextBox();
- Utils.drawStringCenteredScaledMaxWidth("Bid Amount", Minecraft.getMinecraft().fontRendererObj,
- auctionViewLeft + 39, guiTop + 10, false, 70, 4210752
- );
+ Utils.drawStringCenteredScaledMaxWidth("Bid Amount", auctionViewLeft + 39, guiTop + 10, false, 70, 4210752);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
@@ -822,22 +817,11 @@ public class CustomAH extends Gui {
this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 50, 0, 16, 30, 16);
this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 68, 0, 32, 64, 16);
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- Utils.drawStringCentered("x2", fr, auctionViewLeft + 16 + 15, guiTop + 32 + 8, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered("+50%", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered("+25%", fr, auctionViewLeft + 16 + 15, guiTop + 50 + 8, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered("+10%", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 50 + 8, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered("Set Amount", fr, auctionViewLeft + 16 + 32, guiTop + 68 + 8, false,
- Color.BLACK.getRGB()
- );
+ Utils.drawStringCentered("x2", auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, black);
+ Utils.drawStringCentered("+50%", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, black);
+ Utils.drawStringCentered("+25%", auctionViewLeft + 16 + 15, guiTop + 50 + 8, false, black);
+ Utils.drawStringCentered("+10%", auctionViewLeft + 16 + 34 + 15, guiTop + 50 + 8, false, black);
+ Utils.drawStringCentered("Set Amount", auctionViewLeft + 16 + 32, guiTop + 68 + 8, false, black);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GuiEditSign editSign = (GuiEditSign) Minecraft.getMinecraft().currentScreen;
@@ -907,7 +891,7 @@ public class CustomAH extends Gui {
this.drawTexturedModalRect(guiLeft, y, 0, ySplit, getXSize(), 136 - ySplit);
//GUI Name
- Utils.drawStringCenteredScaledMaxWidth("Auction House", Minecraft.getMinecraft().fontRendererObj, guiLeft + 42,
+ Utils.drawStringCenteredScaledMaxWidth("Auction House", guiLeft + 42,
guiTop + 10, false, 68, 4210752
);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
@@ -1000,7 +984,7 @@ public class CustomAH extends Gui {
if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
Utils.drawStringCentered(EnumChatFormatting.RED + "NEUAH is DISABLED! Enable in /neu.",
- Minecraft.getMinecraft().fontRendererObj, guiLeft + getXSize() / 2, guiTop + getYSize() / 2 - 5, true, 0
+ guiLeft + getXSize() / 2, guiTop + getYSize() / 2 - 5, true, 0
);
}
@@ -1009,9 +993,7 @@ public class CustomAH extends Gui {
for (String line : tooltipToRender) {
tooltipGray.add(EnumChatFormatting.GRAY + line);
}
- Utils.drawHoveringText(tooltipGray, mouseX, mouseY, width,
- height, -1, Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltipGray, mouseX, mouseY, width, height, -1);
}
float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f));
int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (78 + 4));
@@ -1032,9 +1014,7 @@ public class CustomAH extends Gui {
}
priceFilterField.drawTextBox();
- Utils.drawStringCenteredScaledMaxWidth("Price Filter", Minecraft.getMinecraft().fontRendererObj,
- auctionViewLeft + 39, guiTop + 10, false, 70, 4210752
- );
+ Utils.drawStringCenteredScaledMaxWidth("Price Filter", auctionViewLeft + 39, guiTop + 10, false, 70, 421052);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
@@ -1054,16 +1034,9 @@ public class CustomAH extends Gui {
this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 0, 32, 64, 16);
}
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- Utils.drawStringCentered("<=", fr, auctionViewLeft + 16 + 15, guiTop + 32 + 8, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered(">=", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered("==", fr, auctionViewLeft + 16 + 32, guiTop + 50 + 8, false,
- Color.BLACK.getRGB()
- );
+ Utils.drawStringCentered("<=", auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, black);
+ Utils.drawStringCentered(">=", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, black);
+ Utils.drawStringCentered("==", auctionViewLeft + 16 + 32, guiTop + 50 + 8, false, black);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
// Bin average price filter
@@ -1079,9 +1052,7 @@ public class CustomAH extends Gui {
}
binPriceFilterField.drawTextBox();
- Utils.drawStringCenteredScaledMaxWidth("BIN Average Filter", Minecraft.getMinecraft().fontRendererObj,
- auctionViewLeft + 39, guiTop + 10 + binPriceFilterYOffset, false, 70, 4210752
- );
+ Utils.drawStringCenteredScaledMaxWidth("BIN Average Filter", auctionViewLeft + 39, guiTop + 10 + binPriceFilterYOffset, false, 70, 4210752);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
@@ -1101,15 +1072,9 @@ public class CustomAH extends Gui {
this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50 + binPriceFilterYOffset, 0, 32, 64, 16);
}
- Utils.drawStringCentered("<=", fr, auctionViewLeft + 16 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered(">=", fr, auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false,
- Color.BLACK.getRGB()
- );
- Utils.drawStringCentered("==", fr, auctionViewLeft + 16 + 32, guiTop + 50 + 8 + binPriceFilterYOffset, false,
- Color.BLACK.getRGB()
- );
+ Utils.drawStringCentered("<=", auctionViewLeft + 16 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, black);
+ Utils.drawStringCentered(">=", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, black);
+ Utils.drawStringCentered("==", auctionViewLeft + 16 + 32, guiTop + 50 + 8 + binPriceFilterYOffset, false, black);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
deleted file mode 100644
index 91365cd1..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.dev.DevTestCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.DiagCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.DungeonWinTestCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.EnableStorageCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.NullzeeSphereCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.PackDevCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.ReloadRepoCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.ResetRepoCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.StatsCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.DhCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.DnCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.JoinDungeonCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.MapCommand;
-import io.github.moulberry.notenoughupdates.commands.help.FeaturesCommand;
-import io.github.moulberry.notenoughupdates.commands.help.HelpCommand;
-import io.github.moulberry.notenoughupdates.commands.help.LinksCommand;
-import io.github.moulberry.notenoughupdates.commands.help.SettingsCommand;
-import io.github.moulberry.notenoughupdates.commands.help.StorageViewerWhyCommand;
-import io.github.moulberry.notenoughupdates.commands.misc.AhCommand;
-import io.github.moulberry.notenoughupdates.commands.misc.CalculatorCommand;
-import io.github.moulberry.notenoughupdates.commands.misc.CalendarCommand;
-import io.github.moulberry.notenoughupdates.commands.misc.CosmeticsCommand;
-import io.github.moulberry.notenoughupdates.commands.misc.CustomizeCommand;
-import io.github.moulberry.notenoughupdates.commands.misc.PronounsCommand;
-import io.github.moulberry.notenoughupdates.commands.misc.UpdateCommand;
-import io.github.moulberry.notenoughupdates.commands.profile.CataCommand;
-import io.github.moulberry.notenoughupdates.commands.profile.PeekCommand;
-import io.github.moulberry.notenoughupdates.commands.profile.PvCommand;
-import io.github.moulberry.notenoughupdates.commands.profile.ViewProfileCommand;
-import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls;
-import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
-import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
-import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
-import net.minecraftforge.client.ClientCommandHandler;
-import net.minecraftforge.fml.common.Loader;
-
-public class Commands {
- public Commands() {
-
- // Help Commands
- ClientCommandHandler.instance.registerCommand(new LinksCommand());
- ClientCommandHandler.instance.registerCommand(new HelpCommand());
- ClientCommandHandler.instance.registerCommand(new StorageViewerWhyCommand());
- ClientCommandHandler.instance.registerCommand(new FeaturesCommand());
- ClientCommandHandler.instance.registerCommand(new SettingsCommand());
-
- // Dev Commands
- ClientCommandHandler.instance.registerCommand(new PackDevCommand());
- ClientCommandHandler.instance.registerCommand(new DungeonWinTestCommand());
- ClientCommandHandler.instance.registerCommand(new StatsCommand());
- ClientCommandHandler.instance.registerCommand(new DevTestCommand());
- ClientCommandHandler.instance.registerCommand(new NullzeeSphereCommand());
- ClientCommandHandler.instance.registerCommand(new DiagCommand());
- ClientCommandHandler.instance.registerCommand(new ReloadRepoCommand());
- ClientCommandHandler.instance.registerCommand(new ResetRepoCommand());
- ClientCommandHandler.instance.registerCommand(new EnableStorageCommand());
-
- // Profile Commands
- ClientCommandHandler.instance.registerCommand(new PeekCommand());
- ClientCommandHandler.instance.registerCommand(new ViewProfileCommand());
- ClientCommandHandler.instance.registerCommand(new PvCommand());
- if (!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(new CataCommand());
-
- // Dungeon Commands
- ClientCommandHandler.instance.registerCommand(new MapCommand());
- ClientCommandHandler.instance.registerCommand(new JoinDungeonCommand());
- ClientCommandHandler.instance.registerCommand(new DnCommand());
- ClientCommandHandler.instance.registerCommand(new DhCommand());
-
- // Misc Commands
- ClientCommandHandler.instance.registerCommand(new CosmeticsCommand());
- ClientCommandHandler.instance.registerCommand(new CustomizeCommand());
- ClientCommandHandler.instance.registerCommand(new ScreenCommand("neubuttons", GuiInvButtonEditor::new));
- ClientCommandHandler.instance.registerCommand(new ScreenCommand("neuec", GuiEnchantColour::new));
- ClientCommandHandler.instance.registerCommand(new ScreenCommand("neuoverlay", NEUOverlayPlacements::new));
- ClientCommandHandler.instance.registerCommand(new AhCommand());
- ClientCommandHandler.instance.registerCommand(new CalculatorCommand());
- ClientCommandHandler.instance.registerCommand(new CalendarCommand());
- ClientCommandHandler.instance.registerCommand(new UpdateCommand(NotEnoughUpdates.INSTANCE));
- ClientCommandHandler.instance.registerCommand(new PronounsCommand());
-
- // Fairy Soul Commands
- ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand());
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java
deleted file mode 100644
index e3738661..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/EntityViewerCommand.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands;
-
-import com.google.common.collect.Lists;
-import io.github.moulberry.notenoughupdates.miscfeatures.entityviewer.EntityViewer;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.event.ClickEvent;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.ChatStyle;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedDeque;
-
-public class EntityViewerCommand extends ClientCommandBase {
- public EntityViewerCommand() {
- super("neushowentity");
- MinecraftForge.EVENT_BUS.register(this);
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Lists.newArrayList("neuentityviewer");
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return EnumChatFormatting.RED + "Use /neushowentity list";
- }
-
- public void showUsage(ICommandSender sender) {
- sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
- }
-
- private final Queue<EntityViewer> queuedGUIS = new ConcurrentLinkedDeque<>();
-
- @SubscribeEvent
- public void onTick(TickEvent event) {
- if (Minecraft.getMinecraft().currentScreen == null) {
- EntityViewer poll = queuedGUIS.poll();
- if (poll == null) return;
- Minecraft.getMinecraft().displayGuiScreen(poll);
- }
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] strings) throws CommandException {
- if (strings.length == 0) {
- showUsage(sender);
- return;
- }
- if (strings[0].equals("list")) {
- for (String label : EntityViewer.validEntities.keySet()) {
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.BLUE + " " + label)
- .setChatStyle(new ChatStyle().setChatClickEvent(
- new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/neuentityviewer " + label))));
- }
- return;
- }
- EntityLivingBase entityLivingBase;
- if (strings[0].startsWith("@")) {
- ResourceLocation resourceLocation = new ResourceLocation(strings[0].substring(1));
- entityLivingBase = EntityViewer.constructEntity(resourceLocation);
- } else {
- entityLivingBase = EntityViewer.constructEntity(strings[0], Arrays.copyOfRange(strings, 1, strings.length));
- }
- if (entityLivingBase == null) {
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Could not create that entity"));
- return;
- }
- queuedGUIS.add(new EntityViewer(strings[0], entityLivingBase));
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java
deleted file mode 100644
index 1b90e5df..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/ScreenCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-
-public class ScreenCommand extends ClientCommandBase {
-
- private final ScreenOpener opener;
-
- protected ScreenCommand(String name, ScreenOpener opener) {
- super(name);
- this.opener = opener;
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- NotEnoughUpdates.INSTANCE.openGui = opener.open();
- }
-
- @FunctionalInterface
- public interface ScreenOpener {
- GuiScreen open();
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
deleted file mode 100644
index 35474ff3..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.BuildFlags;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.core.config.GuiPositionEditor;
-import io.github.moulberry.notenoughupdates.core.util.MiscUtils;
-import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper;
-import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes;
-import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent;
-import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.SpecialBlockZone;
-import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph;
-import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
-import io.github.moulberry.notenoughupdates.util.PronounDB;
-import io.github.moulberry.notenoughupdates.util.SBInfo;
-import io.github.moulberry.notenoughupdates.util.TabListUtils;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import io.github.moulberry.notenoughupdates.util.hypixelapi.ProfileCollectionInfo;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.launchwrapper.Launch;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.EnumParticleTypes;
-import net.minecraftforge.common.MinecraftForge;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class DevTestCommand extends ClientCommandBase {
-
- private static final List<String> DEV_TESTERS =
- Arrays.asList(
- "d0e05de7-6067-454d-beae-c6d19d886191", // moulberry
- "66502b40-6ac1-4d33-950d-3df110297aab", // lucycoconut
- "a5761ff3-c710-4cab-b4f4-3e7f017a8dbf", // ironm00n
- "5d5c548a-790c-4fc8-bd8f-d25b04857f44", // ariyio
- "53924f1a-87e6-4709-8e53-f1c7d13dc239", // throwpo
- "d3cb85e2-3075-48a1-b213-a9bfb62360c1", // lrg89
- "0b4d470f-f2fb-4874-9334-1eaef8ba4804", // dediamondpro
- "ebb28704-ed85-43a6-9e24-2fe9883df9c2", // lulonaut
- "698e199d-6bd1-4b10-ab0c-52fedd1460dc", // craftyoldminer
- "8a9f1841-48e9-48ed-b14f-76a124e6c9df", // eisengolem
- "a7d6b3f1-8425-48e5-8acc-9a38ab9b86f7", // whalker
- "0ce87d5a-fa5f-4619-ae78-872d9c5e07fe", // ascynx
- "a049a538-4dd8-43f8-87d5-03f09d48b4dc", // egirlefe
- "7a9dc802-d401-4d7d-93c0-8dd1bc98c70d", // efefury
- "bb855349-dfd8-4125-a750-5fc2cf543ad5" // hannibal2
- );
-
- private static final String[] DEV_FAIL_STRINGS = {
- "No.",
- "I said no.",
- "You aren't allowed to use this.",
- "Are you sure you want to use this? Type 'Yes' in chat.",
- "Are you sure you want to use this? Type 'Yes' in chat.",
- "Lmao you thought",
- "Ok please stop",
- "What do you want from me?",
- "This command almost certainly does nothing useful for you",
- "Ok, this is the last message, after this it will repeat",
- "No.",
- "I said no.",
- "Dammit. I thought that would work. Uhh...",
- "\u00a7dFrom \u00a7c[ADMIN] Minikloon\u00a77: If you use that command again, I'll have to ban you",
- "",
- "Ok, this is actually the last message, use the command again and you'll crash I promise"
- };
- private int devFailIndex = 0;
-
- public DevTestCommand() {
- super("neudevtest");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (!DEV_TESTERS.contains(Minecraft.getMinecraft().thePlayer.getUniqueID().toString())
- && !(boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) {
- if (devFailIndex >= DEV_FAIL_STRINGS.length) {
- throw new Error("L") {
- @Override
- public void printStackTrace() {
- throw new Error("L");
- }
- };
- }
- if (devFailIndex == DEV_FAIL_STRINGS.length - 2) {
- devFailIndex++;
-
- ChatComponentText component = new ChatComponentText("\u00a7cYou are permanently banned from this server!");
- component.appendText("\n");
- component.appendText("\n\u00a77Reason: \u00a7rI told you not to run the command - Moulberry");
- component.appendText("\n\u00a77Find out more: \u00a7b\u00a7nhttps://www.hypixel.net/appeal");
- component.appendText("\n");
- component.appendText("\n\u00a77Ban ID: \u00a7r#49871982");
- component.appendText("\n\u00a77Sharing your Ban ID may affect the processing of your appeal!");
- Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(component);
- return;
- }
- Utils.addChatMessage(EnumChatFormatting.RED + DEV_FAIL_STRINGS[devFailIndex++]);
- return;
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("testprofile")) {
- NotEnoughUpdates.INSTANCE.manager.apiUtils.newHypixelApiRequest("skyblock/profiles")
- .queryArgument(
- "uuid",
- "" + Minecraft.getMinecraft().thePlayer.getUniqueID()
- )
- .requestJson()
- .thenApply(jsonObject -> {
- JsonArray profiles = jsonObject.get("profiles").getAsJsonArray();
- JsonObject cp = null;
- for (JsonElement profile : profiles) {
- JsonObject asJsonObject = profile.getAsJsonObject();
- if ((asJsonObject.has("selected") &&
- asJsonObject.get("selected").getAsBoolean()) || cp == null) {
- cp = asJsonObject;
- }
- }
- return cp;
- })
- .thenCompose(obj -> ProfileCollectionInfo.getCollectionData(
- obj,
- Minecraft.getMinecraft().thePlayer.getUniqueID().toString()
- ))
- .thenAccept(it ->
- Utils.addChatMessage("Response: " + it));
- }
- if (args.length >= 1 && args[0].equalsIgnoreCase("profileinfo")) {
- String currentProfile = SBInfo.getInstance().currentProfile;
- SBInfo.Gamemode gamemode = SBInfo.getInstance().getGamemodeForProfile(currentProfile);
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD +
- "You are on Profile " +
- currentProfile +
- " with the mode " +
- gamemode));
- }
- if (args.length >= 1 && args[0].equalsIgnoreCase("buildflags")) {
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
- "BuildFlags: \n" +
- BuildFlags.getAllFlags().entrySet().stream()
- .map(it -> " + " + it.getKey() + " - " + it.getValue())
- .collect(Collectors.joining("\n"))));
- return;
- }
- if (args.length >= 1 && args[0].equalsIgnoreCase("exteditor")) {
- if (args.length > 1) {
- NotEnoughUpdates.INSTANCE.config.hidden.externalEditor = String.join(
- " ",
- Arrays.copyOfRange(args, 1, args.length)
- );
- }
- Utils.addChatMessage(
- "§e[NEU] §fYour external editor is: §Z" + NotEnoughUpdates.INSTANCE.config.hidden.externalEditor);
- return;
- }
- if (args.length >= 1 && args[0].equalsIgnoreCase("pricetest")) {
- if (args.length == 1) {
- NotEnoughUpdates.INSTANCE.manager.auctionManager.updateBazaar();
- } else {
- NotEnoughUpdates.INSTANCE.openGui = new GuiPriceGraph(args[1]);
- }
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("zone")) {
- BlockPos target = Minecraft.getMinecraft().objectMouseOver.getBlockPos();
- if (target == null) target = Minecraft.getMinecraft().thePlayer.getPosition();
- SpecialBlockZone zone = CustomBiomes.INSTANCE.getSpecialZone(target);
- Arrays.asList(
- new ChatComponentText("Showing Zone Info for: " + target),
- new ChatComponentText("Zone: " + (zone != null ? zone.name() : "null")),
- new ChatComponentText("Location: " + SBInfo.getInstance().getLocation()),
- new ChatComponentText("Biome: " + CustomBiomes.INSTANCE.getCustomBiome(target))
- ).forEach(Minecraft.getMinecraft().thePlayer::addChatMessage);
- MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(SBInfo.getInstance().getLocation(), SBInfo
- .getInstance()
- .getLocation()));
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("positiontest")) {
- NotEnoughUpdates.INSTANCE.openGui = new GuiPositionEditor();
- return;
- }
-
- if (args.length == 2 && args[0].equalsIgnoreCase("pt")) {
- FishingHelper.type = EnumParticleTypes.valueOf(args[1]);
- return;
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("dev")) {
- NotEnoughUpdates.INSTANCE.config.hidden.dev = !NotEnoughUpdates.INSTANCE.config.hidden.dev;
- Utils.addChatMessage(
- "§e[NEU] Dev mode " + (NotEnoughUpdates.INSTANCE.config.hidden.dev ? "§aenabled" : "§cdisabled"));
- return;
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("saveconfig")) {
- NotEnoughUpdates.INSTANCE.saveConfig();
- return;
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("searchmode")) {
- NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus = true;
- Utils.addChatMessage(EnumChatFormatting.AQUA + "I would never search");
- return;
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("bluehair")) {
- PronounDB.test();
- return;
- }
- if (args.length == 2 && args[0].equalsIgnoreCase("openGui")) {
- try {
- NotEnoughUpdates.INSTANCE.openGui = (GuiScreen) Class.forName(args[1]).newInstance();
- Utils.addChatMessage("Opening gui: " + NotEnoughUpdates.INSTANCE.openGui);
- } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e) {
- e.printStackTrace();
- Utils.addChatMessage("Failed to open this GUI.");
- }
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("center")) {
- double x = Math.floor(Minecraft.getMinecraft().thePlayer.posX) + 0.5f;
- double z = Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + 0.5f;
- Minecraft.getMinecraft().thePlayer.setPosition(x, Minecraft.getMinecraft().thePlayer.posY, z);
- }
- if (args.length >= 1 && args[0].equalsIgnoreCase("minion")) {
- MinionHelperManager.getInstance().handleCommand(args);
- }
- if (args.length == 1 && args[0].equalsIgnoreCase("copytablist")) {
- StringBuilder builder = new StringBuilder();
- for (String name : TabListUtils.getTabList()) {
- builder.append(name).append("\n");
- }
- MiscUtils.copyToClipboard(builder.toString());
- Utils.addChatMessage("§e[NEU] Copied tablist to clipboard!");
- }
- if (args.length >= 1 && args[0].equalsIgnoreCase("useragent")) {
- String newUserAgent = args.length == 1 ? null : String.join(" ", Arrays.copyOfRange(args, 1, args.length));
- Utils.addChatMessage("§e[NEU] Changed user agent override to: " + newUserAgent);
- NotEnoughUpdates.INSTANCE.config.hidden.customUserAgent = newUserAgent;
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.java
deleted file mode 100644
index fb546efb..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver;
-import io.github.moulberry.notenoughupdates.miscfeatures.CrystalWishingCompassSolver;
-import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-
-public class DiagCommand extends ClientCommandBase {
- public DiagCommand() {
- super("neudiag");
- }
-
- private static final String USAGE_TEXT = EnumChatFormatting.WHITE +
- "Usage: /neudiag <metal | wishing | debug>\n\n" +
- "/neudiag metal Metal Detector Solver diagnostics\n" +
- " <no sub-command> Show current solution diags\n" +
- " center=<off | on> Disable / enable using center\n" +
- "/neudiag wishing Wishing Compass Solver diagnostics\n" +
- "/neudiag debug\n" +
- " <no sub-command> Show all enabled flags\n" +
- " <list> Show all flags\n"+
- " <enable | disable> <flag> Enable/disable flag\n";
-
- private void showUsage(ICommandSender sender) {
- sender.addChatMessage(new ChatComponentText(USAGE_TEXT));
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length == 0) {
- showUsage(sender);
- return;
- }
-
- String command = args[0].toLowerCase();
- switch (command) {
- case "metal":
- if (args.length == 1) {
- CrystalMetalDetectorSolver.logDiagnosticData(true);
- return;
- }
-
- String subCommand = args[1].toLowerCase();
- if (subCommand.equals("center=off")) {
- CrystalMetalDetectorSolver.setDebugDoNotUseCenter(true);
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW +
- "Center coordinates-based solutions disabled"));
- } else if (subCommand.equals("center=on")) {
- CrystalMetalDetectorSolver.setDebugDoNotUseCenter(false);
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW +
- "Center coordinates-based solutions enabled"));
- } else {
- showUsage(sender);
- return;
- }
-
- break;
- case "wishing":
- CrystalWishingCompassSolver.getInstance().logDiagnosticData(true);
- break;
- case "debug":
- if (args.length > 1) {
- boolean enablingFlag = true;
- String action = args[1];
- switch (action) {
- case "list":
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.YELLOW + "Here are all flags:\n" + NEUDebugFlag.getFlagList()));
- return;
- case "disable":
- enablingFlag = false;
- // falls through
- case "enable":
- if (args.length != 3) {
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
- "You must specify a flag:\n" +
- NEUDebugFlag.getFlagList()));
- return;
- }
-
- String flagName = args[2].toUpperCase();
- try {
- NEUDebugFlag debugFlag = NEUDebugFlag.valueOf(flagName);
- if (enablingFlag) {
- NotEnoughUpdates.INSTANCE.config.hidden.debugFlags.add(debugFlag);
- } else {
- NotEnoughUpdates.INSTANCE.config.hidden.debugFlags.remove(debugFlag);
- }
- } catch (IllegalArgumentException e) {
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
- flagName + " is invalid. Valid flags are:\n" +
- NEUDebugFlag.getFlagList()));
- return;
- }
- break;
- default:
- showUsage(sender);
- return;
- }
- }
-
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Effective debug flags: \n" +
- NEUDebugFlag.getEnabledFlags()));
- break;
- default:
- showUsage(sender);
- return;
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DungeonWinTestCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DungeonWinTestCommand.java
deleted file mode 100644
index be25e697..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DungeonWinTestCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ResourceLocation;
-
-public class DungeonWinTestCommand extends ClientCommandBase {
-
- public DungeonWinTestCommand() {
- super("neudungeonwintest");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length > 0) {
- DungeonWin.TEAM_SCORE = new ResourceLocation("notenoughupdates:dungeon_win/" + args[0].toLowerCase() + ".png");
- }
-
- DungeonWin.displayWin();
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/NullzeeSphereCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/NullzeeSphereCommand.java
deleted file mode 100644
index 3a9ce90f..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/NullzeeSphereCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.miscfeatures.NullzeeSphere;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-
-public class NullzeeSphereCommand extends ClientCommandBase {
-
- public NullzeeSphereCommand() {
- super("neuzeesphere");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length != 1) {
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.RED + "Usage: /neuzeesphere [on/off] or /neuzeesphere (radius) or /neuzeesphere setCenter"));
- return;
- }
- if (args[0].equalsIgnoreCase("on")) {
- NullzeeSphere.enabled = true;
- } else if (args[0].equalsIgnoreCase("off")) {
- NullzeeSphere.enabled = false;
- } else if (args[0].equalsIgnoreCase("setCenter")) {
- EntityPlayerSP p = ((EntityPlayerSP) sender);
- NullzeeSphere.centerPos = new BlockPos(p.posX, p.posY, p.posZ);
- NullzeeSphere.overlayVBO = null;
- } else {
- try {
- NullzeeSphere.size = Float.parseFloat(args[0]);
- NullzeeSphere.overlayVBO = null;
- } catch (Exception e) {
- sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Can't parse radius: " + args[0]));
- }
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.java
deleted file mode 100644
index 1d30a15f..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.core.util.MiscUtils;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.AbstractClientPlayer;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.item.EntityArmorStand;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTBase;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.function.Supplier;
-
-public class PackDevCommand extends ClientCommandBase {
- static Minecraft mc = Minecraft.getMinecraft();
-
- public PackDevCommand() {
- super("neupackdev");
- }
-
- private static final HashMap<String, Command<?, ?>> commands = new HashMap<String, Command<?, ?>>() {{
- put(
- "getnpc",
- new Command<>(
- "NPC",
- () -> mc.theWorld.playerEntities,
- true,
- AbstractClientPlayer.class
- )
- );
- put(
- "getnpcs",
- new Command<>(
- "NPC",
- () -> mc.theWorld.playerEntities,
- false,
- AbstractClientPlayer.class
- )
- );
- put(
- "getmob",
- new Command<>(
- "mob",
- () -> mc.theWorld.loadedEntityList,
- true,
- EntityLiving.class
- )
- );
- put(
- "getmobs",
- new Command<>(
- "mob",
- () -> mc.theWorld.loadedEntityList,
- false,
- EntityLiving.class
- )
- );
- put(
- "getarmorstand",
- new Command<>(
- "armor stand",
- () -> mc.theWorld.loadedEntityList,
- true,
- EntityArmorStand.class
- )
- );
- put(
- "getarmorstands",
- new Command<>(
- "armor stand",
- () -> mc.theWorld.loadedEntityList,
- false,
- EntityArmorStand.class
- )
- );
- }};
-
- @Override
- public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
- return args.length == 1 ? getListOfStringsMatchingLastWord(args, commands.keySet()) : null;
- }
-
- public static void togglePackDeveloperMode(ICommandSender sender) {
- NotEnoughUpdates.INSTANCE.packDevEnabled = !NotEnoughUpdates.INSTANCE.packDevEnabled;
- if (NotEnoughUpdates.INSTANCE.packDevEnabled) {
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.GREEN + "Enabled pack developer mode."));
- } else {
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.RED + "Disabled pack developer mode."));
- }
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length == 0) {
- togglePackDeveloperMode(sender);
- return;
- }
-
- double dist = 5.0;
- if (args.length >= 2) {
- try {
- dist = Double.parseDouble(args[1]);
- } catch (NumberFormatException e) {
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.RED + "Invalid distance! Must be a number, defaulting to a radius of 5."));
- }
- }
-
- StringBuilder output;
- String subCommand = args[0].toLowerCase();
- if (commands.containsKey(subCommand)) {
- Command<?, ?> command = commands.get(subCommand);
- output = command.getData(dist);
- } else if (subCommand.equals("getall")) {
- output = getAll(dist);
- } else if (subCommand.equals("getallclose")) {
- output = getAllClose(dist);
- } else {
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.RED + "Invalid sub-command."));
- return;
- }
-
- if (output.length() != 0) {
- MiscUtils.copyToClipboard(output.toString());
- }
- }
-
- private static StringBuilder getAllClose(Double dist) {
- StringBuilder sb = new StringBuilder();
- sb.append(commands.get("getmob").getData(dist));
- sb.append(commands.get("getarmorstand").getData(dist));
- sb.append(commands.get("getnpc").getData(dist));
- return sb;
- }
-
- private static StringBuilder getAll(Double dist) {
- StringBuilder sb = new StringBuilder();
- sb.append(commands.get("getmobs").getData(dist));
- sb.append(commands.get("getarmorstands").getData(dist));
- sb.append(commands.get("getnpcs").getData(dist));
- return sb;
- }
-
- public static <T extends EntityLivingBase> StringBuilder livingBaseDataBuilder(T entity, Class<T> clazz) {
- StringBuilder entityData = new StringBuilder();
- if (EntityPlayer.class.isAssignableFrom(entity.getClass())) {
- EntityPlayer entityPlayer = (EntityPlayer) entity;
-
- // NPC Information
- String skinResourcePath = ((AbstractClientPlayer) entityPlayer).getLocationSkin().getResourcePath();
- entityData
- .append("Player Id: ")
- .append(entityPlayer.getUniqueID() != null ? entityPlayer.getUniqueID().toString() : "null")
- .append(entityPlayer.getCustomNameTag() != null ? entityPlayer.getCustomNameTag() : "null")
- .append("\nEntity Texture Id: ")
- .append(skinResourcePath != null ? skinResourcePath.replace("skins/", "") : "null");
- }
-
- if (!clazz.isAssignableFrom(entity.getClass())) {
- return entityData;
- }
-
- //Entity Information
- entityData
- .append("Entity Id: ")
- .append(entity.getEntityId())
- .append("\nMob: ")
- .append(entity.getName() != null ? entity.getName() : "null")
- .append("\nCustom Name: ")
- .append(entity.getCustomNameTag() != null ? entity.getCustomNameTag() : "null");
-
- //Held Item
- if (entity.getHeldItem() != null) {
- entityData
- .append("\nItem: ")
- .append(entity.getHeldItem())
- .append("\nItem Display Name: ")
- .append(entity.getHeldItem().getDisplayName() != null
- ? entity.getHeldItem().getDisplayName()
- : "null")
- .append("\nItem Tag Compound: ");
- NBTTagCompound heldItemTagCompound = entity.getHeldItem().getTagCompound();
- if (heldItemTagCompound != null) {
- String heldItemString = heldItemTagCompound.toString();
- NBTBase extraAttrTag = heldItemTagCompound.getTag("ExtraAttributes");
- entityData
- .append(heldItemString != null ? heldItemString : "null")
- .append("\nItem Tag Compound Extra Attributes: ")
- .append(extraAttrTag != null ? extraAttrTag : "null");
- } else {
- entityData.append("null");
- }
-
- } else {
- entityData.append("\nItem: null");
- }
-
- entityData.append(armorDataBuilder(entity)).append("\n\n");
-
- return entityData;
- }
-
- private static final String[] armorPieceTypes = {"Boots", "Leggings", "Chestplate", "Helmet"};
-
- public static <T extends EntityLivingBase> StringBuilder armorDataBuilder(T entity) {
- StringBuilder armorData = new StringBuilder();
- for (int i = 0; i < 4; i++) {
- ItemStack currentArmor = entity.getCurrentArmor(0);
- armorData.append(String.format("\n%s: ", armorPieceTypes[i]));
- if (currentArmor == null) {
- armorData.append("null");
- } else {
- armorData.append(currentArmor.getTagCompound() != null ? currentArmor.getTagCompound().toString() : "null");
- }
- }
- return armorData;
- }
-
- static class Command<T extends EntityLivingBase, U extends Entity> {
- String typeFriendlyName;
- Supplier<List<U>> entitySupplier;
- Class<T> clazz;
- boolean single;
-
- Command(
- String typeFriendlyName,
- Supplier<List<U>> entitySupplier,
- boolean single,
- Class<T> clazz
- ) {
- this.typeFriendlyName = typeFriendlyName;
- this.entitySupplier = entitySupplier;
- this.single = single;
- this.clazz = clazz;
- }
-
- @SuppressWarnings("unchecked")
- public StringBuilder getData(double dist) {
- StringBuilder result = new StringBuilder();
- double distSq = dist * dist;
- T closest = null;
- for (Entity entity : entitySupplier.get()) {
- if (!clazz.isAssignableFrom(entity.getClass()) || entity == mc.thePlayer) {
- continue;
- }
- T entityT = (T) entity;
- double entityDistanceSq = entity.getDistanceSq(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);
- if (entityDistanceSq < distSq) {
- if (single) {
- distSq = entityDistanceSq;
- closest = entityT;
- } else {
- result.append(livingBaseDataBuilder(entityT, clazz));
- }
- }
- }
-
- if ((single && closest == null) || (!single && result.length() == 0)) {
- Utils.addChatMessage(EnumChatFormatting.RED + "No " + typeFriendlyName + "s found within " + dist + " blocks.");
- } else {
- Utils.addChatMessage(
- EnumChatFormatting.GREEN + "Copied " + typeFriendlyName + " data to clipboard");
- return single ? livingBaseDataBuilder(closest, clazz) : result;
- }
-
- return result;
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ReloadRepoCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ReloadRepoCommand.java
deleted file mode 100644
index 0bf57594..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ReloadRepoCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-
-public class ReloadRepoCommand extends ClientCommandBase {
-
- public ReloadRepoCommand() {
- super("neureloadrepo");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- NotEnoughUpdates.INSTANCE.manager.reloadRepository();
- sender.addChatMessage(new ChatComponentText("§e[NEU] Reloaded repository."));
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ResetRepoCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ResetRepoCommand.java
deleted file mode 100644
index 3f693898..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/ResetRepoCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-
-public class ResetRepoCommand extends ClientCommandBase {
-
- public ResetRepoCommand() {
- super("neuresetrepo");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- NotEnoughUpdates.INSTANCE.manager
- .userFacingRepositoryReload()
- .thenAccept(strings ->
- strings.forEach(line ->
- sender.addChatMessage(new ChatComponentText("§e[NEU] " + line))));
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java
deleted file mode 100644
index ea417977..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/StatsCommand.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dev;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.DiscordMarkdownBuilder;
-import io.github.moulberry.notenoughupdates.util.HastebinUploader;
-import io.github.moulberry.notenoughupdates.util.SBInfo;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraftforge.common.ForgeVersion;
-import net.minecraftforge.fml.client.FMLClientHandler;
-import net.minecraftforge.fml.common.Loader;
-import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.GL11;
-
-import javax.management.JMX;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.awt.*;
-import java.awt.datatransfer.StringSelection;
-import java.lang.management.ManagementFactory;
-import java.util.List;
-import java.util.Locale;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public class StatsCommand extends ClientCommandBase {
- private final ExecutorService threadPool = Executors.newFixedThreadPool(1);
-
- public StatsCommand() {
- super("neustats");
- }
-
- private static final int activeModCount = Loader.instance().getActiveModList().size();
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- if (args.length > 0) {
- switch (args[0].toLowerCase(Locale.ROOT)) {
- case "modlist":
- if (activeModCount > 15) {
- clipboardAndSendMessage(createModList(new DiscordMarkdownBuilder()).toString());
- } else {
- clipboardAndSendMessage(createStats());
- }
- break;
- case "dump":
- modPrefixedMessage(EnumChatFormatting.GREEN +
- "This will upload a dump of the java classes your game has loaded how big they are and how many there are. This can take a few seconds as it is uploading to HasteBin.");
- threadPool.submit(() -> {
- try {
- final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- final ObjectName objectName = ObjectName.getInstance("com.sun.management:type=DiagnosticCommand");
- final DiagnosticCommandMXBean proxy = JMX.newMXBeanProxy(
- server,
- objectName,
- DiagnosticCommandMXBean.class
- );
- clipboardAndSendMessage(HastebinUploader.upload(
- proxy.gcClassHistogram(new String[0]).replace("[", "[]"),
- HastebinUploader.Mode.NORMAL
- ));
- } catch (Exception e) {
- clipboardAndSendMessage(null);
- }
- });
- break;
- }
- } else {
- clipboardAndSendMessage(createStats());
- }
-
- }
-
- @Override
- public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
- return args.length == 1 ? getListOfStringsMatchingLastWord(args, "modlist", "dump") : null;
- }
-
- public interface DiagnosticCommandMXBean {
- String gcClassHistogram(String[] array);
- }
-
- private static void clipboardAndSendMessage(String data) {
- if (data == null) {
- modPrefixedMessage(EnumChatFormatting.DARK_RED + "Error occurred trying to perform command.");
- return;
- }
- try {
- StringSelection clipboard = new StringSelection(data);
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard);
- modPrefixedMessage(EnumChatFormatting.GREEN + "Dev info copied to clipboard.");
- } catch (Exception ignored) {
- modPrefixedMessage(EnumChatFormatting.DARK_RED + "Could not copy to clipboard.");
- }
- }
-
- private static void modPrefixedMessage(String message) {
- Utils.addChatMessage(
- EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + message);
- }
-
- private static String createStats() {
- DiscordMarkdownBuilder builder = new DiscordMarkdownBuilder();
- long maxMemory = Runtime.getRuntime().maxMemory();
- long totalMemory = Runtime.getRuntime().totalMemory();
- long freeMemory = Runtime.getRuntime().freeMemory();
- long currentMemory = totalMemory - freeMemory;
-
- builder.category("System Stats");
- builder.append("OS", System.getProperty("os.name"));
- builder.append("CPU", OpenGlHelper.getCpu());
- builder.append(
- "Display",
- String.format("%dx%d (%s)", Display.getWidth(), Display.getHeight(), GL11.glGetString(GL11.GL_VENDOR))
- );
- builder.append("GPU", GL11.glGetString(GL11.GL_RENDERER));
- builder.append("GPU Driver", GL11.glGetString(GL11.GL_VERSION));
- if (getMemorySize() > 0) builder.append("Maximum Memory", (getMemorySize() / 1024L / 1024L) + "MB");
- builder.append("Shaders", ("" + OpenGlHelper.isFramebufferEnabled()).toUpperCase());
- builder.category("Java Stats");
- builder.append(
- "Java",
- String.format("%s %dbit", System.getProperty("java.version"), Minecraft.getMinecraft().isJava64bit() ? 64 : 32)
- );
- builder.append(
- "Memory",
- String.format(
- "% 2d%% %03d/%03dMB",
- currentMemory * 100L / maxMemory,
- currentMemory / 1024L / 1024L,
- maxMemory / 1024L / 1024L
- )
- );
- builder.append(
- "Memory Allocated",
- String.format("% 2d%% %03dMB", totalMemory * 100L / maxMemory, totalMemory / 1024L / 1024L)
- );
- builder.category("Game Stats");
- builder.append("FPS", String.valueOf(Minecraft.getDebugFPS()));
- builder.append("Loaded Mods", String.valueOf(activeModCount));
- builder.append("Forge", ForgeVersion.getVersion());
- builder.append("Optifine", FMLClientHandler.instance().hasOptifine() ? "TRUE" : "FALSE");
- builder.category("Neu Settings");
- builder.append("API Key", NotEnoughUpdates.INSTANCE.config.apiData.apiKey.isEmpty() ? "FALSE" : "TRUE");
- builder.append("On SkyBlock", NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() ? "TRUE" : "FALSE");
- builder.append(
- "Mod Version",
- Loader.instance().getIndexedModList().get(NotEnoughUpdates.MODID).getDisplayVersion()
- );
- builder.append("SB Profile", SBInfo.getInstance().currentProfile);
- builder.append("Has Advanced Tab", SBInfo.getInstance().hasNewTab ? "TRUE" : "FALSE");
- builder.category("Repo Stats");
- builder.append("Last Commit", NotEnoughUpdates.INSTANCE.manager.latestRepoCommit);
- builder.append("Loaded Items", String.valueOf(NotEnoughUpdates.INSTANCE.manager.getItemInformation().size()));
- if (activeModCount <= 15) createModList(builder);
-
- return builder.toString();
- }
-
- private static DiscordMarkdownBuilder createModList(DiscordMarkdownBuilder builder) {
- builder.category("Mods Loaded");
- Loader.instance().getActiveModList().forEach(mod -> builder.append(mod.getName(), mod.getSource().getName()));
- return builder;
- }
-
- private static long getMemorySize() {
- try {
- return ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
- } catch (Exception e) {
- try {
- return ((com.sun.management.UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
- } catch (Exception ignored) {/*IGNORE*/}
- }
- return -1;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java
deleted file mode 100644
index 3b697905..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dungeon;
-
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.EnumChatFormatting;
-
-public class DnCommand extends ClientCommandBase {
-
- public DnCommand() {
- super("dn");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub");
- Utils.addChatMessage(EnumChatFormatting.AQUA + "Warping to:" + EnumChatFormatting.YELLOW + " Deez Nuts lmao");
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java
deleted file mode 100644
index 58bfbef2..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dungeon;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.EnumChatFormatting;
-import org.apache.commons.lang3.StringUtils;
-
-public class JoinDungeonCommand extends ClientCommandBase {
-
- public JoinDungeonCommand() {
- super("join");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/join " + StringUtils.join(args, " "));
- } else {
- if (args.length != 1) {
- Utils.addChatMessage(EnumChatFormatting.RED + "Example Usage: /join f7, /join m6 or /join 7");
- } else {
- String cataPrefix = "catacombs";
- if (args[0].toLowerCase().startsWith("m")) {
- cataPrefix = "master_catacombs";
- }
- String cmd = "/joindungeon " + cataPrefix + " " + args[0].charAt(args[0].length() - 1);
- Utils.addChatMessage(EnumChatFormatting.YELLOW + "Running command: " + cmd);
- Utils.addChatMessage(EnumChatFormatting.YELLOW +
- "The dungeon should start soon. If it doesn't, make sure you have a party of 5 people");
- Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd);
- }
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
deleted file mode 100644
index d52ed196..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dungeon;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.block.material.MapColor;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.item.ItemMap;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.storage.MapData;
-
-import java.awt.*;
-import java.io.File;
-import java.util.Map;
-
-public class MapCommand extends ClientCommandBase {
-
- public MapCommand() {
- super("neumap");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
-
- if (!NotEnoughUpdates.INSTANCE.config.hidden.dev) {
- NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(null);
- return;
- }
-
- if (args.length == 1 && args[0].equals("reset")) {
- NotEnoughUpdates.INSTANCE.colourMap = null;
- return;
- }
-
- if (args.length != 2) {
- NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(null);
- return;
- }
-
- if (args[0].equals("save")) {
- ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
- if (stack != null && stack.getItem() instanceof ItemMap) {
- ItemMap map = (ItemMap) stack.getItem();
- MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld);
-
- if (mapData == null) return;
-
- JsonObject json = new JsonObject();
- for (int i = 0; i < 16384; ++i) {
- int x = i % 128;
- int y = i / 128;
-
- int j = mapData.colors[i] & 255;
-
- Color c;
- if (j / 4 == 0) {
- c = new Color((i + i / 128 & 1) * 8 + 16 << 24, true);
- } else {
- c = new Color(MapColor.mapColorArray[j / 4].getMapColor(j & 3), true);
- }
-
- json.addProperty(x + ":" + y, c.getRGB());
- }
-
- try {
- new File(NotEnoughUpdates.INSTANCE.manager.configLocation, "maps").mkdirs();
- NotEnoughUpdates.INSTANCE.manager.writeJson(
- json,
- new File(NotEnoughUpdates.INSTANCE.manager.configLocation, "maps/" + args[1] + ".json")
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- Utils.addChatMessage(EnumChatFormatting.GREEN + "Saved to file.");
- }
-
- return;
- }
-
- if (args[0].equals("load")) {
- JsonObject json = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(new File(
- NotEnoughUpdates.INSTANCE.manager.configLocation,
- "maps/" + args[1] + ".json"
- ));
-
- NotEnoughUpdates.INSTANCE.colourMap = new Color[128][128];
- for (int x = 0; x < 128; x++) {
- for (int y = 0; y < 128; y++) {
- NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(0, 0, 0, 0);
- }
- }
- for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
- int x = Integer.parseInt(entry.getKey().split(":")[0]);
- int y = Integer.parseInt(entry.getKey().split(":")[1]);
-
- NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(entry.getValue().getAsInt(), true);
- }
-
- return;
- }
-
- NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(null);
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java
deleted file mode 100644
index bbabc172..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.help;
-
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Constants;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.event.ClickEvent;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-
-public class FeaturesCommand extends ClientCommandBase {
- public FeaturesCommand() {
- super("neufeatures");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- Utils.addChatMessage("");
- if (Constants.MISC == null || !Constants.MISC.has("featureslist")) {
- Utils.showOutdatedRepoNotification();
- return;
- }
- String url = Constants.MISC.get("featureslist").getAsString();
-
- if (Utils.openUrl(url)) {
- Utils.addChatMessage(
- EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET +
- EnumChatFormatting.GOLD + "> Opening Feature List in browser.");
- } else {
- ChatComponentText clickTextFeatures = new ChatComponentText(
- EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET +
- EnumChatFormatting.GOLD + "> Click here to open the Feature List in your browser.");
- clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url));
- Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures);
-
- }
- Utils.addChatMessage("");
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java
deleted file mode 100644
index 3a47509d..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.help;
-
-import com.google.common.collect.Lists;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.command.ICommandSender;
-
-import java.util.ArrayList;
-
-public class HelpCommand extends ClientCommandBase {
-
- public HelpCommand() {
- super("neuhelp");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- ArrayList<String> neuHelpMessages = Lists.newArrayList(
- "\u00a75\u00a7lNotEnoughUpdates commands",
- "\u00a76/neu \u00a77- Opens the main NEU GUI.",
- "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer",
- "\u00a76/neusouls {on/off/clear/unclear} \u00a7r\u00a77- Shows waypoints to fairy souls.",
- "\u00a76/neubuttons \u00a7r\u00a77- Opens a GUI which allows you to customize inventory buttons.",
- "\u00a76/neuec \u00a7r\u00a77- Opens the enchant colour GUI.",
- "\u00a76/join {floor} \u00a7r\u00a77- Short Command to join a Dungeon. \u00a7lNeed a Party of 5 People\u00a7r\u00a77 {4/f7/m5}.",
- "\u00a76/neucosmetics \u00a7r\u00a77- Opens the cosmetic GUI.",
- "\u00a76/neurename \u00a7r\u00a77- Opens the NEU Item Customizer.",
- "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer's Catacombs page.",
- "\u00a76/neulinks \u00a7r\u00a77- Shows links to NEU/Moulberry.",
- "\u00a76/neuoverlay \u00a7r\u00a77- Opens GUI Editor for quickcommands and searchbar.",
- "\u00a76/neuah \u00a7r\u00a77- Opens NEU's custom auction house GUI.",
- "\u00a76/neucalendar \u00a7r\u00a77- Opens NEU's custom calendar GUI.",
- "\u00a76/neucalc \u00a7r\u00a77- Run calculations.",
- "",
- "\u00a76\u00a7lOld commands:",
- "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- Shows quick stats for a user.",
- "",
- "\u00a76\u00a7lDebug commands:",
- "\u00a76/neustats \u00a7r\u00a77- Copies helpful info to the clipboard.",
- "\u00a76/neustats modlist \u00a7r\u00a77- Copies mod list info to clipboard.",
- "\u00a76/neuresetrepo \u00a7r\u00a77- Deletes all repo files.",
- "\u00a76/neureloadrepo \u00a7r\u00a77- Debug command with repo.",
- "",
- "\u00a76\u00a7lDev commands:",
- "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc, getmob(s), getarmorstand(s), getall. Optional radius argument for all."
- );
- for (String neuHelpMessage : neuHelpMessages) {
- Utils.addChatMessage(neuHelpMessage);
- }
- if (NotEnoughUpdates.INSTANCE.config.hidden.dev) {
- ArrayList<String> neuDevHelpMessages = Lists.newArrayList(
- "\u00a76/neudevtest \u00a7r\u00a77- dev test command",
- "\u00a76/neuzeephere \u00a7r\u00a77- sphere",
- "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen"
- );
-
- for (String neuDevHelpMessage : neuDevHelpMessages) {
- Utils.addChatMessage(neuDevHelpMessage);
- }
- }
- String[] helpInfo = {
- "",
- "\u00a77Commands marked with a \u00a72\"\u2D35\"\u00a77 require an api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"",
- "",
- "\u00a77Arguments marked with a \u00a7b\"?\"\u00a77 are optional.",
- "",
- "\u00a76\u00a7lScroll up to see everything"
- };
-
- for (String message : helpInfo) {
- Utils.addChatMessage(message);
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.java
deleted file mode 100644
index 793e652e..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.help;
-
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-
-import java.io.File;
-
-public class LinksCommand extends ClientCommandBase {
-
- public LinksCommand() {
- super("neulinks");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- File repo = NotEnoughUpdates.INSTANCE.manager.repoLocation;
- if (repo.exists()) {
- File updateJson = new File(repo, "update.json");
- try {
- JsonObject update = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(updateJson);
-
- Utils.addChatMessage("");
- NotEnoughUpdates.INSTANCE.displayLinks(update,0 );
- Utils.addChatMessage("");
- } catch (Exception ignored) {
- }
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.java
deleted file mode 100644
index 1855a2b5..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.help;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
-import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class SettingsCommand extends ClientCommandBase {
-
- public SettingsCommand() {
- super("neu");
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Arrays.asList("neusettings", "neuconfig");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length > 0) {
- NotEnoughUpdates.INSTANCE.openGui =
- new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config, StringUtils.join(args, " ")));
- } else {
- NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config));
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.java
deleted file mode 100644
index 820c6f2a..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.help;
-
-import com.google.common.collect.Lists;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.NotificationHandler;
-import net.minecraft.command.ICommandSender;
-
-public class StorageViewerWhyCommand extends ClientCommandBase {
-
- public StorageViewerWhyCommand() {
- super("neustwhy");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- NotificationHandler.displayNotification(Lists.newArrayList(
- "\u00a7eStorage Viewer",
- "\u00a77Currently, the storage viewer requires you to click twice",
- "\u00a77in order to switch between pages. This is because Hypixel",
- "\u00a77has not yet added a shortcut command to go to any enderchest/",
- "\u00a77storage page.",
- "\u00a77While it is possible to send the second click",
- "\u00a77automatically, doing so violates Hypixel's new mod rules."
- ), true);
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
deleted file mode 100644
index 1ca398ef..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.misc;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.EnumChatFormatting;
-import org.apache.commons.lang3.StringUtils;
-
-public class AhCommand extends ClientCommandBase {
-
- public AhCommand() {
- super("neuah");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
- Utils.addChatMessage(EnumChatFormatting.RED + "You must be on SkyBlock to use this feature.");
- } else if (NotEnoughUpdates.INSTANCE.config.apiData.apiKey == null ||
- NotEnoughUpdates.INSTANCE.config.apiData.apiKey.trim().isEmpty()) {
- Utils.addChatMessage(
- EnumChatFormatting.RED + "Can't open NEU AH: an api key is not set. Run /api new and put the result in settings.");
- } else {
- NotEnoughUpdates.INSTANCE.openGui = new CustomAHGui();
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.lastOpen = System.currentTimeMillis();
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.clearSearch();
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.updateSearch();
-
- if (args.length > 0) {
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(StringUtils.join(args, " "));
- } else {
- if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) {
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(null);
- }
- }
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java
deleted file mode 100644
index b01f106b..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.misc;
-
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Calculator;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-
-public class CalculatorCommand extends ClientCommandBase {
- public CalculatorCommand() {
- super("neucalc");
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Arrays.asList("neucalculator");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if ((args.length == 1 && Objects.equals(args[0], "help")) || args.length == 0) {
- sender.addChatMessage(new ChatComponentText(
- "\n§e[NEU] §5It's a calculator.\n" +
- "§eFor Example §b/neucalc 3m*7k§e.\n" +
- "§eYou can also use suffixes (k, m, b, t, s)§e.\n" +
- "§eThe \"s\" suffix acts as 64.\n" +
- "§eTurn on Sign Calculator in /neu misc to also support this in sign popups and the neu search bar.\n"));
- return;
- }
- String source = String.join(" ", args);
- try {
- BigDecimal calculate = Calculator.calculate(source);
- DecimalFormat formatter = new DecimalFormat("#,##0.##");
- String format = formatter.format(calculate);
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.YELLOW + "[NEU] " + EnumChatFormatting.WHITE + source + " " + EnumChatFormatting.YELLOW +
- "= " + EnumChatFormatting.GREEN + format
- ));
- } catch (Calculator.CalculatorException e) {
- sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.YELLOW + "[NEU] " + EnumChatFormatting.RED + "Error during calculation: " +
- e.getMessage() + "\n" +
- EnumChatFormatting.WHITE + source.substring(0, e.getOffset()) + EnumChatFormatting.DARK_RED +
- source.substring(e.getOffset(), e.getLength() + e.getOffset()) + EnumChatFormatting.GRAY +
- source.substring(e.getLength() + e.getOffset())
- ));
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalendarCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalendarCommand.java
deleted file mode 100644
index 58c13474..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalendarCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.misc;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-
-public class CalendarCommand extends ClientCommandBase {
-
- public CalendarCommand() {
- super("neucalendar");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- Minecraft.getMinecraft().thePlayer.closeScreen();
- CalendarOverlay.setEnabled(true);
- NotEnoughUpdates.INSTANCE.sendChatMessage("/calendar");
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CosmeticsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CosmeticsCommand.java
deleted file mode 100644
index bbab316e..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CosmeticsCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.misc;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.cosmetics.GuiCosmetics;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.EnumChatFormatting;
-
-public class CosmeticsCommand extends ClientCommandBase {
-
- public CosmeticsCommand() {
- super("neucosmetics");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (!OpenGlHelper.isFramebufferEnabled() && NotEnoughUpdates.INSTANCE.config.notifications.doFastRenderNotif) {
- Utils.addChatMessage(EnumChatFormatting.RED +
- "NEU Cosmetics do not work with OptiFine Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.");
-
- }
-
- NotEnoughUpdates.INSTANCE.openGui = new GuiCosmetics();
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CustomizeCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CustomizeCommand.java
deleted file mode 100644
index 28c2893d..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CustomizeCommand.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.misc;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.miscgui.GuiItemCustomize;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.ChatComponentText;
-
-import java.util.Collections;
-import java.util.List;
-
-public class CustomizeCommand extends ClientCommandBase {
-
- public CustomizeCommand() {
- super("neucustomize");
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Collections.singletonList("neurename");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
-
- if (held == null) {
- sender.addChatMessage(new ChatComponentText("\u00a7cYou can't customize your hand..."));
- return;
- }
-
- String heldUUID = NotEnoughUpdates.INSTANCE.manager.getUUIDForItem(held);
-
- if (heldUUID == null) {
- sender.addChatMessage(new ChatComponentText("\u00a7cHeld item does not have a UUID, so it cannot be customized"));
- return;
- }
-
- NotEnoughUpdates.INSTANCE.openGui = new GuiItemCustomize(held, heldUUID);
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java
deleted file mode 100644
index 5a4f1400..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.misc;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.MinecraftExecutor;
-import io.github.moulberry.notenoughupdates.util.PronounDB;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiNewChat;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-
-import java.util.Optional;
-import java.util.Random;
-import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
-
-public class PronounsCommand extends ClientCommandBase {
- public PronounsCommand() {
- super("neupronouns");
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return "/neupronouns <username> [platform]";
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- switch (args.length) {
- case 1:
- fetchPronouns("minecraft", args[0]);
- break;
- case 2:
- fetchPronouns(args[1], args[0]);
- break;
- default:
- sender.addChatMessage(new ChatComponentText("§4" + getCommandUsage(sender)));
- }
- }
-
- private void fetchPronouns(String platform, String user) {
- GuiNewChat nc = Minecraft.getMinecraft().ingameGUI.getChatGUI();
- int id = new Random().nextInt();
- nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] Fetching Pronouns..."), id);
-
- CompletableFuture<Optional<PronounDB.PronounChoice>> pronouns;
- if ("minecraft".equals(platform)) {
- CompletableFuture<UUID> c = new CompletableFuture<>();
- NotEnoughUpdates.profileViewer.getPlayerUUID(user, uuidString -> {
- if (uuidString == null) {
- c.completeExceptionally(new NullPointerException());
- } else {
- c.complete(Utils.parseDashlessUUID(uuidString));
- }
- });
- pronouns = c.thenCompose(PronounDB::getPronounsFor);
- } else {
- pronouns = PronounDB.getPronounsFor(platform, user);
- }
- pronouns.handleAsync((pronounChoice, throwable) -> {
- if (throwable != null || !pronounChoice.isPresent()) {
- nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] §4Failed to fetch pronouns."), id);
- return null;
- }
- PronounDB.PronounChoice betterPronounChoice = pronounChoice.get();
- nc.printChatMessageWithOptionalDeletion(new ChatComponentText(
- "§e[NEU] Pronouns for §b" + user + " §eon §b" + platform + "§e:"), id);
- betterPronounChoice.render().forEach(it -> nc.printChatMessage(new ChatComponentText("§e[NEU] §a" + it)));
- return null;
- }, MinecraftExecutor.INSTANCE);
-
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/UpdateCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/UpdateCommand.java
deleted file mode 100644
index 1aeebda5..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/UpdateCommand.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.misc;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-
-public class UpdateCommand extends ClientCommandBase {
- NotEnoughUpdates neu;
-
- public UpdateCommand(NotEnoughUpdates neu) {
- super("neuupdate");
- this.neu = neu;
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Arrays.asList("neuupdates", "enoughupdates");
- }
-
- public void displayHelp(ICommandSender sender) {
- sender.addChatMessage(new ChatComponentText(
- "" +
- "§e[NEU] §b/neuupdate help - View help.\n" +
- "§e[NEU] §b/neuupdate check - Check for updates.\n" +
- ""
- ));
-
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if ((args.length == 1 && Objects.equals(args[0], "help")) || args.length == 0) {
- displayHelp(sender);
- return;
- }
- switch (args[0].toLowerCase().intern()) {
- case "check":
- neu.autoUpdater.displayUpdateMessageIfOutOfDate();
- break;
- case "scheduledownload":
- neu.autoUpdater.scheduleDownload();
- break;
- case "updatemodes":
- sender.addChatMessage(new ChatComponentText("§e[NEU] §bTo ensure we do not accidentally corrupt your mod folder, we can only offer support for auto-updates on system with certain capabilities for file deletions (specifically unix systems). You can still manually update your files"));
- break;
- default:
- displayHelp(sender);
-
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java
deleted file mode 100644
index 23852ab6..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.profile;
-
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats;
-import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-import org.apache.commons.lang3.text.WordUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-public class PeekCommand extends ClientCommandBase {
-
- private ScheduledExecutorService peekCommandExecutorService = null;
- private ScheduledFuture<?> peekScheduledFuture = null;
-
- public PeekCommand() {
- super("peek");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- String name;
- if (args.length == 0) {
- name = Minecraft.getMinecraft().thePlayer.getName();
- } else {
- name = args[0];
- }
- int id = new Random().nextInt(Integer.MAX_VALUE / 2) + Integer.MAX_VALUE / 2;
-
- Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(
- EnumChatFormatting.YELLOW + "[PEEK] Getting player information..."), id);
- NotEnoughUpdates.profileViewer.getProfileByName(name, profile -> {
- if (profile == null) {
- Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(
- EnumChatFormatting.RED + "[PEEK] Unknown player or the Hypixel API is down."), id);
- } else {
- profile.resetCache();
-
- if (peekCommandExecutorService == null || peekCommandExecutorService.isTerminated()) {
- peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor();
- }
-
- if (peekScheduledFuture != null && !peekScheduledFuture.isDone()) {
- Utils.addChatMessage(
- EnumChatFormatting.RED + "[PEEK] New peek command was run, cancelling old one.");
- peekScheduledFuture.cancel(true);
- }
-
- Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(
- EnumChatFormatting.YELLOW + "[PEEK] Getting the player's SkyBlock profile(s)..."), id);
-
- long startTime = System.currentTimeMillis();
- peekScheduledFuture = peekCommandExecutorService.schedule(new Runnable() {
- public void run() {
- if (System.currentTimeMillis() - startTime > 10 * 1000) {
- Minecraft.getMinecraft().ingameGUI
- .getChatGUI()
- .printChatMessageWithOptionalDeletion(new ChatComponentText(
- EnumChatFormatting.RED + "[PEEK] Getting profile info took too long, aborting."), id);
- return;
- }
-
- String g = EnumChatFormatting.GRAY.toString();
-
- JsonObject profileInfo = profile.getProfileInformation(null);
- if (profileInfo != null) {
- float overallScore = 0;
-
- boolean isMe = name.equalsIgnoreCase("moulberry");
-
- PlayerStats.Stats stats = profile.getStats(null);
- if (stats == null) {
- peekScheduledFuture = peekCommandExecutorService.schedule(this, 200, TimeUnit.MILLISECONDS);
- return;
- }
- Map<String, ProfileViewer.Level> skyblockInfo = profile.getSkyblockInfo(null);
-
- if (NotEnoughUpdates.INSTANCE.config.profileViewer.useSoopyNetworth) {
- Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(
- EnumChatFormatting.YELLOW + "[PEEK] Getting the player's Skyblock networth..."), id);
-
- CountDownLatch countDownLatch = new CountDownLatch(1);
-
- profile.getSoopyNetworth(null, () -> countDownLatch.countDown());
-
- try { //Wait for async network request
- countDownLatch.await(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {}
-
- //Now it's waited for network request the data should be cached (accessed in nw section)
- }
-
- Minecraft.getMinecraft().ingameGUI
- .getChatGUI()
- .printChatMessageWithOptionalDeletion(new ChatComponentText(EnumChatFormatting.GREEN + " " +
- EnumChatFormatting.STRIKETHROUGH + "-=-" + EnumChatFormatting.RESET + EnumChatFormatting.GREEN +
- " " +
- Utils.getElementAsString(profile.getHypixelProfile().get("displayname"), name) + "'s Info " +
- EnumChatFormatting.STRIKETHROUGH + "-=-"), id);
-
- if (skyblockInfo == null) {
- Utils.addChatMessage(EnumChatFormatting.YELLOW + "Skills API disabled!");
- } else {
- float totalSkillLVL = 0;
- float totalSkillCount = 0;
-
- List<String> skills = Arrays.asList("taming", "mining", "foraging", "enchanting", "farming", "combat", "fishing", "alchemy", "carpentry");
- for (String skillName : skills) {
- totalSkillLVL += skyblockInfo.get(skillName).level;
- totalSkillCount++;
- }
-
- float combat = skyblockInfo.get("combat").level;
- float zombie = skyblockInfo.get("zombie").level;
- float spider = skyblockInfo.get("spider").level;
- float wolf = skyblockInfo.get("wolf").level;
- float enderman = skyblockInfo.get("enderman").level;
- float blaze = skyblockInfo.get("blaze").level;
-
- float avgSkillLVL = totalSkillLVL / totalSkillCount;
-
- if (isMe) {
- avgSkillLVL = 6;
- combat = 4;
- zombie = 2;
- spider = 1;
- wolf = 2;
- enderman = 0;
- blaze = 0;
- }
-
- EnumChatFormatting combatPrefix = combat > 20
- ? (combat > 35 ? EnumChatFormatting.GREEN : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting zombiePrefix = zombie > 3
- ? (zombie > 6 ? EnumChatFormatting.GREEN : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting spiderPrefix = spider > 3
- ? (spider > 6 ? EnumChatFormatting.GREEN : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting wolfPrefix =
- wolf > 3 ? (wolf > 6 ? EnumChatFormatting.GREEN : EnumChatFormatting.YELLOW) : EnumChatFormatting.RED;
- EnumChatFormatting endermanPrefix = enderman > 3
- ? (enderman > 6
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting blazePrefix = blaze > 3
- ? (blaze > 6
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting avgPrefix = avgSkillLVL > 20
- ? (avgSkillLVL > 35
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
-
- overallScore += zombie * zombie / 81f;
- overallScore += spider * spider / 81f;
- overallScore += wolf * wolf / 81f;
- overallScore += enderman * enderman / 81f;
- overallScore += blaze * blaze / 81f;
- overallScore += avgSkillLVL / 20f;
-
- int cata = (int) skyblockInfo.get("catacombs").level;
- EnumChatFormatting cataPrefix = cata > 15
- ? (cata > 25 ? EnumChatFormatting.GREEN : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
-
- overallScore += cata * cata / 2000f;
-
- Utils.addChatMessage(g + "Combat: " + combatPrefix + (int) Math.floor(combat) +
- (cata > 0 ? g + " - Cata: " + cataPrefix + cata : "") +
- g + " - AVG: " + avgPrefix + (int) Math.floor(avgSkillLVL));
- Utils.addChatMessage(g + "Slayer: " + zombiePrefix + (int) Math.floor(zombie) + g + "-" +
- spiderPrefix + (int) Math.floor(spider) + g + "-" +
- wolfPrefix + (int) Math.floor(wolf) + g + "-" +
- endermanPrefix + (int) Math.floor(enderman) + g + "-" +
- blazePrefix + (int) Math.floor(blaze));
- }
- if (stats == null) {
- Utils.addChatMessage(EnumChatFormatting.YELLOW + "Skills, collection and/or inventory apis disabled!");
- } else {
- int health = (int) stats.get("health");
- int defence = (int) stats.get("defence");
- int strength = (int) stats.get("strength");
- int intelligence = (int) stats.get("intelligence");
-
- EnumChatFormatting healthPrefix = health > 800
- ? (health > 1600
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting defencePrefix = defence > 200
- ? (defence > 600
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting strengthPrefix = strength > 100
- ? (strength > 300
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
- EnumChatFormatting intelligencePrefix = intelligence > 300
- ? (intelligence > 900
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW)
- : EnumChatFormatting.RED;
-
- Utils.addChatMessage( g + "Stats : " + healthPrefix + health + EnumChatFormatting.RED + "\u2764 " +
- defencePrefix + defence + EnumChatFormatting.GREEN + "\u2748 " +
- strengthPrefix + strength + EnumChatFormatting.RED + "\u2741 " +
- intelligencePrefix + intelligence + EnumChatFormatting.AQUA + "\u270e ");
- }
- float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), -1);
- float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
-
- long networth;
- if (NotEnoughUpdates.INSTANCE.config.profileViewer.useSoopyNetworth) {
- ProfileViewer.Profile.SoopyNetworthData nwData = profile.getSoopyNetworth(null, () -> {});
- if (nwData == null) {
- networth = -2l;
- } else {
- networth = nwData.getTotal();
- }
- } else {
- networth = profile.getNetWorth(null);
- }
-
- float money = Math.max(bankBalance + purseBalance, networth);
- EnumChatFormatting moneyPrefix = money > 50 * 1000 * 1000 ?
- (money > 200 * 1000 * 1000
- ? EnumChatFormatting.GREEN
- : EnumChatFormatting.YELLOW) : EnumChatFormatting.RED;
- Utils.addChatMessage( g + "Purse: " + moneyPrefix + Utils.shortNumberFormat(purseBalance, 0) + g + " - Bank: " +
- (bankBalance == -1 ? EnumChatFormatting.YELLOW + "N/A" : moneyPrefix +
- (isMe ? "4.8b" : Utils.shortNumberFormat(bankBalance, 0))) +
- (networth > 0 ? g + " - Net: " + moneyPrefix + Utils.shortNumberFormat(networth, 0) : ""));
-
- overallScore += Math.min(2, money / (100f * 1000 * 1000));
-
- String activePet = Utils.getElementAsString(
- Utils.getElement(profile.getPetsInfo(null), "active_pet.type"),
- "None Active"
- );
- String activePetTier = Utils.getElementAsString(Utils.getElement(
- profile.getPetsInfo(null),
- "active_pet.tier"
- ), "UNKNOWN");
-
- String col = NotEnoughUpdates.petRarityToColourMap.get(activePetTier);
- if (col == null) col = EnumChatFormatting.LIGHT_PURPLE.toString();
-
- Utils.addChatMessage(g + "Pet : " + col + WordUtils.capitalizeFully(activePet.replace("_", " ")));
-
- String overall = "Skywars Main";
- if (isMe) {
- overall = Utils.chromaString("Literally the best player to exist"); // ego much
- } else if (overallScore < 5 && (bankBalance + purseBalance) > 500 * 1000 * 1000) {
- overall = EnumChatFormatting.GOLD + "Bill Gates";
- } else if (overallScore > 9) {
- overall = Utils.chromaString("Didn't even think this score was possible");
- } else if (overallScore > 8) {
- overall = Utils.chromaString("Mentally unstable");
- } else if (overallScore > 7) {
- overall = EnumChatFormatting.GOLD + "Why though 0.0";
- } else if (overallScore > 5.5) {
- overall = EnumChatFormatting.GOLD + "Bro stop playing";
- } else if (overallScore > 4) {
- overall = EnumChatFormatting.GREEN + "Kinda sweaty";
- } else if (overallScore > 3) {
- overall = EnumChatFormatting.YELLOW + "Alright I guess";
- } else if (overallScore > 2) {
- overall = EnumChatFormatting.YELLOW + "Ender Non";
- } else if (overallScore > 1) {
- overall = EnumChatFormatting.RED + "Played SkyBlock";
- }
-
- Utils.addChatMessage(g + "Overall score: " + overall + g + " (" + Math.round(overallScore * 10) / 10f + ")");
-
- peekCommandExecutorService.shutdownNow();
- } else {
- peekScheduledFuture = peekCommandExecutorService.schedule(this, 200, TimeUnit.MILLISECONDS);
- }
- }
- }, 200, TimeUnit.MILLISECONDS);
- }
- });
- }
-
- @Override
- public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
- if (args.length != 1) return null;
-
- String lastArg = args[args.length - 1];
- List<String> playerMatches = new ArrayList<>();
- for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
- String playerName = player.getName();
- if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) {
- playerMatches.add(playerName);
- }
- }
- return playerMatches;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PvCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PvCommand.java
deleted file mode 100644
index 2d5c05f4..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PvCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.profile;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.ICommandSender;
-import org.apache.commons.lang3.StringUtils;
-
-public class PvCommand extends ViewProfileCommand {
-
- public PvCommand() {
- super("pv");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- if (!NotEnoughUpdates.INSTANCE.isOnSkyblock()) {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/pv " + StringUtils.join(args, " "));
- } else {
- super.processCommand(sender, args);
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java
deleted file mode 100644
index 26468e39..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/ViewProfileCommand.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.profile;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Consumer;
-
-public class ViewProfileCommand extends ClientCommandBase {
-
- public static final Consumer<String[]> RUNNABLE = (args) -> {
- if (!OpenGlHelper.isFramebufferEnabled()) {
- Utils.addChatMessage(EnumChatFormatting.RED +
- "Some parts of the profile viewer do not work with OptiFine Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.");
-
- }
- if (NotEnoughUpdates.INSTANCE.config.apiData.apiKey == null ||
- NotEnoughUpdates.INSTANCE.config.apiData.apiKey.trim().isEmpty()) {
- Utils.addChatMessage(EnumChatFormatting.RED +
- "Can't view profile, an API key is not set. Run /api new and put the result in settings.");
- } else if (args.length == 0) {
- NotEnoughUpdates.profileViewer.getProfileByName(Minecraft.getMinecraft().thePlayer.getName(), profile -> {
- if (profile == null) {
- Utils.addChatMessage(EnumChatFormatting.RED +
- "Invalid player name/API key. Maybe the API is down? Try /api new.");
- } else {
- profile.resetCache();
- NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile);
- }
- });
- } else if (args.length > 1) {
- Utils.addChatMessage(EnumChatFormatting.RED +
- "Too many arguments. Usage: /neuprofile [name]");
- } else {
- NotEnoughUpdates.profileViewer.getProfileByName(args[0], profile -> {
- if (profile == null) {
- Utils.addChatMessage(EnumChatFormatting.RED + "Invalid player name/api key. Maybe the API is down? Try /api new.");
- } else {
- profile.resetCache();
- NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile);
- }
- });
- }
- };
-
- public ViewProfileCommand() {
- this("neuprofile");
- }
-
- public ViewProfileCommand(String name) {
- super(name);
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- RUNNABLE.accept(args);
- }
-
- @Override
- public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
- if (args.length != 1) return null;
-
- String lastArg = args[args.length - 1];
- List<String> playerMatches = new ArrayList<>();
- for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
- String playerName = player.getName();
- if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) {
- playerMatches.add(playerName);
- }
- }
- return playerMatches;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
index 1802a1a4..405b18fc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
@@ -254,13 +254,11 @@ public class GuiElementColour extends GuiElement {
RenderUtils.drawTexturedRect(x + 5 + 32 + selx - 4, y + 5 + 32 + sely - 4, 8, 8, GL11.GL_NEAREST);
TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString() + Math.round(hsv[2] * 100) + "",
- Minecraft.getMinecraft().fontRendererObj,
x + 5 + 64 + 5 + 5 - (Math.round(hsv[2] * 100) == 100 ? 1 : 0), y + 5 + 64 + 5 + 5, true, 13, -1
);
if (opacitySlider) {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
EnumChatFormatting.GRAY.toString() + Math.round(c.getAlpha() / 255f * 100) + "",
- Minecraft.getMinecraft().fontRendererObj,
x + 5 + 64 + 5 + valueOffset + 5,
y + 5 + 64 + 5 + 5,
true,
@@ -271,7 +269,6 @@ public class GuiElementColour extends GuiElement {
if (chromaSpeed > 0) {
TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString() +
(int) ChromaColour.getSecondsForSpeed(chromaSpeed) + "s",
- Minecraft.getMinecraft().fontRendererObj,
x + 5 + 64 + 5 + valueOffset + opacityOffset + 6, y + 5 + 64 + 5 + 5, true, 13, -1
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
index 45dc58cc..5ab62d2a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
@@ -550,7 +550,6 @@ public class GuiElementTextField {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
Utils.chromaStringByColourCode(texts[yOffI]),
- Minecraft.getMinecraft().fontRendererObj,
x + searchBarXSize / 2f,
y + searchBarYSize / 2f + yOff,
false,
@@ -665,12 +664,12 @@ public class GuiElementTextField {
y + (searchBarYSize - 8) / 2 + 9 + texY, Color.LIGHT_GRAY.getRGB()
);
- TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj,
+ TextRenderUtils.drawStringScaled(String.valueOf(c),
x + xStartOffset + texX,
y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale
);
if (bold) {
- TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj,
+ TextRenderUtils.drawStringScaled(String.valueOf(c),
x + xStartOffset + texX + 1,
y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java
index 920cb326..ddd1e71f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java
@@ -30,6 +30,7 @@ public @interface ConfigOption {
String name();
String desc();
+
String[] searchTags() default "";
int subcategoryId() default -1;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
index 9edad918..fd0946c9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
@@ -39,8 +39,9 @@ public abstract class GuiOptionEditor {
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
RenderUtils.drawFloatingRectDark(x, y, width, height, true);
- TextRenderUtils.drawStringCenteredScaledMaxWidth(option.name,
- fr, x + width / 6, y + 13, true, width / 3 - 10, 0xc0c0c0
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ option.name,
+ x + width / 6, y + 13, true, width / 3 - 10, 0xc0c0c0
);
int maxLines = 5;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java
index 91515259..a422a8ec 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java
@@ -22,7 +22,6 @@ package io.github.moulberry.notenoughupdates.core.config.gui;
import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
@@ -76,9 +75,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor {
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
- TextRenderUtils.drawStringScaledMaxWidth(option.name, Minecraft.getMinecraft().fontRendererObj,
- x + 18, y + 6, false, width - 10, 0xc0c0c0
- );
+ TextRenderUtils.drawStringScaledMaxWidth(option.name, x + 18, y + 6, false, width - 10, 0xc0c0c0);
}
@Override
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java
index aef6318c..fb5b58f3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorButton.java
@@ -59,9 +59,9 @@ public class GuiOptionEditorButton extends GuiOptionEditor {
RenderUtils.drawTexturedRect(x + width / 6 - 24, y + height - 7 - 14, 48, 16);
if (buttonText != null) {
- TextRenderUtils.drawStringCenteredScaledMaxWidth(buttonText, Minecraft.getMinecraft().fontRendererObj,
- x + width / 6, y + height - 7 - 6,
- false, 44, 0xFF303030
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ buttonText,
+ x + width / 6, y + height - 7 - 6, false, 44, 0xFF303030
);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
index ef2a52bb..e080bb28 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
@@ -25,7 +25,6 @@ import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -93,10 +92,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex);
RenderUtils.drawTexturedRect(x + width / 6 - 24, y + 45 - 7 - 14, 48, 16);
- TextRenderUtils.drawStringCenteredScaledMaxWidth("Add", Minecraft.getMinecraft().fontRendererObj,
- x + width / 6, y + 45 - 7 - 6,
- false, 44, 0xFF303030
- );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Add", x + width / 6, y + 45 - 7 - 6, false, 44, 0xFF303030);
long currentTime = System.currentTimeMillis();
if (trashHoverTime < 0) {
@@ -128,7 +124,8 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
if (i++ != dragStartIndex) {
for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) {
String line = multilines[multilineIndex];
- Utils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringScaledMaxWidth(
+ line + EnumChatFormatting.RESET,
x + 20, y + 50 + yOff + multilineIndex * 10, true, width - 20, 0xffffffff
);
}
@@ -156,7 +153,6 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
}
remaining.removeAll(activeText);
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
int dropdownWidth = Math.min(width / 2 - 10, 150);
int left = dragOffsetX;
int top = dragOffsetY;
@@ -184,7 +180,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
str = "<NONE>";
}
TextRenderUtils.drawStringScaledMaxWidth(str.replaceAll("(\n.*)+", " ..."),
- fr, left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0
+ left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0
);
dropdownY += 12;
}
@@ -215,7 +211,6 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
String line = multilines[multilineIndex];
Utils.drawStringScaledMaxWidth(
line + EnumChatFormatting.RESET,
- Minecraft.getMinecraft().fontRendererObj,
dragOffsetX + mouseX + 10,
dragOffsetY + mouseY + multilineIndex * 10,
true,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
index af6af277..115b502e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
@@ -22,8 +22,6 @@ package io.github.moulberry.notenoughupdates.core.config.gui;
import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.input.Mouse;
@@ -54,7 +52,6 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
if (!open) {
int height = getHeight();
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
int dropdownWidth = Math.min(width / 3 - 10, 80);
int left = x + width / 6 - dropdownWidth / 2;
int top = y + height - 7 - 14;
@@ -67,7 +64,6 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
RenderUtils.drawFloatingRectDark(left, top, dropdownWidth, 14, false);
TextRenderUtils.drawStringScaled(
"\u25BC",
- fr,
left + dropdownWidth - 10,
y + height - 7 - 15,
false,
@@ -75,9 +71,9 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
2
);
- TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left + 3, top + 3, false,
- dropdownWidth - 16, 0xffa0a0a0
- );
+ TextRenderUtils.drawStringScaledMaxWidth(
+ selectedString,
+ left + 3, top + 3, false, dropdownWidth - 16, 0xffa0a0a0);
}
}
@@ -91,7 +87,6 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
int height = getHeight();
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
int dropdownWidth = Math.min(width / 3 - 10, 80);
int left = x + width / 6 - dropdownWidth / 2;
int top = y + height - 7 - 14;
@@ -117,28 +112,16 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
}
TextRenderUtils.drawStringScaledMaxWidth(
option,
- fr,
- left + 3,
- top + 3 + dropdownY,
- false,
- dropdownWidth - 6,
- 0xffa0a0a0
+ left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0
);
dropdownY += 12;
}
- TextRenderUtils.drawStringScaled(
- "\u25B2",
- fr,
- left + dropdownWidth - 10,
- y + height - 7 - 15,
- false,
- 0xffa0a0a0,
- 2
- );
+ TextRenderUtils.drawStringScaled("\u25B2", left + dropdownWidth - 10, y + height - 7 - 15, false, 0xffa0a0a0, 2);
- TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left + 3, top + 3, false,
- dropdownWidth - 16, 0xffa0a0a0
+ TextRenderUtils.drawStringScaledMaxWidth(
+ selectedString,
+ left + 3, top + 3, false, dropdownWidth - 16, 0xffa0a0a0
);
GlStateManager.popMatrix();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java
index 048e261e..db788b95 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorFSR.java
@@ -54,9 +54,9 @@ public class GuiOptionEditorFSR extends GuiOptionEditor {
RenderUtils.drawTexturedRect(x + width / 6 - 24, y + height - 7 - 14, 48, 16);
if (buttonText != null) {
- TextRenderUtils.drawStringCenteredScaledMaxWidth(buttonText, Minecraft.getMinecraft().fontRendererObj,
- x + width / 6, y + height - 7 - 6,
- false, 44, 0xFF303030
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ buttonText,
+ x + width / 6, y + height - 7 - 6, false, 44, 0xFF303030
);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java
index b7d70db8..ffad3bc0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java
@@ -59,11 +59,7 @@ public class GuiOptionEditorKeybind extends GuiOptionEditor {
String keyName = KeybindHelper.getKeyName(getKeyCode());
String text = editingKeycode ? "> " + keyName + " <" : keyName;
- TextRenderUtils.drawStringCenteredScaledMaxWidth(text,
- Minecraft.getMinecraft().fontRendererObj,
- x + width / 6, y + height - 7 - 6,
- false, 40, 0xFF303030
- );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(text, x + width / 6, y + height - 7 - 6, false, 40, 0xFF303030);
Minecraft.getMinecraft().getTextureManager().bindTexture(RESET);
GlStateManager.color(1, 1, 1, 1);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
index 1b71e3ce..c7dced22 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
@@ -135,10 +135,9 @@ public class GuiPositionEditor extends GuiScreen {
if (position.isCenterY()) y -= elementHeight / 2;
Gui.drawRect(x, y, x + elementWidth, y + elementHeight, 0x80404040);
- Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff
- );
- Utils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Position Editor", scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff);
+ Utils.drawStringCentered(
+ "R to Reset - Arrow keys/mouse to move",
scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java
index b334418c..9f2088ed 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditorButForTheDungeonMap.java
@@ -106,12 +106,10 @@ public class GuiPositionEditorButForTheDungeonMap extends GuiScreen { // nea is
}
scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff
- );
- Utils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff
- );
+ Utils.drawStringCentered("Position Editor", scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff);
+ Utils.drawStringCentered(
+ "R to Reset - Arrow keys/mouse to move",
+ scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff);
}
@Override
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java
index 8415cf72..11112782 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/GuiOptionEditorBlocked.java
@@ -56,7 +56,6 @@ public class GuiOptionEditorBlocked extends GuiOptionEditor {
TextRenderUtils.drawStringScaledMaxWidth(
"This option is currently not available.",
- mc.fontRendererObj,
x + iconWidth,y + getHeight() / 2F - mc.fontRendererObj.FONT_HEIGHT / 2F,
true, (int) (width - iconWidth), 0xFFFF4444
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java
index 1e70db7f..e9bff8f6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/ArrowPagesUtils.java
@@ -21,7 +21,6 @@ package io.github.moulberry.notenoughupdates.core.util;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
@@ -92,9 +91,8 @@ public class ArrowPagesUtils {
String selectedPage = (currentPage + 1) + "/" + totalPages;
- FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
- Utils.drawStringCenteredScaledMaxWidth(selectedPage, fontRendererObj,
- guiLeft + pageStringX, guiTop + pageStringY, false, 28, Color.BLACK.getRGB()
+ Utils.drawStringCenteredScaledMaxWidth(
+ selectedPage, guiLeft + pageStringX, guiTop + pageStringY, false, 28, Color.BLACK.getRGB()
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java
index cee38cea..336dcb67 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java
@@ -67,6 +67,18 @@ public class TextRenderUtils {
public static void drawStringScaledMaxWidth(
String str,
+ float x,
+ float y,
+ boolean shadow,
+ int len,
+ int colour
+ ) {
+ drawStringScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour);
+ }
+
+ @Deprecated
+ public static void drawStringScaledMaxWidth(
+ String str,
FontRenderer fr,
float x,
float y,
@@ -78,7 +90,7 @@ public class TextRenderUtils {
float factor = len / (float) strLen;
factor = Math.min(1, factor);
- drawStringScaled(str, fr, x, y, shadow, colour, factor);
+ drawStringScaled(str, x, y, shadow, colour, factor);
}
public static void drawStringCentered(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
@@ -94,7 +106,19 @@ public class TextRenderUtils {
public static void drawStringScaled(
String str,
- FontRenderer fr,
+ float x,
+ float y,
+ boolean shadow,
+ int colour,
+ float factor
+ ) {
+ drawStringScaled(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour, factor);
+ }
+
+ @Deprecated
+ public static void drawStringScaled(
+ String str,
+ FontRenderer fr,
float x,
float y,
boolean shadow,
@@ -108,6 +132,18 @@ public class TextRenderUtils {
public static void drawStringCenteredScaledMaxWidth(
String str,
+ float x,
+ float y,
+ boolean shadow,
+ int len,
+ int colour
+ ) {
+ drawStringCenteredScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour);
+ }
+
+ @Deprecated
+ public static void drawStringCenteredScaledMaxWidth(
+ String str,
FontRenderer fr,
float x,
float y,
@@ -122,7 +158,7 @@ public class TextRenderUtils {
float fontHeight = 8 * factor;
- drawStringScaled(str, fr, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor);
+ drawStringScaled(str, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor);
}
public static void renderToolTip(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
index 4a7c1939..984a7931 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
@@ -150,7 +150,7 @@ public class CapeManager {
NotEnoughUpdates.INSTANCE.manager.apiUtils
.newMoulberryRequest("activecapes.json")
.requestJson()
- .thenAccept(jsonObject -> {
+ .thenAcceptAsync(jsonObject -> {
if (jsonObject.get("success").getAsBoolean()) {
lastJsonSync = jsonObject;
@@ -171,7 +171,7 @@ public class CapeManager {
NotEnoughUpdates.INSTANCE.manager.apiUtils
.newMoulberryRequest("permscapes.json")
.requestJson()
- .thenAccept(jsonObject -> {
+ .thenAcceptAsync(jsonObject -> {
if (!jsonObject.get("success").getAsBoolean()) return;
permSyncTries = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java
index 12d8c92d..cacae83b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java
@@ -134,17 +134,7 @@ public class GuiCosmetics extends GuiScreen {
for (String line : cosmeticsInfoTooltip) {
grayTooltip.add(EnumChatFormatting.GRAY + line);
}
- Utils.drawHoveringText(
- grayTooltip,
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
-
- }
+ Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1);}
}
StringBuilder statusMsg = new StringBuilder("Last Sync: ");
@@ -193,9 +183,7 @@ public class GuiCosmetics extends GuiScreen {
equipMsg += " - " + (20 - (System.currentTimeMillis() - lastCapeEquip) / 1000) + "s";
}
- Utils.drawStringCenteredScaledMaxWidth(equipMsg, Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f, guiTop + sizeY + 5 + 10, false, 90, 0
- );
+ Utils.drawStringCenteredScaledMaxWidth(equipMsg, guiLeft + sizeX / 2f, guiTop + sizeY + 5 + 10, false, 90, 0);
}
if (unlockTextField.getFocus() || !unlockTextField.getText().isEmpty()) {
@@ -529,7 +517,6 @@ public class GuiCosmetics extends GuiScreen {
Utils.drawStringCenteredScaledMaxWidth(
"Try it out",
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 20 + 91 * displayIndex + 81 / 2f - xOffset,
guiTop + 123 + 10,
false,
@@ -539,7 +526,6 @@ public class GuiCosmetics extends GuiScreen {
if (equipable) {
Utils.drawStringCenteredScaledMaxWidth(
"Equip",
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 20 + 91 * displayIndex + 81 / 2f - xOffset,
guiTop + 149 + 10,
false,
@@ -549,7 +535,6 @@ public class GuiCosmetics extends GuiScreen {
} else {
Utils.drawStringCenteredScaledMaxWidth(
"Not Unlocked",
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 20 + 91 * displayIndex + 81 / 2f - xOffset,
guiTop + 149 + 10,
false,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
index a56a5679..5b476c93 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
@@ -218,8 +218,8 @@ public class DungeonWin {
if (hideChat) {
if (text.size() > 50) text.clear();
- e.setCanceled(true);
if (unformatted.contains("\u25AC")) {
+ e.setCanceled(true);
hideChat = false;
displayWin();
} else {
@@ -229,12 +229,15 @@ public class DungeonWin {
"Total Damage")
|| unformatted.contains("Ally Healing") || unformatted.contains("Enemies Killed") || unformatted.contains(
"Deaths") || unformatted.contains("Secrets Found")) {
+ e.setCanceled(true);
text.add(e.message.getFormattedText().substring(6).trim());
- } else {
+ } else if (unformatted.trim().length() > 6) {
System.out.println(
"These messages would of showed on neu dungeon overlay but didnt, They are either bugged or i missed them: \"" +
e.message.getFormattedText().substring(6).trim() + "\"");
}
+ } else {
+ e.setCanceled(true);
}
}
} else {
@@ -281,7 +284,6 @@ public class DungeonWin {
if (Math.abs(xOff) != Math.abs(yOff)) {
Utils.drawStringCentered(
Utils.cleanColourNotModifiers(line),
- Minecraft.getMinecraft().fontRendererObj,
sr.getScaledWidth() / 2 + xOff / 2f,
textCenterY + yOff / 2f,
false,
@@ -292,9 +294,7 @@ public class DungeonWin {
}
}
- Utils.drawStringCentered(line, Minecraft.getMinecraft().fontRendererObj,
- sr.getScaledWidth() / 2, textCenterY, false, (textAlpha << 24) | 0x00FFFFFF
- );
+ Utils.drawStringCentered(line, sr.getScaledWidth() / 2, textCenterY, false, (textAlpha << 24) | 0x00FFFFFF);
}
}
}
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 025e11b2..dfd0405b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
@@ -145,7 +145,6 @@ public class GuiDungeonMapEditor extends GuiScreen {
if (text.length() > 0) {
Utils.drawStringCenteredScaledMaxWidth(
text,
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + x + 24,
guiTop + y + 8,
false,
@@ -379,64 +378,30 @@ public class GuiDungeonMapEditor extends GuiScreen {
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("Border Size", guiLeft + 76, guiTop + 30, false, 137, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Rooms Size", guiLeft + 76, guiTop + 60, false, 137, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Icon Scale", guiLeft + 76, guiTop + 90, false, 137, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Border Style", 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("Dungeon Map", guiLeft + 44 + 139, guiTop + 30, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Center", 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("Rotate", guiLeft + 44 + 139, guiTop + 59, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Icon Style", 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("Check Orient", guiLeft + 44 + 139, guiTop + 88, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Check Center", 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("Interpolation", guiLeft + 44 + 139, guiTop + 117, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Compatibility", 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("Background", guiLeft + 44 + 139, guiTop + 146, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Border", 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("BG Blur", guiLeft + 44 + 139, guiTop + 175, false, 60, 0xFFB4B4B4);
+ Utils.drawStringCenteredScaledMaxWidth("Chroma Type", guiLeft + 108 + 139, guiTop + 175, false, 60, 0xFFB4B4B4);
- Utils.drawStringCenteredScaledMaxWidth("Edit Map Position", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 76, guiTop + 209, false, 200, 0xFFB4B4B4
- );
+ Utils.drawStringCenteredScaledMaxWidth("Edit Map Position", guiLeft + 76, guiTop + 209, false, 200, 0xFFB4B4B4);
try {
drawSlider(DungeonMapConfig.class.getDeclaredField("dmBorderSize"), guiLeft + 76, guiTop + 45);
@@ -468,9 +433,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
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
- );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Edit", 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));
@@ -495,8 +458,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
mouseY,
width,
height,
- 200,
- Minecraft.getMinecraft().fontRendererObj
+ 200
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/envcheck/NEUMixinConfigPlugin.java b/src/main/java/io/github/moulberry/notenoughupdates/envcheck/NEUMixinConfigPlugin.java
index 44e24ff4..1d12813c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/envcheck/NEUMixinConfigPlugin.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/envcheck/NEUMixinConfigPlugin.java
@@ -1,5 +1,6 @@
package io.github.moulberry.notenoughupdates.envcheck;
+import io.github.moulberry.notenoughupdates.miscgui.DynamicLightItemsEditor;
import org.spongepowered.asm.lib.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
@@ -42,5 +43,8 @@ public class NEUMixinConfigPlugin implements IMixinConfigPlugin {
@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
+ if ("io.github.moulberry.notenoughupdates.mixins.MixinOFDynamicLights".equals(mixinClassName)) {
+ DynamicLightItemsEditor.setDidApplyMixin(true);
+ }
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.java b/src/main/java/io/github/moulberry/notenoughupdates/events/GuiContainerBackgroundDrawnEvent.java
index bf973b76..bdb6d1a1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/events/GuiContainerBackgroundDrawnEvent.java
@@ -17,21 +17,13 @@
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-package io.github.moulberry.notenoughupdates.util;
+package io.github.moulberry.notenoughupdates.events;
-import net.minecraft.client.Minecraft;
-import org.jetbrains.annotations.NotNull;
+import lombok.Value;
+import net.minecraft.client.gui.inventory.GuiContainer;
-import java.util.concurrent.Executor;
-
-public class MinecraftExecutor implements Executor {
-
- public static MinecraftExecutor INSTANCE = new MinecraftExecutor();
-
- private MinecraftExecutor() {}
-
- @Override
- public void execute(@NotNull Runnable runnable) {
- Minecraft.getMinecraft().addScheduledTask(runnable);
- }
+@Value
+public class GuiContainerBackgroundDrawnEvent extends NEUEvent {
+ public GuiContainer container;
+ public float partialTicks;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java
index 4b6c73f4..a8df8d1f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java
@@ -121,7 +121,6 @@ public class FlipperInfoPane extends InfoPane {
}
private int renderParagraph(int width, int height, int startY, String text, Color bg) {
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
int paneWidth = (int) (width / 3 * overlay.getWidthMult());
int rightSide = (int) (width * overlay.getInfoPaneOffsetFactor());
@@ -129,7 +128,7 @@ public class FlipperInfoPane extends InfoPane {
int yOff = 0;
for (String line : text.split("\n")) {
- yOff += Utils.renderStringTrimWidth(line, fr, false, leftSide + overlay.getBoxPadding() + 5,
+ yOff += Utils.renderStringTrimWidth(line, false, leftSide + overlay.getBoxPadding() + 5,
startY + overlay.getBoxPadding() + 10 + yOff,
width * 1 / 3 - overlay.getBoxPadding() * 2 - 10, Color.WHITE.getRGB(), -1
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java
index 90bed1fa..37e9e4d7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/TextInfoPane.java
@@ -61,7 +61,7 @@ public class TextInfoPane extends ScrollableInfoPane {
int yOff = 20;
for (String line : text.split("\n")) {
- yOff += Utils.renderStringTrimWidth(line, fr, false, leftSide + overlay.getBoxPadding() + 5,
+ yOff += Utils.renderStringTrimWidth(line, false, leftSide + overlay.getBoxPadding() + 5,
yScroll + overlay.getBoxPadding() + 10 + yOff,
width * 1 / 3 - overlay.getBoxPadding() * 2 - 10, Color.WHITE.getRGB(), -1
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java
index 7cc96d42..cf4edb76 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java
@@ -123,7 +123,7 @@ public class GuiElementTextField extends GuiElement {
}
private float getScaleFactor(String str) {
- return Math.min(1, (searchBarXSize - 2) / (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(str));
+ return Math.min(1, (searchBarXSize - 2) / (float) getStringWidth0(str));
}
private boolean isScaling() {
@@ -132,12 +132,16 @@ public class GuiElementTextField extends GuiElement {
private float getStringWidth(String str) {
if (isScaling()) {
- return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str) * getScaleFactor(str);
+ return getStringWidth0(str) * getScaleFactor(str);
} else {
- return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str);
+ return getStringWidth0(str);
}
}
+ private static int getStringWidth0(String str) {
+ return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str);
+ }
+
public int getCursorPos(int mouseX, int mouseY) {
int xComp = mouseX - x;
int yComp = mouseY - y;
@@ -188,7 +192,7 @@ public class GuiElementTextField extends GuiElement {
int linePos = strLenNoColor(trimmed);
if (linePos != strLenNoColor(line)) {
char after = line.charAt(linePos);
- int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int trimmedWidth = getStringWidth0(trimmed);
int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
if (trimmedWidth + charWidth / 2 < xComp - padding) {
linePos++;
@@ -304,7 +308,7 @@ public class GuiElementTextField extends GuiElement {
} else if (split.length > 1) {
thisLineBeforeCursor = split[split.length - 1];
lineBefore = split[split.length - 2];
- textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor);
+ textBeforeCursorWidth = getStringWidth0(thisLineBeforeCursor);
} else {
return;
}
@@ -313,7 +317,7 @@ public class GuiElementTextField extends GuiElement {
int linePos = strLenNoColor(trimmed);
if (linePos != strLenNoColor(lineBefore)) {
char after = lineBefore.charAt(linePos);
- int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int trimmedWidth = getStringWidth0(trimmed);
int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
if (trimmedWidth + charWidth / 2 < textBeforeCursorWidth) {
linePos++;
@@ -342,7 +346,7 @@ public class GuiElementTextField extends GuiElement {
textBeforeCursorWidth = 0;
} else if (split.length > 0) {
thisLineBeforeCursor = split[split.length - 1];
- textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor);
+ textBeforeCursorWidth = getStringWidth0(thisLineBeforeCursor);
} else {
return;
}
@@ -355,7 +359,7 @@ public class GuiElementTextField extends GuiElement {
int linePos = strLenNoColor(trimmed);
if (linePos != strLenNoColor(lineAfter)) {
char after = lineAfter.charAt(linePos);
- int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int trimmedWidth = getStringWidth0(trimmed);
int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
if (trimmedWidth + charWidth / 2 < textBeforeCursorWidth) {
linePos++;
@@ -468,15 +472,14 @@ public class GuiElementTextField extends GuiElement {
for (int yOffI = 0; yOffI < texts.length; yOffI++) {
int yOff = yOffI * extraSize;
- if (isScaling() && Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) > searchBarXSize - 10) {
- scale = (searchBarXSize - 2) / (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]);
+ if (isScaling() && getStringWidth0(texts[yOffI]) > searchBarXSize - 10) {
+ scale = (searchBarXSize - 2) / (float) getStringWidth0(texts[yOffI]);
if (scale > 1) scale = 1;
- float newLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) * scale;
+ float newLen = getStringWidth0(texts[yOffI]) * scale;
xStartOffset = (int) ((searchBarXSize - newLen) / 2f);
Utils.drawStringCenteredScaledMaxWidth(
texts[yOffI],
- Minecraft.getMinecraft().fontRendererObj,
x + searchBarXSize / 2f,
y + searchBarYSize / 2f + yOff,
false,
@@ -506,7 +509,7 @@ public class GuiElementTextField extends GuiElement {
if (split.length <= numLinesBeforeCursor || split.length == 0) {
textBeforeCursorWidth = 0;
} else {
- textBeforeCursorWidth = (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length -
+ textBeforeCursorWidth = (int) (getStringWidth0(split[split.length -
1]) * scale);
}
drawRect(x + xStartOffset + textBeforeCursorWidth,
@@ -557,7 +560,7 @@ public class GuiElementTextField extends GuiElement {
continue;
}
- int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(String.valueOf(c));
+ int len = getStringWidth0(String.valueOf(c));
if (bold) len++;
if (i >= leftIndex && i < rightIndex) {
drawRect(x + xStartOffset + (int) texX,
@@ -566,12 +569,12 @@ public class GuiElementTextField extends GuiElement {
y + (searchBarYSize - 8) / 2 + 9 + texY, Color.LIGHT_GRAY.getRGB()
);
- Utils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringScaled(String.valueOf(c),
x + xStartOffset + texX,
y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale
);
if (bold) {
- Utils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringScaled(String.valueOf(c),
x + xStartOffset + texX + 1,
y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
index e08e5369..041843ae 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
@@ -370,9 +370,7 @@ public class NEUItemEditor extends GuiScreen {
text.add(displayName.get());
text.addAll(Arrays.asList(lore.get().split("\n")));
- Utils.drawHoveringText(text, itemX - 20, itemY + itemSize + 28, width, height, -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(text, itemX - 20, itemY + itemSize + 28, width, height, -1);
GlStateManager.disableLighting();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index f15a26a7..5e39aa45 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -26,16 +26,15 @@ import io.github.moulberry.notenoughupdates.NEUApi;
import io.github.moulberry.notenoughupdates.NEUOverlay;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
-import io.github.moulberry.notenoughupdates.commands.profile.ViewProfileCommand;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionBINWarning;
-import io.github.moulberry.notenoughupdates.miscfeatures.AuctionProfit;
import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver;
-import io.github.moulberry.notenoughupdates.miscfeatures.DungeonNpcProfitOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
+import io.github.moulberry.notenoughupdates.miscfeatures.PresetWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
import io.github.moulberry.notenoughupdates.miscfeatures.dev.RepoExporters;
import io.github.moulberry.notenoughupdates.miscgui.AccessoryBagOverlay;
@@ -45,20 +44,18 @@ import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay;
import io.github.moulberry.notenoughupdates.miscgui.TradeWindow;
-import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay;
import io.github.moulberry.notenoughupdates.miscgui.hex.GuiCustomHex;
-import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay;
import io.github.moulberry.notenoughupdates.overlays.BazaarSearchOverlay;
-import io.github.moulberry.notenoughupdates.overlays.EquipmentOverlay;
import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay;
import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
+import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -105,6 +102,7 @@ import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import java.util.function.BiConsumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -484,96 +482,68 @@ public class RenderListener {
if (CalendarOverlay.isEnabled() || event.isCanceled()) return;
if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && NotificationHandler.shouldRenderOverlay(event.gui) &&
event.gui instanceof GuiContainer) {
- doInventoryButtons = true;
-
- int zOffset = 50;
-
- GlStateManager.translate(0, 0, zOffset);
-
- int xSize = ((AccessorGuiContainer) event.gui).getXSize();
- int ySize = ((AccessorGuiContainer) event.gui).getYSize();
- int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft();
- int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop();
+ renderButtons((GuiContainer) event.gui);
+ }
+ }
- if (!NEUApi.disableInventoryButtons) {
- if (!EnchantingSolvers.disableButtons()) {
- for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
- if (!button.isActive()) continue;
- if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
+ public void iterateButtons(GuiContainer gui, BiConsumer<NEUConfig.InventoryButton, Rectangle> acceptButton) {
+ if (NEUApi.disableInventoryButtons || EnchantingSolvers.disableButtons()) {
+ return;
+ }
- int x = guiLeft + button.x;
- int y = guiTop + button.y;
- if (button.anchorRight) {
- x += xSize;
- }
- if (button.anchorBottom) {
- y += ySize;
- }
- if (AccessoryBagOverlay.isInAccessoryBag()) {
- if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
- x += 80 + 28;
- }
- }
- if (TrophyRewardOverlay.inTrophyFishingInventory()) {
- int diffX = 162;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
- x += diffX;
- }
- }
- if (MinionHelperManager.getInstance().inCraftedMinionsInventory()) {
- int diffX = 172;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 128) {
- x += diffX;
- }
- }
- if (AuctionProfit.inAuctionPage()) {
- if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
- y < guiTop + 56) {
- x -= 68 - 200;
- }
- }
- if (EquipmentOverlay.isRenderingArmorHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
- x -= 25;
- }
- }
- if (EquipmentOverlay.isRenderingPetHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
- x -= 25;
- }
- }
- if (inDungeonPage || DungeonNpcProfitOverlay.isRendering()) {
- if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
- y < guiTop + 100) {
- x += 185;
- }
- }
+ AccessorGuiContainer accessor = (AccessorGuiContainer) gui;
+ Rectangle guiRectangle = new Rectangle(
+ accessor.getGuiLeft(),
+ accessor.getGuiTop(),
+ accessor.getXSize(),
+ accessor.getYSize()
+ );
+
+ ButtonExclusionZoneEvent buttonExclusionZoneEvent = new ButtonExclusionZoneEvent(gui, guiRectangle);
+ buttonExclusionZoneEvent.post();
+ for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
+ if (!button.isActive()) continue;
+ if (button.playerInvOnly && !(gui instanceof GuiInventory)) continue;
+
+ Rectangle buttonPosition = buttonExclusionZoneEvent.findButtonPosition(new Rectangle(
+ accessor.getGuiLeft() + button.x + (button.anchorRight ? accessor.getXSize() : 0),
+ accessor.getGuiTop() + button.y + (button.anchorBottom ? accessor.getYSize() : 0),
+ 18, 18
+ )
+ );
+ acceptButton.accept(button, buttonPosition);
+ }
+ }
- GlStateManager.color(1, 1, 1, 1f);
-
- GlStateManager.enableDepth();
- GlStateManager.enableAlpha();
- Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR);
- Utils.drawTexturedRect(
- x,
- y,
- 18,
- 18,
- button.backgroundIndex * 18 / 256f,
- (button.backgroundIndex * 18 + 18) / 256f,
- 18 / 256f,
- 36 / 256f,
- GL11.GL_NEAREST
- );
+ public void renderButtons(GuiContainer gui) {
+ doInventoryButtons = true;
- if (button.icon != null && !button.icon.trim().isEmpty()) {
- GuiInvButtonEditor.renderIcon(button.icon, x + 1, y + 1);
- }
- }
- }
+ int zOffset = 50;
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(0, 0, zOffset);
+ iterateButtons(gui, (button, buttonPosition) -> {
+ GlStateManager.color(1, 1, 1, 1f);
+ GlStateManager.enableDepth();
+ GlStateManager.enableAlpha();
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR);
+ Utils.drawTexturedRect(
+ buttonPosition.getX(),
+ buttonPosition.getY(),
+ 18,
+ 18,
+ button.backgroundIndex * 18 / 256f,
+ (button.backgroundIndex * 18 + 18) / 256f,
+ 18 / 256f,
+ 36 / 256f,
+ GL11.GL_NEAREST
+ );
+
+ if (button.icon != null && !button.icon.trim().isEmpty()) {
+ GuiInvButtonEditor.renderIcon(button.icon, buttonPosition.getX() + 1, buttonPosition.getY() + 1);
}
- GlStateManager.translate(0, 0, -zOffset);
- }
+ });
+ GlStateManager.popMatrix();
}
/**
@@ -620,105 +590,50 @@ public class RenderListener {
}
}
- boolean hoveringButton = false;
+ final boolean[] hoveringButton = {false};
if (!doInventoryButtons) return;
if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && NotificationHandler.shouldRenderOverlay(event.gui) &&
event.gui instanceof GuiContainer) {
- int xSize = ((AccessorGuiContainer) event.gui).getXSize();
- int ySize = ((AccessorGuiContainer) event.gui).getYSize();
- int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft();
- int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop();
-
- if (!NEUApi.disableInventoryButtons) {
- if (!EnchantingSolvers.disableButtons()) {
- for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
- if (!button.isActive()) continue;
- if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
-
- int x = guiLeft + button.x;
- int y = guiTop + button.y;
- if (button.anchorRight) {
- x += xSize;
- }
- if (button.anchorBottom) {
- y += ySize;
- }
- if (AccessoryBagOverlay.isInAccessoryBag()) {
- if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
- x += 80 + 28;
- }
- }
- if (TrophyRewardOverlay.inTrophyFishingInventory()) {
- int diffX = 162;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
- x += diffX;
- }
- }
- if (MinionHelperManager.getInstance().inCraftedMinionsInventory()) {
- int diffX = 172;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 128) {
- x += diffX;
- }
- }
- if (AuctionProfit.inAuctionPage()) {
- if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
- y < guiTop + 56) {
- x -= 68 - 200;
- }
- }
- if (EquipmentOverlay.isRenderingArmorHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
- x -= 25;
- }
- }
- if (EquipmentOverlay.isRenderingPetHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
- x -= 25;
- }
- }
+ AccessorGuiContainer acc = (AccessorGuiContainer) event.gui;
+ Rectangle mousePosition = new Rectangle(event.mouseX, event.mouseY, 0, 0);
+ Rectangle craftingTextRectangle = new Rectangle(acc.getGuiLeft() + 85, acc.getGuiTop() + 4, 30, 21);
+ iterateButtons((GuiContainer) guiScreen, (button, buttonPosition) -> {
- if (inDungeonPage || DungeonNpcProfitOverlay.isRendering()) {
- if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
- y < guiTop + 100) {
- x += 185;
- }
- }
+ if (buttonPosition.intersects(craftingTextRectangle)) {
+ disableCraftingText = true;
+ }
- if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) {
- disableCraftingText = true;
- }
+ if (!buttonPosition.intersects(mousePosition)) {
+ return;
+ }
+ hoveringButton[0] = true;
+ long currentTime = System.currentTimeMillis();
- if (event.mouseX >= x && event.mouseX <= x + 18 && event.mouseY >= y && event.mouseY <= y + 18) {
- hoveringButton = true;
- long currentTime = System.currentTimeMillis();
+ if (buttonHovered != button) {
+ buttonHoveredMillis = currentTime;
+ buttonHovered = button;
+ }
- if (buttonHovered != button) {
- buttonHoveredMillis = currentTime;
- buttonHovered = button;
- }
+ if (currentTime - buttonHoveredMillis <= NotEnoughUpdates.INSTANCE.config.inventoryButtons.tooltipDelay) {
+ return;
+ }
+ String command = button.command.trim();
+ if (!command.startsWith("/")) {
+ command = "/" + command;
+ }
- if (currentTime - buttonHoveredMillis > NotEnoughUpdates.INSTANCE.config.inventoryButtons.tooltipDelay) {
- String command = button.command.trim();
- if (!command.startsWith("/")) {
- command = "/" + command;
- }
+ Utils.drawHoveringText(
+ Lists.newArrayList("\u00a77" + command),
+ event.mouseX,
+ event.mouseY,
+ event.gui.width,
+ event.gui.height,
+ -1
+ );
- Utils.drawHoveringText(
- Lists.newArrayList("\u00a77" + command),
- event.mouseX,
- event.mouseY,
- event.gui.width,
- event.gui.height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
- }
- }
- }
- }
- }
+ });
}
- if (!hoveringButton) buttonHovered = null;
+ if (!hoveringButton[0]) buttonHovered = null;
if (AuctionBINWarning.getInstance().shouldShow()) {
AuctionBINWarning.getInstance().render();
@@ -727,6 +642,10 @@ public class RenderListener {
if (AbiphoneWarning.getInstance().shouldShow()) {
AbiphoneWarning.getInstance().render();
}
+
+ if (PresetWarning.getInstance().shouldShow()) {
+ PresetWarning.getInstance().render();
+ }
}
private void renderDungKuudraChestOverlay(GuiScreen gui) {
@@ -966,7 +885,6 @@ public class RenderListener {
&& NotEnoughUpdates.INSTANCE.config.dungeons.shouldWarningDerpy) {
Utils.drawStringScaled(
EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "Mayor Derpy active!",
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + xSize + 4 + 10,
guiTop + 85,
true,
@@ -1012,6 +930,11 @@ public class RenderListener {
event.setCanceled(true);
return;
}
+ if (PresetWarning.getInstance().shouldShow()) {
+ PresetWarning.getInstance().mouseInput(mouseX, mouseY);
+ event.setCanceled(true);
+ return;
+ }
if (!event.isCanceled()) {
Utils.scrollTooltip(Mouse.getEventDWheel());
@@ -1052,7 +975,14 @@ public class RenderListener {
if (tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")) {
String username = tag.getCompoundTag("SkullOwner").getString("Name");
Utils.playPressSound();
- ViewProfileCommand.RUNNABLE.accept(new String[]{username});
+ NotEnoughUpdates.profileViewer.getProfileByName(username, profile -> {
+ if (profile == null) {
+ Utils.addChatMessage("${RED}Invalid player name/API key. Maybe the API is down? Try /api new.");
+ } else {
+ profile.resetCache();
+ NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile);
+ }
+ });
}
}
}
@@ -1107,85 +1037,28 @@ public class RenderListener {
if (!doInventoryButtons) return;
if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && NotificationHandler.shouldRenderOverlay(event.gui) &&
Mouse.getEventButton() >= 0 && event.gui instanceof GuiContainer) {
- int xSize = ((AccessorGuiContainer) event.gui).getXSize();
- int ySize = ((AccessorGuiContainer) event.gui).getYSize();
- int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft();
- int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop();
- if (!NEUApi.disableInventoryButtons) {
- if (!EnchantingSolvers.disableButtons()) {
- for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
- if (!button.isActive()) continue;
- if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
-
- int x = guiLeft + button.x;
- int y = guiTop + button.y;
- if (button.anchorRight) {
- x += xSize;
- }
- if (button.anchorBottom) {
- y += ySize;
- }
- if (AccessoryBagOverlay.isInAccessoryBag()) {
- if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
- x += 80 + 28;
- }
- }
- if (TrophyRewardOverlay.inTrophyFishingInventory()) {
- int diffX = 162;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
- x += diffX;
- }
- }
- if (MinionHelperManager.getInstance().inCraftedMinionsInventory()) {
- int diffX = 172;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 128) {
- x += diffX;
- }
- }
- if (AuctionProfit.inAuctionPage()) {
- if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
- y < guiTop + 56) {
- x -= 68 - 200;
- }
- }
- if (EquipmentOverlay.isRenderingArmorHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
- x -= 25;
- }
- }
- if (EquipmentOverlay.isRenderingPetHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
- x -= 25;
- }
- }
- if (inDungeonPage || DungeonNpcProfitOverlay.isRendering()) {
- if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
- y < guiTop + 100) {
- x += 185;
- }
+ Rectangle mouseRect = new Rectangle(mouseX, mouseY, 0, 0);
+ iterateButtons((GuiContainer) event.gui, (button, buttonPositon) -> {
+ if (!buttonPositon.intersects(mouseRect)) {
+ return;
+ }
+ if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) {
+ int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType;
+ if ((clickType == 0 && Mouse.getEventButtonState()) ||
+ (clickType == 1 && !Mouse.getEventButtonState())) {
+ String command = button.command.trim();
+ if (!command.startsWith("/")) {
+ command = "/" + command;
}
-
- if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) {
- if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) {
- int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType;
- if ((clickType == 0 && Mouse.getEventButtonState()) ||
- (clickType == 1 && !Mouse.getEventButtonState())) {
- String command = button.command.trim();
- if (!command.startsWith("/")) {
- command = "/" + command;
- }
- if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) {
- NotEnoughUpdates.INSTANCE.sendChatMessage(command);
- }
- }
- } else {
- event.setCanceled(true);
- }
- return;
+ if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) {
+ NotEnoughUpdates.INSTANCE.sendChatMessage(command);
}
}
+ } else {
+ event.setCanceled(true);
}
- }
+
+ });
}
}
@@ -1246,6 +1119,11 @@ public class RenderListener {
event.setCanceled(true);
return;
}
+ if (PresetWarning.getInstance().shouldShow()) {
+ PresetWarning.getInstance().keyboardInput();
+ event.setCanceled(true);
+ return;
+ }
if (AuctionSearchOverlay.shouldReplace()) {
AuctionSearchOverlay.keyEvent();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java
index 3366fd1e..750e674d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java
@@ -24,6 +24,7 @@ import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.events.GuiContainerBackgroundDrawnEvent;
import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
@@ -202,10 +203,11 @@ public class AbiphoneFavourites {
return isAbiphoneShowOnlyFavourites() && !getFavouriteContacts().contains(name);
}
- public void onDrawBackground(GuiScreen screen) {
+ @SubscribeEvent
+ public void onDrawBackground(GuiContainerBackgroundDrawnEvent event) {
if (isWrongInventory()) return;
- GuiContainer container = (GuiContainer) screen;
+ GuiContainer container = event.getContainer();
for (Slot slot : container.inventorySlots.inventorySlots) {
if (slot == null) continue;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
index 2c28bcd1..69b0a1b6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
@@ -120,29 +120,24 @@ public class AbiphoneWarning extends GuiElement {
int neuLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth("\u00a7lNEU");
Minecraft.getMinecraft().fontRendererObj.drawString(
"\u00a7lNEU",
- width / 2 + 90 - neuLength - 3,
- height / 2 - 45 + 4,
- 0xff000000
+ width / 2 + 90 - neuLength - 3, height / 2 - 45 + 4, 0xff000000
);
- TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj,
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ "Are you SURE?",
width / 2, height / 2 - 45 + 10, false, 170, 0xffff4040
);
String sellLine = "\u00a77[ \u00a7r" + contactName + "\u00a77 ]";
- TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj,
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ sellLine,
width / 2, height / 2 - 45 + 25, false, 170, 0xffffffff
);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
"Continue removing this contact?",
- Minecraft.getMinecraft().fontRendererObj,
- width / 2,
- height / 2 - 45 + 50,
- false,
- 170,
- 0xffa0a0a0
+ width / 2, height / 2 - 45 + 50, false, 170, 0xffa0a0a0
);
RenderUtils.drawFloatingRectDark(width / 2 - 43, height / 2 + 23, 40, 16, false);
@@ -150,21 +145,11 @@ public class AbiphoneWarning extends GuiElement {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
EnumChatFormatting.GREEN + "[Y]es",
- Minecraft.getMinecraft().fontRendererObj,
- width / 2 - 23,
- height / 2 + 31,
- true,
- 36,
- 0xff00ff00
+ width / 2 - 23, height / 2 + 31, true, 36, 0xff00ff00
);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
EnumChatFormatting.RED + "[N]o",
- Minecraft.getMinecraft().fontRendererObj,
- width / 2 + 23,
- height / 2 + 31,
- true,
- 36,
- 0xffff0000
+ width / 2 + 23, height / 2 + 31, true, 36, 0xffff0000
);
GlStateManager.popMatrix();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
index 7282aad7..2b292aec 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
@@ -183,7 +183,7 @@ public class AuctionBINWarning extends GuiElement {
0xff000000
);
- TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj,
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?",
width / 2, height / 2 - 45 + 10, false, 170, 0xffff4040
);
@@ -203,19 +203,14 @@ public class AuctionBINWarning extends GuiElement {
String sellLine = "\u00a77[ \u00a7r" + sellingName + "\u00a77 ]";
- TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj,
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine,
width / 2, height / 2 - 45 + 25, false, 170, 0xffffffff
);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
(lowestPrice > 0
? "has a lowest BIN of \u00a76" + lowestPriceStr + "\u00a7r coins"
: "\u00a7cWarning: No lowest BIN found!"),
- Minecraft.getMinecraft().fontRendererObj,
- width / 2,
- height / 2 - 45 + 34,
- false,
- 170,
- 0xffa0a0a0
+ width / 2, height / 2 - 45 + 34, false, 170, 0xffa0a0a0
);
if (sellingPrice > lowestPrice * sellStackAmount) {
@@ -229,22 +224,12 @@ public class AuctionBINWarning extends GuiElement {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
"Continue selling it for",
- Minecraft.getMinecraft().fontRendererObj,
- width / 2,
- height / 2 - 45 + 50,
- false,
- 170,
- 0xffa0a0a0
+ width / 2, height / 2 - 45 + 50, false, 170, 0xffa0a0a0
);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
"\u00a76" + sellingPriceStr + "\u00a7r coins?" +
(lowestPrice > 0 ? "(\u00a7" + (isALoss ? "c-" : "a+") + (buyPercentage >= 100 ? buyPercentage - 100 : buyPercentage) + "%\u00a7r)" : ""),
- Minecraft.getMinecraft().fontRendererObj,
- width / 2,
- height / 2 - 45 + 59,
- false,
- 170,
- 0xffa0a0a0
+ width / 2, height / 2 - 45 + 59, false, 170, 0xffa0a0a0
);
RenderUtils.drawFloatingRectDark(width / 2 - 43, height / 2 + 23, 40, 16, false);
@@ -252,21 +237,11 @@ public class AuctionBINWarning extends GuiElement {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
EnumChatFormatting.GREEN + "[Y]es",
- Minecraft.getMinecraft().fontRendererObj,
- width / 2 - 23,
- height / 2 + 31,
- true,
- 36,
- 0xff00ff00
+ width / 2 - 23, height / 2 + 31, true, 36, 0xff00ff00
);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
EnumChatFormatting.RED + "[N]o",
- Minecraft.getMinecraft().fontRendererObj,
- width / 2 + 23,
- height / 2 + 31,
- true,
- 36,
- 0xffff0000
+ width / 2 + 23, height / 2 + 31, true, 36, 0xffff0000
);
if (sellingTooltip != null) {
@@ -277,15 +252,7 @@ public class AuctionBINWarning extends GuiElement {
if (mouseX >= width / 2 - sellLineLength / 2 && mouseX <= width / 2 + sellLineLength / 2 &&
mouseY >= height / 2 - 45 + 20 && mouseY <= height / 2 - 45 + 30) {
- Utils.drawHoveringText(
- sellingTooltip,
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(sellingTooltip, mouseX, mouseY, width, height, -1);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
index c0e40ec9..c761f847 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
@@ -22,7 +22,9 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
+import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -47,6 +49,20 @@ public class AuctionProfit {
new ResourceLocation("notenoughupdates:auction_profit.png");
@SubscribeEvent
+ public void onButtonExclusionZones(ButtonExclusionZoneEvent event) {
+ if (inAuctionPage()) {
+ event.blockArea(
+ new Rectangle(
+ event.getGuiBaseRect().getRight(),
+ event.getGuiBaseRect().getTop(),
+ 128 /*width*/ + 4 /*space*/, 56
+ ),
+ ButtonExclusionZoneEvent.PushDirection.TOWARDS_RIGHT
+ );
+ }
+ }
+
+ @SubscribeEvent
public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!inAuctionPage()) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java
index ed05ee79..e840acdf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java
@@ -82,9 +82,7 @@ public class AuctionSortModeWarning {
RenderUtils.drawFloatingRectDark(centerX - warningLength / 2 - 4, centerY - 6,
warningLength + 8, 12, false
);
- TextRenderUtils.drawStringCenteredScaledMaxWidth(warningText, Minecraft.getMinecraft().fontRendererObj,
- centerX, centerY, true, chest.width / 2, 0xffffffff
- );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(warningText, centerX, centerY, true, chest.width / 2, 0xffffffff);
GlStateManager.popMatrix();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
index 80751371..f130a993 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
@@ -31,9 +31,13 @@ public class CookieWarning {
private static boolean hasNotified;
private static boolean hasErrorMessage;
+ private static long cookieEndTime = 0;
+ private static boolean hasCookie = true;
+ private static long lastChecked = 0;
public static void resetNotification() {
hasNotified = false;
+ hasCookie = true;
NotificationHandler.cancelNotification();
}
@@ -41,96 +45,135 @@ public class CookieWarning {
* Checks the tab list for a cookie timer, and sends a notification if the timer is within the tolerance
*/
public static void checkCookie() {
- if (NotEnoughUpdates.INSTANCE.config.notifications.doBoosterNotif &&
- NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
- String[] lines;
- try {
- lines = ((AccessorGuiPlayerTabOverlay) Minecraft.getMinecraft().ingameGUI.getTabList())
- .getFooter()
- .getUnformattedText()
- .split("\n");
- } catch (NullPointerException e) {
- return; // if the footer is null or somehow doesn't exist, stop
+ if (!NotEnoughUpdates.INSTANCE.config.notifications.doBoosterNotif ||
+ !NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ return;
+ }
+ String timeLine = getTimeLine();
+ if (!hasCookie) {
+ if (!hasNotified) {
+ NotificationHandler.displayNotification(Lists.newArrayList(
+ "§cBooster Cookie Ran Out!",
+ "§7Your Booster Cookie expired!",
+ "§7",
+ "§7Press X on your keyboard to close this notification"
+ ), true, true);
+ hasNotified = true;
}
- boolean hasCookie = true;
- String timeLine = null; // the line that contains the cookie timer
- for (int i = 0; i < lines.length; i++) {
- if (lines[i].startsWith("Cookie Buff")) {
- timeLine = lines[i + 1]; // the line after the "Cookie Buff" line
- }
- if (lines[i].startsWith("Not active! Obtain booster cookies from the")) {
- hasCookie = false;
- }
+ return;
+ }
+ if (timeLine == null) return;
+
+ int minutes = getMinutesRemaining(timeLine);
+ if (minutes < NotEnoughUpdates.INSTANCE.config.notifications.boosterCookieWarningMins && !hasNotified) {
+ NotificationHandler.displayNotification(Lists.newArrayList(
+ "§cBooster Cookie Running Low!",
+ "§7Your Booster Cookie will expire in " + timeLine,
+ "§7",
+ "§7Press X on your keyboard to close this notification"
+ ), true, true);
+ hasNotified = true;
+ }
+ }
+
+ private static int getMinutesRemaining(String timeLine) {
+ String clean = timeLine.replaceAll("(§.)", "");
+ clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
+ String[] digits = clean.split(" ");
+ int minutes = 0;
+ try {
+ for (int i = 0; i < digits.length; i++) {
+ if (i % 2 == 1) continue;
+
+ String number = digits[i];
+ String unit = digits[i + 1];
+ long val = Integer.parseInt(number);
+ switch (unit) {
+ case "Years":
+ case "Year":
+ minutes += val * 525600;
+ break;
+ case "Months":
+ case "Month":
+ minutes += val * 43200;
+ break;
+ case "Days":
+ case "Day":
+ minutes += val * 1440;
+ break;
+ case "Hours":
+ case "Hour":
+ case "h":
+ minutes += val * 60;
+ break;
+ case "Minutes":
+ case "Minute":
+ case "m":
+ minutes += val;
+ break;
+ } // ignore seconds
}
- if (!hasCookie) {
- if (!hasNotified) {
- NotificationHandler.displayNotification(Lists.newArrayList(
- "\u00a7cBooster Cookie Ran Out!",
- "\u00a77Your Booster Cookie expired!",
- "\u00a77",
- "\u00a77Press X on your keyboard to close this notification"
- ), true, true);
- hasNotified = true;
- }
- return;
+ } catch (NumberFormatException e) {
+ if (!hasErrorMessage) {
+ e.printStackTrace();
+ Utils.addChatMessage(EnumChatFormatting.RED +
+ "NEU ran into an issue when retrieving the Booster Cookie Timer. Check the logs for details.");
+ hasErrorMessage = true;
}
- if (timeLine != null) {
- String clean = timeLine.replaceAll("(\u00a7.)", "");
- clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
- String[] digits = clean.split(" ");
- int minutes = 0;
- try {
- for (int i = 0; i < digits.length; i++) {
- if (i % 2 == 1) continue;
+ hasNotified = true;
+ }
+ return minutes;
+ }
- String number = digits[i];
- String unit = digits[i + 1];
- long val = Integer.parseInt(number);
- switch (unit) {
- case "Years":
- case "Year":
- minutes += val * 525600;
- break;
- case "Months":
- case "Month":
- minutes += val * 43200;
- break;
- case "Days":
- case "Day":
- minutes += val * 1440;
- break;
- case "Hours":
- case "Hour":
- case "h":
- minutes += val * 60;
- break;
- case "Minutes":
- case "Minute":
- case "m":
- minutes += val;
- break;
- } // ignore seconds
- }
- } catch (NumberFormatException e) {
- if (!hasErrorMessage) {
- e.printStackTrace();
- Utils.addChatMessage(EnumChatFormatting.RED +
- "NEU ran into an issue when retrieving the Booster Cookie Timer. Check the logs for details.");
- hasErrorMessage = true;
- }
- hasNotified = true;
- }
- if (minutes < NotEnoughUpdates.INSTANCE.config.notifications.boosterCookieWarningMins && !hasNotified) {
- NotificationHandler.displayNotification(Lists.newArrayList(
- "\u00a7cBooster Cookie Running Low!",
- "\u00a77Your Booster Cookie will expire in " + timeLine,
- "\u00a77",
- "\u00a77Press X on your keyboard to close this notification"
- ), true, true);
- hasNotified = true;
- }
+ private static String getTimeLine() {
+ String[] lines;
+ try {
+ lines = ((AccessorGuiPlayerTabOverlay) Minecraft.getMinecraft().ingameGUI.getTabList())
+ .getFooter()
+ .getUnformattedText()
+ .split("\n");
+ } catch (NullPointerException ignored) {
+ return null;
+ }
+ String timeLine = null; // the line that contains the cookie timer
+ for (int i = 0; i < lines.length; i++) {
+ if (lines[i].startsWith("Cookie Buff")) {
+ timeLine = lines[i + 1]; // the line after the "Cookie Buff" line
+ }
+ if (lines[i].startsWith("Not active! Obtain booster cookies from the")) {
+ hasCookie = false;
}
}
+ return timeLine;
+ }
+
+ public static boolean hasActiveBoosterCookie() {
+ long cookieEndTime = getCookieEndTime();
+ return cookieEndTime > System.currentTimeMillis();
+ }
+
+ private static long getCookieEndTime() {
+ // Only updating every 10 seconds
+// if (System.currentTimeMillis() > lastChecked + 10_000) return cookieEndTime;
+ if (lastChecked + 3_000 > System.currentTimeMillis()) return cookieEndTime;
+
+ String timeLine = getTimeLine();
+ if (hasCookie && timeLine != null) {
+ int minutes = getMinutesRemaining(timeLine);
+ cookieEndTime = System.currentTimeMillis() + (long) minutes * 60 * 1000;
+ } else {
+ cookieEndTime = 0;
+ }
+
+ lastChecked = System.currentTimeMillis();
+ return cookieEndTime;
+ }
+ public static void onProfileSwitch() {
+ resetNotification();
+ hasErrorMessage = false;
+ cookieEndTime = 0;
+ hasCookie = true;
+ lastChecked = 0;
}
}
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 e959c761..c8c7a3da 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
@@ -44,6 +44,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
@@ -67,6 +68,7 @@ import org.lwjgl.util.vector.Vector3f;
import java.awt.*;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -333,8 +335,7 @@ public class CustomItemEffects {
}
}
- boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals(
- "dynamic");
+ boolean onPrivateIsland = Arrays.asList("dynamic","garden").contains(SBInfo.getInstance().getLocation());
if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay &&
Minecraft.getMinecraft().objectMouseOver != null &&
@@ -346,103 +347,210 @@ public class CustomItemEffects {
Minecraft.getMinecraft().objectMouseOver.sideHit, 1));
if (hover.getBlock() == Blocks.air) {
- if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) {
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ if (heldInternal != null && (heldInternal.equals("BUILDERS_WAND"))) buildersWandText(event, world);
+ else if (heldInternal != null && (heldInternal.equals("BUILDERS_RULER"))) buildersRulerText(event, world);
- HashSet<BlockPos> candidatesOld = new HashSet<>();
- TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>();
-
- IBlockState match =
- world.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos());
- Item matchItem = Item.getItemFromBlock(match.getBlock());
- if (matchItem != null) {
- ItemStack matchStack = new ItemStack(matchItem, 1,
- match
- .getBlock()
- .getDamageValue(
- world,
- Minecraft.getMinecraft().objectMouseOver.getBlockPos()
- )
- );
-
- getBuildersWandCandidates(
- Minecraft.getMinecraft().thePlayer,
- Minecraft.getMinecraft().objectMouseOver,
- event.partialTicks,
- candidatesOld,
- candidatesOldSorted,
- 999 - MAX_BUILDERS_BLOCKS
- );
-
- boolean usingDirtWand = false;
- int itemCount;
- if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
- itemCount = candidatesOld.size();
- usingDirtWand = true;
- } else {
- itemCount = countItemsInInventoryAndStorage(matchStack);
- }
+ }
+ }
+ }
+ }
- if (candidatesOld.size() > MAX_BUILDERS_BLOCKS) {
- Utils.drawStringCentered(
- EnumChatFormatting.RED.toString() + candidatesOld.size() + "/" + MAX_BUILDERS_BLOCKS,
- Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2f,
- scaledResolution.getScaledHeight() / 2f + 10,
- true,
- 0
- );
- } else {
- String pre = EnumChatFormatting.GREEN.toString();
- if (itemCount < candidatesOld.size()) {
- pre = EnumChatFormatting.RED.toString();
- }
- Utils.drawStringCentered(pre + Math.min(candidatesOld.size(), itemCount) + "/" +
- Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS),
- Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0
- );
- }
+ public void buildersWandText(RenderGameOverlayEvent.Post event, WorldClient world) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+
+ HashSet<BlockPos> candidatesOld = new HashSet<>();
+ TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>();
+
+ IBlockState match =
+ world.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos());
+ Item matchItem = Item.getItemFromBlock(match.getBlock());
+ if (matchItem == null) return;
+ ItemStack matchStack;
+
+ matchStack = new ItemStack(matchItem, 1,
+ match
+ .getBlock()
+ .getDamageValue(
+ world,
+ Minecraft.getMinecraft().objectMouseOver.getBlockPos()
+ )
+ );
- String itemCountS = EnumChatFormatting.DARK_GRAY + "x" + EnumChatFormatting.RESET + itemCount;
- int itemCountLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(itemCountS);
+ getBuildersWandCandidates(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().objectMouseOver,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 999 - MAX_BUILDERS_BLOCKS
+ );
- if (NotEnoughUpdates.INSTANCE.config.itemOverlays.wandBlockCount) {
- if (usingDirtWand) {
- Utils.drawItemStack(
- new ItemStack(Items.gold_nugget),
- scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2,
- scaledResolution.getScaledHeight() / 2 + 10 + 4
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- itemCountS,
- scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 11,
- scaledResolution.getScaledHeight() / 2f + 10 + 8,
- -1,
- true
- );
- } else {
- Utils.drawItemStack(matchStack, scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2,
- scaledResolution.getScaledHeight() / 2 + 10 + 4
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- itemCountS,
- scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 16,
- scaledResolution.getScaledHeight() / 2f + 10 + 8,
- -1,
- true
- );
- }
+ boolean usingDirtWand = false;
+ int itemCount;
+ if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
+ itemCount = candidatesOld.size();
+ usingDirtWand = true;
+ } else {
+ itemCount = countItemsInInventoryAndStorage(matchStack);
+ }
+ if (candidatesOld.size() == 0) return;
+
+ if (candidatesOld.size() > MAX_BUILDERS_BLOCKS) {
+ Utils.drawStringCentered(
+ EnumChatFormatting.RED.toString() + candidatesOld.size() + "/" + MAX_BUILDERS_BLOCKS,
+ Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth() / 2f,
+ scaledResolution.getScaledHeight() / 2f + 10,
+ true,
+ 0
+ );
+ } else {
+ String pre = EnumChatFormatting.GREEN.toString();
+ if (itemCount < candidatesOld.size()) {
+ pre = EnumChatFormatting.RED.toString();
+ }
+ Utils.drawStringCentered(pre + Math.min(candidatesOld.size(), itemCount) + "/" +
+ Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS),
+ Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0
+ );
+ }
- }
+ String itemCountS = EnumChatFormatting.DARK_GRAY + "x" + EnumChatFormatting.RESET + itemCount;
+ int itemCountLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(itemCountS);
+
+ if (NotEnoughUpdates.INSTANCE.config.itemOverlays.wandBlockCount) {
+ if (usingDirtWand) {
+ Utils.drawItemStack(
+ new ItemStack(Items.gold_nugget),
+ scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2,
+ scaledResolution.getScaledHeight() / 2 + 10 + 4
+ );
+ Minecraft.getMinecraft().fontRendererObj.drawString(
+ itemCountS,
+ scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 11,
+ scaledResolution.getScaledHeight() / 2f + 10 + 8,
+ -1,
+ true
+ );
+ } else {
+ Utils.drawItemStack(matchStack, scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2,
+ scaledResolution.getScaledHeight() / 2 + 10 + 4
+ );
+ Minecraft.getMinecraft().fontRendererObj.drawString(
+ itemCountS,
+ scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 16,
+ scaledResolution.getScaledHeight() / 2f + 10 + 8,
+ -1,
+ true
+ );
+ }
- GlStateManager.color(1, 1, 1, 1);
- }
+ }
- }
- }
+ GlStateManager.color(1, 1, 1, 1);
+ }
+
+ public void buildersRulerText(RenderGameOverlayEvent.Post event, WorldClient world) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+
+ HashSet<BlockPos> candidatesOld = new HashSet<>();
+ TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>();
+
+ IBlockState match =
+ world.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos());
+ Item matchItem = Item.getItemFromBlock(match.getBlock());
+ if (matchItem == null) return;
+ ItemStack matchStack;
+
+ matchStack = new ItemStack(matchItem, 1,
+ match
+ .getBlock()
+ .getDamageValue(
+ world,
+ Minecraft.getMinecraft().objectMouseOver.getBlockPos()
+ )
+ );
+ if (!Minecraft.getMinecraft().thePlayer.isSneaking()) matchStack = getFirstItemInRuler();
+ match = Blocks.dirt.getDefaultState();
+ if (matchStack == null) return;
+
+ getBuildersRulerCandidates(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().objectMouseOver,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 499 - MAX_BUILDERS_BLOCKS
+ );
+
+ boolean usingDirtWand = false;
+ int itemCount;
+ if (Minecraft.getMinecraft().thePlayer.isSneaking()) {
+ itemCount = candidatesOld.size();
+ } else {
+ if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
+ itemCount = candidatesOld.size();
+ usingDirtWand = true;
+ } else {
+ itemCount = countItemsInInventoryAndStorage(matchStack);
+ }
+ }
+ if (candidatesOld.size() == 0) return;
+
+ if (!Minecraft.getMinecraft().thePlayer.isSneaking()) {
+ if (candidatesOld.size() > MAX_BUILDERS_BLOCKS) {
+ Utils.drawStringCentered(
+ EnumChatFormatting.RED.toString() + candidatesOld.size() + "/" + MAX_BUILDERS_BLOCKS,
+ Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth() / 2f,
+ scaledResolution.getScaledHeight() / 2f + 10,
+ true,
+ 0
+ );
+ } else {
+ String pre = EnumChatFormatting.GREEN.toString();
+ Utils.drawStringCentered(pre + Math.min(candidatesOld.size(), itemCount) + "/" +
+ Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS),
+ Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0
+ );
+ }
+ }
+
+ String itemCountS = EnumChatFormatting.DARK_GRAY + "x" + EnumChatFormatting.RESET + itemCount;
+ int itemCountLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(itemCountS);
+
+ if (NotEnoughUpdates.INSTANCE.config.itemOverlays.wandBlockCount) {
+ if (usingDirtWand) {
+ Utils.drawItemStack(
+ new ItemStack(Items.gold_nugget),
+ scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2,
+ scaledResolution.getScaledHeight() / 2 + 10 + 4
+ );
+ Minecraft.getMinecraft().fontRendererObj.drawString(
+ itemCountS,
+ scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 11,
+ scaledResolution.getScaledHeight() / 2f + 10 + 8,
+ -1,
+ true
+ );
+ } else {
+ Utils.drawItemStack(matchStack, scaledResolution.getScaledWidth() / 2 - (itemCountLen + 16) / 2,
+ scaledResolution.getScaledHeight() / 2 + 10 + 4
+ );
+ Minecraft.getMinecraft().fontRendererObj.drawString(
+ itemCountS,
+ scaledResolution.getScaledWidth() / 2f - (itemCountLen + 16) / 2f + 16,
+ scaledResolution.getScaledHeight() / 2f + 10 + 8,
+ -1,
+ true
+ );
}
+
}
+
+ GlStateManager.color(1, 1, 1, 1);
}
//ethermerge
@@ -496,7 +604,28 @@ public class CustomItemEffects {
return null;
}
+ public NBTTagCompound getBuildersNbt(boolean isWand) {
+ ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
+ if (held == null) return null;
+
+ if (held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) &&
+ held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data", 7)) {
+ byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data");
+ try {
+ return CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
public int countItemsInInventoryAndStorage(ItemStack match) {
+ if (match == null) return 0;
int count = 0;
for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
@@ -508,24 +637,19 @@ public class CustomItemEffects {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
- if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) {
- if (held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) &&
- held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("builder's_wand_data", 7)) {
- byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray("builder's_wand_data");
- try {
- NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
- NBTTagList items = contents_nbt.getTagList("i", 10);
- for (int j = 0; j < items.tagCount(); j++) {
- NBTTagCompound buildersItem = items.getCompoundTagAt(j);
- if (buildersItem.getKeySet().size() > 0) {
- if (buildersItem.getInteger("id") == Item.getIdFromItem(match.getItem()) &&
- buildersItem.getInteger("Damage") == match.getItemDamage()) {
- count += items.getCompoundTagAt(j).getByte("Count");
- }
- }
- }
- } catch (Exception e) {
- return count;
+ boolean isWand = heldInternal != null && heldInternal.equals("BUILDERS_WAND");
+ if (heldInternal == null || !heldInternal.equals(isWand ? "BUILDERS_WAND" : "BUILDERS_RULER")) return count;
+
+ NBTTagCompound contents_nbt = getBuildersNbt(isWand);
+ if (contents_nbt == null) return count;
+
+ NBTTagList items = contents_nbt.getTagList("i", 10);
+ for (int j = 0; j < items.tagCount(); j++) {
+ NBTTagCompound buildersItem = items.getCompoundTagAt(j);
+ if (buildersItem.getKeySet().size() > 0) {
+ if (buildersItem.getInteger("id") == Item.getIdFromItem(match.getItem()) &&
+ buildersItem.getInteger("Damage") == match.getItemDamage()) {
+ count += items.getCompoundTagAt(j).getByte("Count");
}
}
}
@@ -533,6 +657,36 @@ public class CustomItemEffects {
return count;
}
+ public ItemStack getFirstItemInRuler() {
+
+ ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
+ String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
+
+ if (heldInternal == null || !heldInternal.equals("BUILDERS_RULER")) return null;
+
+ NBTTagCompound contents_nbt = getBuildersNbt(false);
+ if (contents_nbt == null) return null;
+
+ NBTTagList items = contents_nbt.getTagList("i", 10);
+ for (int j = 0; j < items.tagCount(); j++) {
+ NBTTagCompound buildersItem = items.getCompoundTagAt(j);
+ if (buildersItem.getKeySet().size() > 0) {
+ ItemStack newStack = new ItemStack(
+ Item.getItemById(buildersItem.getInteger("id")),
+ 1,
+ buildersItem.getInteger("Damage")
+ );
+ return newStack;
+ }
+ }
+
+ //the ruler says it uses ur inv but it doesnt
+ /*for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
+ if (stack != null && stack.getItem() instanceof ItemBlock) return stack;
+ }*/
+ return null;
+ }
+
public boolean hasDirtWand() {
for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
@@ -543,11 +697,15 @@ public class CustomItemEffects {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
-
- if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) {
+ boolean isWand = heldInternal != null && heldInternal.equals("BUILDERS_WAND");
+ if (heldInternal != null && heldInternal.equals(isWand ? "BUILDERS_WAND" : "BUILDERS_RULER")) {
if (held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) &&
- held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("builder's_wand_data", 7)) {
- byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray("builder's_wand_data");
+ held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data", 7)) {
+ byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data");
try {
NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
NBTTagList items = contents_nbt.getTagList("i", 10);
@@ -597,6 +755,10 @@ public class CustomItemEffects {
add(Blocks.farmland);
}};
+
+ List<Block> scytheBlocks = Arrays.asList(
+ Blocks.leaves, Blocks.leaves2, Blocks.red_flower, Blocks.yellow_flower, Blocks.tallgrass, Blocks.double_plant);
+
@SubscribeEvent
public void renderBlockOverlay(DrawBlockHighlightEvent event) {
if (aoteTeleportationCurr != null && aoteTeleportationMillis > 0) {
@@ -611,8 +773,7 @@ public class CustomItemEffects {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
if (heldInternal != null) {
- boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals(
- "dynamic");
+ boolean onPrivateIsland = Arrays.asList("dynamic","garden").contains(SBInfo.getInstance().getLocation());
EntityPlayer player = event.player;
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) event.partialTicks;
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) event.partialTicks;
@@ -835,89 +996,10 @@ public class CustomItemEffects {
}
} else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay) {
if (heldInternal.equals("BUILDERS_WAND") && onPrivateIsland) {
- int maxBlocks = MAX_BUILDERS_BLOCKS;
- if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
- IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target
- .getBlockPos()
- .offset(event.target.sideHit, 1));
- if (hover.getBlock() == Blocks.air) {
- IBlockState match = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos());
- Item matchItem = Item.getItemFromBlock(match.getBlock());
- if (matchItem != null) {
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.disableTexture2D();
- GlStateManager.depthMask(false);
-
- HashSet<BlockPos> candidatesOld = new HashSet<>();
- TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>();
-
- getBuildersWandCandidates(
- player,
- event.target,
- event.partialTicks,
- candidatesOld,
- candidatesOldSorted,
- 10
- );
-
- ItemStack matchStack = new ItemStack(matchItem, 1,
- match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, event.target.getBlockPos())
- );
- int itemCount;
- if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
- itemCount = candidatesOld.size();
- } else {
- itemCount = countItemsInInventoryAndStorage(matchStack);
- }
-
- String special = (candidatesOld.size() <= itemCount)
- ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour
- :
- "0:255:255:0:0";
-
- if (candidatesOld.size() <= maxBlocks) {
- for (Set<BlockPos> candidatesSorted : candidatesOldSorted.values()) {
- for (BlockPos candidate : candidatesSorted) {
- match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate);
- AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(
- Minecraft.getMinecraft().theWorld,
- candidate
- )
- .offset(
- event.target.sideHit.getFrontOffsetX(),
- event.target.sideHit.getFrontOffsetY(),
- event.target.sideHit.getFrontOffsetZ()
- );
-
- drawBlock((int) bb.minX, (int) bb.minY, (int) bb.minZ + 1, match, event.partialTicks, 0.75f);
- }
- }
-
- for (BlockPos candidate : candidatesOld) {
- match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate);
- AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(
- Minecraft.getMinecraft().theWorld,
- candidate
- )
- .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2)
- .offset(
- event.target.sideHit.getFrontOffsetX(),
- event.target.sideHit.getFrontOffsetY(),
- event.target.sideHit.getFrontOffsetZ()
- );
-
- drawOutlineBoundingBox(bb, 1f, special);
- }
- }
-
- GlStateManager.depthMask(true);
- GlStateManager.enableTexture2D();
- GlStateManager.disableBlend();
- }
- }
- }
- } else if (heldInternal.equals("INFINIDIRT_WAND") &&
+ buildersWandOverlay(event, d0, d1, d2);
+ } else if (heldInternal.equals("BUILDERS_RULER") && onPrivateIsland) {
+ buildersRulerOverlay(event, d0, d1, d2);
+ }else if (heldInternal.equals("INFINIDIRT_WAND") &&
event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK &&
NotEnoughUpdates.INSTANCE.config.itemOverlays.enableDirtWandOverlay) {
BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1);
@@ -1054,8 +1136,10 @@ public class CustomItemEffects {
for (int xOff = -radius; xOff <= radius; xOff++) {
for (int zOff = -radius; zOff <= radius; zOff++) {
BlockPos renderPos = target.add(xOff, 0, zOff);
+ BlockPos airPos = renderPos.add(0, 1, 0);
IBlockState renderState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos);
- if (renderState.getBlock() == Blocks.dirt || renderState.getBlock() == Blocks.grass) {
+ IBlockState airState = Minecraft.getMinecraft().theWorld.getBlockState(airPos);
+ if (renderState.getBlock() == Blocks.dirt || renderState.getBlock() == Blocks.grass && airState.getBlock() == Blocks.air) {
AxisAlignedBB bbExpanded = Blocks.dirt.getSelectedBoundingBox(
Minecraft.getMinecraft().theWorld,
renderPos
@@ -1071,8 +1155,291 @@ public class CustomItemEffects {
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
+ } else if ((heldInternal.equals("HOE_OF_GREATEST_TILLING") &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.enableHoeOverlay && onPrivateIsland) &&
+ event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ BlockPos target = event.target.getBlockPos();
+ IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target);
+
+ if (targetState.getBlock() == Blocks.dirt || targetState.getBlock() == Blocks.grass) {
+ GlStateManager.enableDepth();
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.disableTexture2D();
+ GlStateManager.depthMask(true);
+
+ LinkedList<BlockPos> candidates = new LinkedList<>();
+ LinkedList<BlockPos> candidatesOld = new LinkedList<>();
+ LinkedList<BlockPos> candidatesNew = new LinkedList<>();
+ candidatesNew.add(target);
+
+ while (candidatesOld.size() <= 100) {
+ if (candidatesNew.isEmpty()) {
+ break;
+ }
+
+ candidates.addAll(candidatesNew);
+ candidatesNew.clear();
+
+ while (!candidates.isEmpty()) {
+
+ BlockPos candidate = candidates.pop();
+ candidatesOld.add(candidate);
+
+ float yaw = Minecraft.getMinecraft().thePlayer.getRotationYawHead();
+ Facing facing = Facing.forDirection(yaw);
+ int xOff = facing == Facing.WEST ? -1 : facing == Facing.EAST ? 1 : 0;
+ int zOff = facing == Facing.NORTH ? -1 : facing == Facing.SOUTH ? 1 : 0;
+
+ BlockPos renderPos = candidate.add(xOff, 0, zOff);
+ BlockPos airPos = renderPos.add(0, 1, 0);
+ IBlockState renderState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos);
+ IBlockState airState = Minecraft.getMinecraft().theWorld.getBlockState(airPos);
+ if (!candidatesOld.contains(renderPos) && !candidates.contains(renderPos) && !candidatesNew.contains(
+ renderPos)) {
+ if (renderState.getBlock() == Blocks.dirt || renderState.getBlock() == Blocks.grass && airState.getBlock() == Blocks.air) {
+ candidatesNew.add(renderPos);
+ } else {
+ break;
+ }
+ }
+ }
+
+ for (BlockPos renderPos : candidatesNew) {
+ AxisAlignedBB bbExpanded = Blocks.dirt.getSelectedBoundingBox(
+ Minecraft.getMinecraft().theWorld,
+ renderPos
+ )
+ .expand(0.001D, 0.001D, 0.001D)
+ .offset(-d0, -d1, -d2);
+ drawFilledBoundingBox(bbExpanded, 1f, "0:100:178:34:34");
+ }
+ }
+
+ AxisAlignedBB bbExpanded = Blocks.dirt.getSelectedBoundingBox(
+ Minecraft.getMinecraft().theWorld,
+ target
+ )
+ .expand(0.001D, 0.001D, 0.001D)
+ .offset(-d0, -d1, -d2);
+ drawFilledBoundingBox(bbExpanded, 1f, "0:100:178:34:34");
+
+ GlStateManager.depthMask(true);
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
+ } else if ((heldInternal.equals("SAM_SCYTHE") || heldInternal.equals("GARDEN_SCYTHE") &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.enableScytheOverlay && onPrivateIsland) &&
+ event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ BlockPos target = event.target.getBlockPos();
+ IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target);
+
+ int radius = heldInternal.equals("SAM_SCYTHE") ? 1 : 2;
+
+ if (scytheBlocks.contains(targetState.getBlock())) {
+ GlStateManager.enableDepth();
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.disableTexture2D();
+ GlStateManager.depthMask(true);
+
+ for (int xOff = -radius; xOff <= radius; xOff++) {
+ for (int yOff = -radius; yOff <= radius; yOff++) {
+ for (int zOff = -radius; zOff <= radius; zOff++) {
+ BlockPos renderPos = target.add(xOff, yOff, zOff);
+ IBlockState renderState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos);
+ if (scytheBlocks.contains(renderState.getBlock())) {
+ AxisAlignedBB bbExpanded = renderState.getBlock().getSelectedBoundingBox(
+ Minecraft.getMinecraft().theWorld,
+ renderPos
+ )
+ .expand(0.001D, 0.001D, 0.001D)
+ .offset(-d0, -d1, -d2);
+ drawFilledBoundingBox(bbExpanded, 1f, "0:100:178:34:34");
+ }
+ }
+ }
+ }
+
+ GlStateManager.depthMask(true);
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
+ }
+ }
+ }
+ }
+
+ public void buildersWandOverlay(DrawBlockHighlightEvent event, double d0, double d1, double d2) {
+ if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target
+ .getBlockPos()
+ .offset(event.target.sideHit, 1));
+ if (hover.getBlock() != Blocks.air) return;
+ IBlockState match = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos());
+ Item matchItem = Item.getItemFromBlock(match.getBlock());
+ if (matchItem == null) return;
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.disableTexture2D();
+ GlStateManager.depthMask(false);
+
+ HashSet<BlockPos> candidatesOld = new HashSet<>();
+ TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>();
+
+ getBuildersWandCandidates(Minecraft.getMinecraft().thePlayer,
+ event.target,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 10
+ );
+
+ ItemStack matchStack;
+
+ matchStack = new ItemStack(matchItem,
+ 1,
+ match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, event.target.getBlockPos())
+ );
+
+ int itemCount;
+ if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
+ itemCount = candidatesOld.size();
+ } else {
+ itemCount = countItemsInInventoryAndStorage(matchStack);
+ }
+
+ String special = (candidatesOld.size() <= itemCount)
+ ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour
+ : "0:255:255:0:0";
+
+ if (candidatesOld.size() <= MAX_BUILDERS_BLOCKS) {
+ for (Set<BlockPos> candidatesSorted : candidatesOldSorted.values()) {
+ for (BlockPos candidate : candidatesSorted) {
+ match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate);
+ Minecraft.getMinecraft().thePlayer.isSneaking();
+ AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld,
+ candidate.add(0, 0, 0)
+ ).offset(event.target.sideHit.getFrontOffsetX(),
+ event.target.sideHit.getFrontOffsetY(),
+ event.target.sideHit.getFrontOffsetZ()
+ );
+
+ drawBlock((int) bb.minX, (int) bb.minY, (int) bb.minZ + 1, match, event.partialTicks, 0.75f);
+ }
+ }
+
+ for (BlockPos candidate : candidatesOld) {
+ match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate);
+ Minecraft.getMinecraft().thePlayer.isSneaking();
+ AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld,
+ candidate.add(0, 0, 0)
+ ).expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2).offset(event.target.sideHit.getFrontOffsetX(),
+ event.target.sideHit.getFrontOffsetY(),
+ event.target.sideHit.getFrontOffsetZ()
+ );
+
+ drawOutlineBoundingBox(bb, 1f, special);
}
}
+
+ GlStateManager.depthMask(true);
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
+ }
+
+ public void buildersRulerOverlay(DrawBlockHighlightEvent event, double d0, double d1, double d2) {
+ if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target
+ .getBlockPos()
+ .offset(event.target.sideHit, 1));
+
+ if (hover.getBlock() != Blocks.air) return;
+
+ IBlockState match = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos());
+ Item matchItem = Item.getItemFromBlock(match.getBlock());
+ if (matchItem == null) return;
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.disableTexture2D();
+ GlStateManager.depthMask(false);
+
+ HashSet<BlockPos> candidatesOld = new HashSet<>();
+ TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>();
+
+ getBuildersRulerCandidates(Minecraft.getMinecraft().thePlayer,
+ event.target,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 10
+ );
+ ItemStack firstItemInRuler = getFirstItemInRuler();
+ if (!Minecraft.getMinecraft().thePlayer.isSneaking()) {
+ Item item = firstItemInRuler == null ? null : firstItemInRuler.getItem();
+ if (item != null) {
+ if (item instanceof ItemBlock)
+ match = ((ItemBlock) item).getBlock().getStateFromMeta(firstItemInRuler.getItemDamage());
+ else match = Blocks.dirt.getDefaultState();
+ }
+ }
+
+ ItemStack matchStack;
+ if (Minecraft.getMinecraft().thePlayer.isSneaking()) {
+ matchStack = new ItemStack(Minecraft.getMinecraft().theWorld
+ .getBlockState(event.target.getBlockPos())
+ .getBlock());
+ } else {
+ matchStack = firstItemInRuler;
+ }
+ int itemCount;
+ if (matchStack != null) {
+ if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
+ itemCount = candidatesOld.size();
+ } else {
+ itemCount = countItemsInInventoryAndStorage(matchStack);
+ }
+ } else {
+ return;
+ }
+
+ String special = (candidatesOld.size() <= itemCount)
+ ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour
+ : "0:255:255:0:0";
+
+ for (Set<BlockPos> candidatesSorted : candidatesOldSorted.values()) {
+ for (BlockPos candidate : candidatesSorted) {
+ AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld,
+ candidate.add(0, Minecraft.getMinecraft().thePlayer.isSneaking() ? -1 : 0, 0)
+ ).offset(event.target.sideHit.getFrontOffsetX(),
+ event.target.sideHit.getFrontOffsetY(),
+ event.target.sideHit.getFrontOffsetZ()
+ );
+
+ drawBlock((int) bb.minX, (int) bb.minY, (int) bb.minZ + 1, match, event.partialTicks, 0.75f);
+ }
+ }
+
+ for (BlockPos candidate : candidatesOld) {
+ AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld,
+ candidate.add(0, Minecraft.getMinecraft().thePlayer.isSneaking() ? -1 : 0, 0)
+ ).expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2).offset(event.target.sideHit.getFrontOffsetX(),
+ event.target.sideHit.getFrontOffsetY(),
+ event.target.sideHit.getFrontOffsetZ()
+ );
+
+ drawOutlineBoundingBox(bb,
+ 1f,
+ (Minecraft.getMinecraft().thePlayer.isSneaking())
+ ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour
+ : special
+ );
+ }
+
+ GlStateManager.depthMask(true);
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
}
}
@@ -1144,6 +1511,113 @@ public class CustomItemEffects {
}
}
+ public enum Facing {
+ NORTH,
+ EAST,
+ SOUTH,
+ WEST;
+
+ public static Facing forDirection(float direction) {
+ double rotation = (direction - 90) % 360;
+ if (rotation < 0) {
+ rotation += 360.0;
+ }
+
+ if ((0.0D <= rotation) && (rotation < 45.0D))
+ return WEST;
+ if ((45.0D <= rotation) && (rotation < 135.0D))
+ return NORTH;
+ if ((135.0D <= rotation) && (rotation < 225.0D))
+ return EAST;
+ if ((225.0D <= rotation) && (rotation < 315.0D))
+ return SOUTH;
+ if ((315.0D <= rotation) && (rotation < 360.0D)) {
+ return WEST;
+ } else {
+ return NORTH; // it uhhh shouldnt do this tho right
+ }
+ }
+ }
+
+ public void getBuildersRulerCandidates(
+ EntityPlayer player,
+ MovingObjectPosition target,
+ float partialTicks,
+ HashSet<BlockPos> candidatesOld,
+ TreeMap<Float, Set<BlockPos>> candidatesOldSorted,
+ int extraMax
+ ) {
+ if (target.sideHit != EnumFacing.UP) return;
+ boolean sneaking = Minecraft.getMinecraft().thePlayer.isSneaking();
+ candidatesOld.clear();
+ candidatesOldSorted.clear();
+ LinkedList<BlockPos> candidates = new LinkedList<>();
+ LinkedList<BlockPos> candidatesNew = new LinkedList<>();
+
+ candidatesNew.add(target.getBlockPos());
+
+ double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
+ double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
+ double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
+
+ while (candidatesOld.size() <= MAX_BUILDERS_BLOCKS + extraMax) {
+ if (candidatesNew.isEmpty()) {
+ break;
+ }
+
+ candidates.addAll(candidatesNew);
+ candidatesNew.clear();
+
+ while (!candidates.isEmpty()) {
+ if (candidatesOld.size() > MAX_BUILDERS_BLOCKS + extraMax) break;
+
+ BlockPos candidate = candidates.pop();
+
+ float distSq = (float) ((candidate.getX() + 0.5f - d0) * (candidate.getX() + 0.5f - d0) +
+ (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) *
+ (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) +
+ (candidate.getZ() + 0.5f - d2) * (candidate.getZ() + 0.5f - d2));
+ candidatesOldSorted.computeIfAbsent(distSq, k -> new HashSet<>()).add(candidate);
+
+ candidatesOld.add(candidate);
+
+ float yaw = Minecraft.getMinecraft().thePlayer.getRotationYawHead();
+ Facing facing = Facing.forDirection(yaw);
+ int xOff = facing == Facing.WEST ? -1 : facing == Facing.EAST ? 1 : 0;
+ int zOff = facing == Facing.NORTH ? -1 : facing == Facing.SOUTH ? 1 : 0;
+ if (!sneaking) {
+ if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add(xOff, 1, zOff)).getBlock() == Blocks.air) {
+
+ BlockPos posNew = candidate.add(xOff, 0, zOff);
+ if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) {
+ IBlockState blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew.add(0, 1, 0));
+ if (blockNew.getBlock() == Blocks.air) {
+ candidatesNew.add(posNew);
+ }
+ }
+ } else {
+ break;
+ }
+ } else {
+ if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add(xOff, 0, zOff)).getBlock()
+ == Minecraft.getMinecraft().theWorld.getBlockState(target.getBlockPos()).getBlock()) {
+ BlockPos posNew = candidate.add(xOff, 0, zOff);
+ if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) {
+ IBlockState blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew.add(0, 0, 0));
+ if (blockNew.getBlock() ==
+ Minecraft.getMinecraft().theWorld.getBlockState(target.getBlockPos()).getBlock()) {
+ candidatesNew.add(posNew);
+ }
+ }
+ } else {
+ break;
+ }
+ }
+
+ }
+ }
+ }
+
public static void drawBlock(int x, int y, int z, IBlockState state, float partialTicks, float brightness) {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
index 711d5235..c06563c2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
@@ -24,8 +24,10 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
+import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -100,6 +102,19 @@ public class DungeonNpcProfitOverlay {
}
@SubscribeEvent
+ public void onButtonExclusionZones(ButtonExclusionZoneEvent event) {
+ if (isRendering())
+ event.blockArea(
+ new Rectangle(
+ event.getGuiBaseRect().getRight(),
+ event.getGuiBaseRect().getTop(),
+ 180 /*width*/ + 4 /*space*/, 101
+ ),
+ ButtonExclusionZoneEvent.PushDirection.TOWARDS_RIGHT
+ );
+ }
+
+ @SubscribeEvent
public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!NotEnoughUpdates.INSTANCE.config.dungeons.croesusProfitOverlay || !(event.gui instanceof GuiChest)) {
chestProfits = null;
@@ -221,15 +236,7 @@ public class DungeonNpcProfitOverlay {
int mouseY = Utils.getMouseY();
if (Utils.isWithinRect(mouseX, mouseY, x, y, 160, 10))
- Utils.drawHoveringText(
- chestProfit.lore,
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(chestProfit.lore, mouseX, mouseY, width, height, -1);
}
}
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 695c9851..a5c96e4a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
@@ -277,7 +277,7 @@ public class EnchantingSolvers {
GlStateManager.disableDepth();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
- Utils.drawStringScaled((solveIndex + 1) + "", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringScaled((solveIndex + 1) + "",
x + 8.5f - w / 2f, y + 8.5f - 4, true, 0xffc0c0c0, 1f
);
return true;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
index 5a611178..97aa25d4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
@@ -26,7 +26,6 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -34,8 +33,6 @@ import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import lombok.var;
import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
@@ -56,7 +53,6 @@ import java.io.OutputStreamWriter;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -87,6 +83,14 @@ public class FairySouls {
return instance;
}
+ public boolean isTrackSouls() {
+ return trackSouls;
+ }
+
+ public boolean isShowSouls() {
+ return showSouls;
+ }
+
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
currentLocation = null;
@@ -379,25 +383,6 @@ public class FairySouls {
Utils.addChatMessage(s);
}
- private static void printHelp() {
- print("");
- print(EnumChatFormatting.DARK_PURPLE.toString() + EnumChatFormatting.BOLD + " NEU Fairy Soul Waypoint Guide");
- print(EnumChatFormatting.LIGHT_PURPLE + "Shows waypoints for every fairy soul in your world");
- print(EnumChatFormatting.LIGHT_PURPLE + "Clicking a fairy soul automatically removes it from the list");
- if (!NotEnoughUpdates.INSTANCE.config.hidden.dev) {
- print(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.OBFUSCATED + "Ab" + EnumChatFormatting.RESET +
- EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.RESET + EnumChatFormatting.RED +
- " This feature cannot and will not work in Dungeons. " + EnumChatFormatting.DARK_RED + "!" +
- EnumChatFormatting.OBFUSCATED + "Ab");
- }
- print(EnumChatFormatting.GOLD.toString() + EnumChatFormatting.BOLD + " Commands:");
- print(EnumChatFormatting.YELLOW + "/neusouls help - Display this message");
- print(EnumChatFormatting.YELLOW + "/neusouls on/off - Enable/disable showing waypoint markers");
- print(EnumChatFormatting.YELLOW +
- "/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted");
- print("");
- }
-
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onChatReceived(ClientChatReceivedEvent event) {
if (!trackSouls || event.type == 2) return;
@@ -407,53 +392,4 @@ public class FairySouls {
markClosestSoulFound();
}
}
-
- public static class FairySoulsCommand extends ClientCommandBase {
- public FairySoulsCommand() {
- super("neusouls");
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Collections.singletonList("fairysouls");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length != 1) {
- printHelp();
- return;
- }
-
- String subcommand = args[0].toLowerCase();
- switch (subcommand) {
- case "help":
- printHelp();
- break;
- case "on":
- case "enable":
- if (!FairySouls.instance.trackSouls) {
- print(
- EnumChatFormatting.RED + "Fairy soul tracking is off, enable it using /neu before using this command");
- return;
- }
- print(EnumChatFormatting.DARK_PURPLE + "Enabled fairy soul waypoints");
- FairySouls.getInstance().setShowFairySouls(true);
- break;
- case "off":
- case "disable":
- FairySouls.getInstance().setShowFairySouls(false);
- print(EnumChatFormatting.DARK_PURPLE + "Disabled fairy soul waypoints");
- break;
- case "clear":
- FairySouls.getInstance().markAllAsFound();
- break;
- case "unclear":
- FairySouls.getInstance().markAllAsMissing();
- break;
- default:
- print(EnumChatFormatting.RED + "Unknown subcommand: " + subcommand);
- }
- }
- }
}
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 800e25b1..b43b0e78 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
@@ -174,11 +174,7 @@ public class FishingHelper {
Utils.drawStringCentered(
String.format("%.02fs", seconds),
- Minecraft.getMinecraft().fontRendererObj,
- 0,
- -baseHeight - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT,
- false,
- color
+ 0, -baseHeight - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT, false, color
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/GardenNpcPrices.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/GardenNpcPrices.java
new file mode 100644
index 00000000..294194b9
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/GardenNpcPrices.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
+import io.github.moulberry.notenoughupdates.util.ItemResolutionQuery;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@NEUAutoSubscribe
+public class GardenNpcPrices {
+
+ private final Pattern itemRegex = Pattern.compile("§5§o §.([a-zA-Z \\-]+)(?:§8x(\\d+))?");
+ //§5§o §aEnchanted Cactus Green §8x421
+ //§5§o §aEnchanted Hay Bale §8x62
+ //§5§o §9Enchanted Cookie §8x4
+ //§5§o §9Tightly-Tied Hay Bale
+
+ private Map<List<String>, List<String>> prices = new HashMap<>();
+
+ @SubscribeEvent
+ public void onGardenNpcPrices(ItemTooltipEvent event) {
+ if (!NotEnoughUpdates.INSTANCE.config.tooltipTweaks.gardenNpcPrice) return;
+ if (event.toolTip.size() <= 2 || event.itemStack.getItem() != Item.getItemFromBlock(Blocks.stained_hardened_clay)) return;
+
+ List<String> tooltipCopy = new ArrayList<>(event.toolTip);
+ if (prices.get(tooltipCopy) == null) {
+ for (int i = 2; i < event.toolTip.size(); i++) {
+ Matcher matcher = itemRegex.matcher(event.toolTip.get(i));
+
+ if (matcher.matches()) {
+ int amount = 1;
+ if (matcher.group(2) != null) amount = Integer.parseInt(matcher.group(2));
+
+ double cost = calculateCost(ItemResolutionQuery.findInternalNameByDisplayName(matcher.group(1).trim(), false), amount);
+ event.toolTip.set(i, event.toolTip.get(i) + " §7(§6" + (cost == 0 ? "?" : Utils.shortNumberFormat(cost, 0)) + "§7 coins)");
+ } else {
+ prices.put(tooltipCopy, event.toolTip);
+ }
+ }
+ } else {
+ event.toolTip.clear();
+ event.toolTip.addAll(prices.get(tooltipCopy));
+ }
+ }
+ public double calculateCost(String internalName, int amount) {
+ double price = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarOrBin(internalName, false);
+ if (price != -1) {
+ return price * amount;
+ }
+ return 0d;
+ }
+
+ @SubscribeEvent
+ public void onWorldLoad(WorldEvent.Load event) {
+ prices.clear();
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
index dad801ec..ecab042c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
@@ -22,16 +22,23 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.github.moulberry.notenoughupdates.NEUManager;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.ChromaColour;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
@@ -46,9 +53,12 @@ import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Random;
import java.util.function.Consumer;
+@NEUAutoSubscribe
public class ItemCustomizeManager {
public static class ReloadListener implements IResourceManagerReloadListener {
@Override
@@ -81,6 +91,9 @@ public class ItemCustomizeManager {
public String customGlintColour = DEFAULT_GLINT_COLOR;
public String customLeatherColour = null;
+
+ public String defaultItem = null;
+ public String customItem = null;
}
public static void putItemData(String uuid, ItemData data) {
@@ -313,4 +326,104 @@ public class ItemCustomizeManager {
} catch (Exception ignored) {
}
}
+
+ public static Item getCustomItem(ItemStack stack) {
+ ItemData data = getDataForItem(stack);
+ if (data == null || data.customItem == null || data.customItem.length() == 0) return stack.getItem();
+ Item newItem = Item.getByNameOrId(data.customItem.split(":")[0]);
+ if (newItem == null) return stack.getItem();
+ return newItem;
+ }
+
+ public static Item getCustomItem(ItemStack stack, String newItemString) {
+ Item newItem = Item.getByNameOrId(newItemString.split(":")[0]);
+ if (newItem == null) return stack.getItem();
+ return newItem;
+ }
+
+ static Random random = new Random();
+ static HashMap<Integer, Long> lastUpdate = new HashMap<>();
+ static HashMap<Integer, Integer> damageMap = new HashMap<>();
+
+ public static int getCustomItemDamage(ItemStack stack) {
+ ItemData data = getDataForItem(stack);
+ if (data == null || data.customItem == null || data.customItem.length() == 0) return stack.getMetadata();
+ try {
+ String damageString = data.customItem.split(":")[1];
+ if (damageString.equals("?")) {
+ ArrayList<ItemStack> list = new ArrayList<>();
+ getCustomItem(stack).getSubItems(getCustomItem(stack), null, list);
+ if (damageMap.get(stack.getTagCompound().hashCode()) == null || System.currentTimeMillis() - lastUpdate.get(stack.getTagCompound().hashCode()) > 250) {
+ damageMap.put(stack.getTagCompound().hashCode(), random.nextInt(list.size()));
+
+ lastUpdate.put(stack.getTagCompound().hashCode(), System.currentTimeMillis());
+ }
+ return damageMap.get(stack.getTagCompound().hashCode());
+ }
+ return Integer.parseInt(data.customItem.split(":")[1]);
+ } catch (Exception e) {
+ if (Item.getByNameOrId(data.defaultItem) == Items.skull && getCustomItem(stack) != Items.skull) return 0;
+ return stack.getMetadata();
+ }
+ }
+
+ @SubscribeEvent
+ public void onWorldUnload(WorldEvent.Unload event) {
+ damageMap.clear();
+ lastUpdate.clear();
+ }
+
+ public static boolean shouldRenderLeatherColour(ItemStack stack) {
+ ItemData data = getDataForItem(stack);
+ if (data == null || data.customItem == null || data.customItem.length() == 0) return stack.getItem() instanceof ItemArmor &&
+ ((ItemArmor) stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER;
+ Item item = Item.getByNameOrId(data.customItem);
+ if (item == null) return stack.getItem() instanceof ItemArmor &&
+ ((ItemArmor) stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER;
+ return item instanceof ItemArmor &&
+ ((ItemArmor) item).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER;
+ }
+
+ public static boolean hasCustomItem(ItemStack stack) {
+ ItemData data = getDataForItem(stack);
+ if (data == null || data.customItem == null || data.customItem.length() == 0 || data.defaultItem == null || data.customItem.equals(data.defaultItem)) return false;
+ Item item = Item.getByNameOrId(data.customItem.split(":")[0]);
+ Item defaultItem = Item.getByNameOrId(data.defaultItem);
+ if (item == null) {
+ data.customItem = null;
+ return false;
+ }
+ return defaultItem != item;
+ }
+
+ public static ItemStack useCustomArmour(LayerArmorBase<?> instance, EntityLivingBase entitylivingbaseIn, int armorSlot) {
+ ItemStack stack = instance.getCurrentArmor(entitylivingbaseIn, armorSlot);
+ if (stack == null) return stack;
+ ItemStack newStack = stack.copy();
+ newStack.setItem(ItemCustomizeManager.getCustomItem(newStack));
+ newStack.setItemDamage(ItemCustomizeManager.getCustomItemDamage(newStack));
+ if (armorSlot != 4) {
+ if (newStack.getItem() instanceof ItemArmor) return newStack;
+ else return stack;
+ }
+ return newStack;
+ }
+
+ public static ItemStack useCustomItem(ItemStack stack) {
+ if (stack == null) return stack;
+ if (!ItemCustomizeManager.hasCustomItem(stack)) return stack;
+ ItemStack newStack = stack.copy();
+ newStack.setItem(ItemCustomizeManager.getCustomItem(newStack));
+ newStack.setItemDamage(ItemCustomizeManager.getCustomItemDamage(newStack));
+ return newStack;
+ }
+
+ public static ItemStack setHeadArmour(EntityLivingBase instance, int i) {
+ if (instance.getCurrentArmor(3) == null) return null;
+ ItemStack stack = instance.getCurrentArmor(3).copy();
+ stack.setItem(ItemCustomizeManager.getCustomItem(stack));
+ stack.setItemDamage(ItemCustomizeManager.getCustomItemDamage(stack));
+ return stack;
+ }
+
}
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 2cbd3125..9217dcae 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MiningStuff.java
@@ -152,12 +152,7 @@ public class MiningStuff {
if (alpha > 10) {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
"Titanium has spawned nearby!",
- Minecraft.getMinecraft().fontRendererObj,
- 0,
- 0,
- true,
- width / 4 - 20,
- colour | (colour << 8) | (colour << 16) | (alpha << 24)
+ 0, 0, true, width / 4 - 20, colour | (colour << 8) | (colour << 16) | (alpha << 24)
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MutingComposter.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MutingComposter.java
new file mode 100644
index 00000000..e2aa8cf2
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/MutingComposter.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import net.minecraftforge.client.event.sound.PlaySoundEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+import java.util.Arrays;
+import java.util.List;
+
+@NEUAutoSubscribe
+public class MutingComposter {
+
+ private static final MutingComposter INSTANCE = new MutingComposter();
+ private final List<String> mutableSounds = Arrays.asList(
+ "mob.wolf.growl",
+ "tile.piston.out",
+ "liquid.water",
+ "mob.chicken.plop"
+ );
+
+ public static MutingComposter getInstance() {
+ return INSTANCE;
+ }
+
+ protected boolean isEnabled() {
+ return "garden".equals(SBInfo.getInstance().getLocation())
+ && NotEnoughUpdates.INSTANCE.config.garden.muteComposterSounds;
+ }
+
+ @SubscribeEvent
+ public void onSoundPlay(PlaySoundEvent event) {
+ if (mutableSounds.contains(event.name) && isEnabled() && event.sound.getXPosF() == -11.5 && event.sound.getYPosF() == 72.5 && event.sound.getZPosF() == -26.5) {
+ event.result = null;
+ }
+ }
+}
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 716fb37d..ceae782b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
@@ -473,29 +473,44 @@ public class PetInfoOverlay extends TextOverlay {
}
}
JsonObject pets = Constants.PETS;
- if (pets != null && pets.has("custom_pet_leveling") && pets.get("custom_pet_leveling").getAsJsonObject().has(pet.petType.toUpperCase()) &&
- pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().has("xp_multiplier")) {
- xp *= pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().get("xp_multiplier").getAsFloat();
+ if (pets != null && pets.has("custom_pet_leveling") &&
+ pets.get("custom_pet_leveling").getAsJsonObject().has(pet.petType.toUpperCase()) &&
+ pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().has(
+ "xp_multiplier")) {
+ xp *= pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().get(
+ "xp_multiplier").getAsFloat();
}
return xp;
}
+ private int firstPetLines = 0;
+ private int secondPetLines = 0;
+
@Override
public void updateFrequent() {
Pet currentPet = getCurrentPet();
if (!NotEnoughUpdates.INSTANCE.config.petOverlay.enablePetInfo || currentPet == null) {
overlayStrings = null;
} else {
+ firstPetLines = 0;
+ secondPetLines = 0;
overlayStrings = new ArrayList<>();
overlayStrings.addAll(createStringsForPet(currentPet, false));
+ firstPetLines = overlayStrings.size();
Pet currentPet2 = getCurrentPet2();
if (currentPet2 != null) {
overlayStrings.add("");
+ if (firstPetLines == 1) {
+ overlayStrings.add("");
+ }
overlayStrings.addAll(createStringsForPet(currentPet2, true));
+ secondPetLines = overlayStrings.size() - firstPetLines - 1;
+ if (firstPetLines == 1) {
+ secondPetLines--;
+ }
}
-
}
}
@@ -519,14 +534,20 @@ public class PetInfoOverlay extends TextOverlay {
currentPet.rarity.chatFormatting +
WordUtils.capitalizeFully(currentPet.petType.replace("_", " "));
- String lvlStringShort = EnumChatFormatting.AQUA + "" + roundFloat(levelXp) + "/" +
- roundFloat(currentPet.petLevel.getExpRequiredForNextLevel())
- + EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";
+ float levelPercent = getLevelPercent(currentPet);
+ String lvlStringShort = null;
+ String lvlString = null;
+
+ if (levelPercent != 100 || !NotEnoughUpdates.INSTANCE.config.petOverlay.hidePetLevelProgress) {
+ lvlStringShort = EnumChatFormatting.AQUA + "" + roundFloat(levelXp) + "/" +
+ roundFloat(currentPet.petLevel.getExpRequiredForNextLevel())
+ + EnumChatFormatting.YELLOW + " (" + levelPercent + "%)";
- String lvlString = EnumChatFormatting.AQUA + "" +
- Utils.shortNumberFormat(Math.min(levelXp, currentPet.petLevel.getExpRequiredForNextLevel()), 0) + "/" +
- Utils.shortNumberFormat(currentPet.petLevel.getExpRequiredForNextLevel(), 0)
- + EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";
+ lvlString = EnumChatFormatting.AQUA + "" +
+ Utils.shortNumberFormat(Math.min(levelXp, currentPet.petLevel.getExpRequiredForNextLevel()), 0) + "/" +
+ Utils.shortNumberFormat(currentPet.petLevel.getExpRequiredForNextLevel(), 0)
+ + EnumChatFormatting.YELLOW + " (" + levelPercent + "%)";
+ }
float xpGain;
if (!secondPet) {
@@ -593,6 +614,8 @@ public class PetInfoOverlay extends TextOverlay {
String finalEtaMaxStr = etaMaxStr;
String finalXpGainString = xpGainString;
String finalPetItemStr = petItemStr;
+ String finalLvlString = lvlString;
+ String finalLvlStringShort = lvlStringShort;
return new ArrayList<String>() {{
for (int index : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) {
switch (index) {
@@ -600,10 +623,10 @@ public class PetInfoOverlay extends TextOverlay {
add(petName);
break;
case 1:
- add(lvlStringShort);
+ if (finalLvlStringShort != null) add(finalLvlStringShort);
break;
case 2:
- add(lvlString);
+ if (finalLvlString != null) add(finalLvlString);
break;
case 3:
add(finalXpGainString);
@@ -716,6 +739,10 @@ public class PetInfoOverlay extends TextOverlay {
GlStateManager.enableDepth();
GlStateManager.pushMatrix();
Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
+
+ if (firstPetLines == 1) y -= 9;
+ if (firstPetLines == 2) y -= 3;
+
GlStateManager.translate(x - 2, y - 2, 0);
GlStateManager.scale(2, 2, 1);
Utils.drawItemStack(stack, 0, 0);
@@ -730,12 +757,16 @@ public class PetInfoOverlay extends TextOverlay {
if (petItem2 != null) {
Vector2f position = getPosition(overlayWidth, overlayHeight, true);
int x = (int) position.x;
- int y = (int) position.y + NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText.size() * 10;
+ int y = (int) position.y + (overlayStrings.size() - secondPetLines) * 10;
ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem2);
GlStateManager.enableDepth();
GlStateManager.pushMatrix();
Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
+
+ if (secondPetLines == 1) y -= 9;
+ if (secondPetLines == 2) y -= 3;
+
GlStateManager.translate(x - 2, y - 2, 0);
GlStateManager.scale(2, 2, 1);
Utils.drawItemStack(stack, 0, 0);
@@ -1114,7 +1145,7 @@ public class PetInfoOverlay extends TextOverlay {
PetInfoOverlay.config.selectedPet = -1;
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
EnumChatFormatting.RED + "[NEU] Can't find pet \u00a7" + petStringMatch +
- EnumChatFormatting.RED + " try revisiting all pages of /pets."));
+ EnumChatFormatting.RED + " try revisiting all pages of /pets."));
}
}
} else if ((chatMessage.toLowerCase().startsWith("you despawned your")) || (chatMessage.toLowerCase().contains(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PresetWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PresetWarning.java
new file mode 100644
index 00000000..5e57744b
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PresetWarning.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
+import io.github.moulberry.notenoughupdates.core.GuiElement;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
+import io.github.moulberry.notenoughupdates.util.ItemUtils;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+import java.util.List;
+
+@NEUAutoSubscribe
+public class PresetWarning extends GuiElement {
+ private static final PresetWarning INSTANCE = new PresetWarning();
+
+ private boolean showWarning = false;
+ private String presetName = null;
+ private int presetSlot = -1;
+
+ public static PresetWarning getInstance() {
+ return INSTANCE;
+ }
+
+ private boolean shouldPerformCheck() {
+ if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ showWarning = false;
+ return false;
+ }
+
+ if (Utils.getOpenChestName().startsWith("Plot Modification: ")) {
+ return true;
+ } else {
+ showWarning = false;
+ return false;
+ }
+ }
+
+ public boolean shouldShow() {
+ return shouldPerformCheck() && showWarning;
+ }
+
+ @SubscribeEvent
+ public void onMouseClick(SlotClickEvent event) {
+ if (!shouldPerformCheck()) return;
+ if (!NotEnoughUpdates.INSTANCE.config.garden.presetDeleteWarning) return;
+ if (event.slotId == -999) return;
+ if (event.clickedButton == 0) return;
+
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+
+ ItemStack clickedPreset = chest.inventorySlots.getSlot(event.slotId).getStack();
+ if (clickedPreset == null) return;
+
+ List<String> list = ItemUtils.getLore(clickedPreset);
+ if (list.isEmpty()) return;
+
+ String last = list.get(list.size() - 1);
+ if (last.contains("Right-Click to delete!")) {
+ showWarning = true;
+ presetName = clickedPreset.getDisplayName();
+ presetSlot = event.slotId;
+ event.setCanceled(true);
+ }
+ }
+
+ public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) {
+ if (shouldShow()) {
+ cir.setReturnValue(false);
+ }
+ }
+
+ @Override
+ public void render() {
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ final int width = scaledResolution.getScaledWidth();
+ final int height = scaledResolution.getScaledHeight();
+
+ GlStateManager.disableLighting();
+
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(0, 0, 500);
+
+ Gui.drawRect(0, 0, width, height, 0x80000000);
+
+ RenderUtils.drawFloatingRectDark(width / 2 - 90, height / 2 - 45, 180, 90);
+
+ int neuLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth("\u00a7lNEU");
+ Minecraft.getMinecraft().fontRendererObj.drawString(
+ "\u00a7lNEU",
+ width / 2 + 90 - neuLength - 3,
+ height / 2 - 45 + 4,
+ 0xff000000
+ );
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj,
+ width / 2, height / 2 - 45 + 10, false, 170, 0xffff4040
+ );
+
+ String sellLine = "\u00a77[ \u00a7r" + presetName + "\u00a77 ]";
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj,
+ width / 2, height / 2 - 45 + 25, false, 170, 0xffffffff
+ );
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ "Continue removing this preset?",
+ Minecraft.getMinecraft().fontRendererObj,
+ width / 2,
+ height / 2 - 45 + 50,
+ false,
+ 170,
+ 0xffa0a0a0
+ );
+
+ RenderUtils.drawFloatingRectDark(width / 2 - 43, height / 2 + 23, 40, 16, false);
+ RenderUtils.drawFloatingRectDark(width / 2 + 3, height / 2 + 23, 40, 16, false);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ EnumChatFormatting.GREEN + "[Y]es",
+ Minecraft.getMinecraft().fontRendererObj,
+ width / 2 - 23,
+ height / 2 + 31,
+ true,
+ 36,
+ 0xff00ff00
+ );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ EnumChatFormatting.RED + "[N]o",
+ Minecraft.getMinecraft().fontRendererObj,
+ width / 2 + 23,
+ height / 2 + 31,
+ true,
+ 36,
+ 0xffff0000
+ );
+
+ GlStateManager.popMatrix();
+ }
+
+ @Override
+ public boolean mouseInput(int mouseX, int mouseY) {
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ final int width = scaledResolution.getScaledWidth();
+ final int height = scaledResolution.getScaledHeight();
+
+ if (Mouse.getEventButtonState()) {
+ if (mouseY >= height / 2 + 23 && mouseY <= height / 2 + 23 + 16) {
+ if (mouseX >= width / 2 - 43 && mouseX <= width / 2 - 3) {
+ makeClick();
+ }
+ showWarning = false;
+ }
+
+ if (mouseX < width / 2 - 90 || mouseX > width / 2 + 90 ||
+ mouseY < height / 2 - 45 || mouseY > height / 2 + 45) {
+ showWarning = false;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ if (!Keyboard.getEventKeyState()) {
+ if (Keyboard.getEventKey() == Keyboard.KEY_Y || Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
+ makeClick();
+ }
+ showWarning = false;
+ }
+
+ return false;
+ }
+
+ private void makeClick() {
+ if (presetSlot != -1) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId,
+ presetSlot, 1, 0, Minecraft.getMinecraft().thePlayer
+ );
+ presetSlot = -1;
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
index 736d5058..8d1c06f3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
@@ -96,7 +96,6 @@ public class SunTzu {
int height = Utils.renderStringTrimWidth(
EnumChatFormatting.YELLOW + getQuote(),
- Minecraft.getMinecraft().fontRendererObj,
true,
sr.getScaledWidth() / 2 - 100,
5,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java
index 2f091304..1e7dc319 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java
@@ -25,7 +25,6 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -208,7 +207,6 @@ public class EntityViewer extends GuiScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
- FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
this.guiLeft = (width - this.xSize) / 2;
this.guiTop = (height - this.ySize) / 2;
@@ -216,7 +214,7 @@ public class EntityViewer extends GuiScreen {
Minecraft.getMinecraft().getTextureManager().bindTexture(BACKGROUND);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
- Utils.drawStringScaledMaxWidth(label, fontRenderer, guiLeft + 10, guiTop + 10, false, 100, 0xFF00FF);
+ Utils.drawStringScaledMaxWidth(label, guiLeft + 10, guiTop + 10, false, 100, 0xFF00FF);
renderEntity(entity, guiLeft + 90, guiTop + 75, mouseX, mouseY);
}
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 530dcfd1..908ae307 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java
@@ -25,9 +25,11 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.auction.APIManager;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats;
import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@@ -45,6 +47,7 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
@@ -73,6 +76,22 @@ public class AccessoryBagOverlay {
private static final int TAB_MISSING = 4;
private static final int TAB_OPTIMIZER = 5;
+ public static final AccessoryBagOverlay INSTANCE = new AccessoryBagOverlay();
+
+ @SubscribeEvent
+ public void onButtonExclusionZones(ButtonExclusionZoneEvent event) {
+ if (isInAccessoryBag()) {
+ event.blockArea(
+ new Rectangle(
+ event.getGuiBaseRect().getRight(),
+ event.getGuiBaseRect().getTop(),
+ 80 /*pane*/ + 24 /*tabs*/ + 4 /*space*/, 150
+ ),
+ ButtonExclusionZoneEvent.PushDirection.TOWARDS_RIGHT
+ );
+ }
+ }
+
private static final ItemStack[] TAB_STACKS = new ItemStack[]{
Utils.createItemStack(Items.dye, EnumChatFormatting.DARK_AQUA + "Basic Information",
10, EnumChatFormatting.GREEN + "- Talis count by rarity"
@@ -204,24 +223,8 @@ public class AccessoryBagOverlay {
private static Set<Integer> pagesVisited = new HashSet<>();
public static void renderVisitOverlay(int x, int y) {
- Utils.drawStringCenteredScaledMaxWidth(
- "Please visit all",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 78,
- true,
- 70,
- -1
- );
- Utils.drawStringCenteredScaledMaxWidth(
- "pages of the bag",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 86,
- true,
- 70,
- -1
- );
+ Utils.drawStringCenteredScaledMaxWidth("Please visit all", x + 40, y + 78, true, 70, -1);
+ Utils.drawStringCenteredScaledMaxWidth("pages of the bag", x + 40, y + 86, true, 70, -1);
}
private static TreeMap<Integer, Integer> talismanCountRarity = null;
@@ -237,15 +240,7 @@ public class AccessoryBagOverlay {
}
}
- Utils.drawStringCenteredScaledMaxWidth(
- "# By Rarity",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "# By Rarity");
int yIndex = 0;
for (Map.Entry<Integer, Integer> entry : talismanCountRarity.descendingMap().entrySet()) {
@@ -271,15 +266,7 @@ public class AccessoryBagOverlay {
}
}
- Utils.drawStringCenteredScaledMaxWidth(
- "Total Stats",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Total Stats");
int yIndex = 0;
for (int i = 0; i < PlayerStats.defaultStatNames.length; i++) {
String statName = PlayerStats.defaultStatNames[i];
@@ -319,15 +306,7 @@ public class AccessoryBagOverlay {
}
}
- Utils.drawStringCenteredScaledMaxWidth(
- "Reforge Stats",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Reforge Stats");
int yIndex = 0;
for (int i = 0; i < PlayerStats.defaultStatNames.length; i++) {
String statName = PlayerStats.defaultStatNames[i];
@@ -363,28 +342,12 @@ public class AccessoryBagOverlay {
if (duplicates == null) {
JsonObject misc = Constants.MISC;
if (misc == null) {
- Utils.drawStringCenteredScaledMaxWidth(
- "Duplicates: ERROR",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Duplicates: ERROR");
return;
}
JsonElement talisman_upgrades_element = misc.get("talisman_upgrades");
if (talisman_upgrades_element == null) {
- Utils.drawStringCenteredScaledMaxWidth(
- "Duplicates: ERROR",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Duplicates: ERROR");
return;
}
JsonObject talisman_upgrades = talisman_upgrades_element.getAsJsonObject();
@@ -419,25 +382,9 @@ public class AccessoryBagOverlay {
}
}
if (duplicates.isEmpty()) {
- Utils.drawStringCenteredScaledMaxWidth(
- "No Duplicates",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "No Duplicates");
} else {
- Utils.drawStringCenteredScaledMaxWidth(
- "Duplicates: " + duplicates.size(),
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Duplicates: " + duplicates.size());
int yIndex = 0;
for (ItemStack duplicate : duplicates) {
@@ -451,9 +398,12 @@ public class AccessoryBagOverlay {
}
if (duplicates.size() > 11) {
- Utils.drawStringCenteredScaledMaxWidth("+" + (duplicates.size() - 10) + " More",
- Minecraft.getMinecraft().fontRendererObj, x + 40, y + 16 + 121, false, 70,
- new Color(80, 80, 80).getRGB()
+ Utils.drawStringCenteredScaledMaxWidth(
+ "+" + (duplicates.size() - 10) + " More",
+ x + 40, y + 16 + 121,
+ false,
+ 70,
+ gray()
);
}
}
@@ -465,28 +415,12 @@ public class AccessoryBagOverlay {
if (missing == null) {
JsonObject misc = Constants.MISC;
if (misc == null) {
- Utils.drawStringCenteredScaledMaxWidth(
- "Duplicates: ERROR",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Duplicates: ERROR");
return;
}
JsonElement talisman_upgrades_element = misc.get("talisman_upgrades");
if (talisman_upgrades_element == null) {
- Utils.drawStringCenteredScaledMaxWidth(
- "Duplicates: ERROR",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Duplicates: ERROR");
return;
}
JsonObject talisman_upgrades = talisman_upgrades_element.getAsJsonObject();
@@ -554,37 +488,15 @@ public class AccessoryBagOverlay {
}
}
if (missing.isEmpty()) {
- Utils.drawStringCenteredScaledMaxWidth(
- "No Missing",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "No Missing");
} else {
- Utils.drawStringCenteredScaledMaxWidth(
- "Missing: " + missing.size(),
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ drawString(x, y, "Missing: " + missing.size());
int yIndex = 0;
long currentTime = System.currentTimeMillis();
- int marqueeOffset = (int) (currentTime / 500 % 100);
for (ItemStack missingStack : missing) {
String s = missingStack.getDisplayName();
- //int marueeOffset
- //if(s.length()) {
-
- //}
-
s = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(s, 70);
String clean = StringUtils.cleanColourNotModifiers(s);
@@ -610,10 +522,7 @@ public class AccessoryBagOverlay {
}
if (missing.size() > 11) {
- Utils.drawStringCenteredScaledMaxWidth("Show All",
- Minecraft.getMinecraft().fontRendererObj, x + 40, y + 16 + 121, false, 70,
- new Color(80, 80, 80).getRGB()
- );
+ Utils.drawStringCenteredScaledMaxWidth("Show All", x + 40, y + 16 + 121, false, 70, gray());
final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
final int scaledWidth = scaledresolution.getScaledWidth();
@@ -675,7 +584,7 @@ public class AccessoryBagOverlay {
mouseX * scaledresolution.getScaleFactor() / 2,
mouseY * scaledresolution.getScaleFactor() / 2,
scaledWidth * scaledresolution.getScaleFactor() / 2,
- scaledHeight * scaledresolution.getScaleFactor() / 2, -1, Minecraft.getMinecraft().fontRendererObj
+ scaledHeight * scaledresolution.getScaleFactor() / 2, -1
);
GlStateManager.popMatrix();
}
@@ -683,6 +592,10 @@ public class AccessoryBagOverlay {
}
}
+ private static void drawString(int x, int y, String abc) {
+ Utils.drawStringCenteredScaledMaxWidth(abc, x + 40, y + 12, false, 70, gray());
+ }
+
private static boolean forceCC = false;
private static boolean forceAS = false;
private static boolean useGodPot = true;
@@ -690,15 +603,7 @@ public class AccessoryBagOverlay {
private static int mainWeapon = 1;
public static void renderOptimizerOverlay(int x, int y) {
- Utils.drawStringCenteredScaledMaxWidth(
- "Optimizer",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 12,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ Utils.drawStringCenteredScaledMaxWidth("Optimizer", x + 40, y + 12, false, 70, gray());
int light = new Color(220, 220, 220).getRGB();
int dark = new Color(170, 170, 170).getRGB();
@@ -724,116 +629,50 @@ public class AccessoryBagOverlay {
dark
);
+ Utils.drawStringCenteredScaledMaxWidth("Force 100% CC", x + 40, y + 27, false, 70, gray());
Utils.drawStringCenteredScaledMaxWidth(
- "Force 100% CC",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 27,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
- Utils.drawStringCenteredScaledMaxWidth((forceCC ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES",
- Minecraft.getMinecraft().fontRendererObj, x + 20, y + 37,
- true, 30, new Color(80, 80, 80).getRGB()
+ (forceCC ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", x + 20, y + 37, true, 30, gray()
);
Utils.drawStringCenteredScaledMaxWidth(
(forceCC ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO",
- Minecraft.getMinecraft().fontRendererObj,
- x + 60,
- y + 37,
- true,
- 30,
- new Color(80, 80, 80).getRGB()
+ x + 60, y + 37, true, 30, gray()
);
- Utils.drawStringCenteredScaledMaxWidth(
- "Force 100% ATKSPEED",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 47,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ Utils.drawStringCenteredScaledMaxWidth("Force 100% ATKSPEED", x + 40, y + 47, false, 70, gray());
Utils.drawStringCenteredScaledMaxWidth(
(forceAS ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES",
- Minecraft.getMinecraft().fontRendererObj,
- x + 20,
- y + 57,
- true,
- 30,
- new Color(80, 80, 80).getRGB()
+ x + 20, y + 57, true, 30, gray()
);
Utils.drawStringCenteredScaledMaxWidth(
(forceAS ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO",
- Minecraft.getMinecraft().fontRendererObj,
- x + 60,
- y + 57,
- true,
- 30,
- new Color(80, 80, 80).getRGB()
+ x + 60, y + 57, true, 30, gray()
);
- Utils.drawStringCenteredScaledMaxWidth(
- "Use God Potion",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 67,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ Utils.drawStringCenteredScaledMaxWidth("Use God Potion", x + 40, y + 67, false, 70, gray());
Utils.drawStringCenteredScaledMaxWidth(
(useGodPot ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES",
- Minecraft.getMinecraft().fontRendererObj,
- x + 20,
- y + 77,
- true,
- 30,
- new Color(80, 80, 80).getRGB()
+ x + 20, y + 77, true, 30, gray()
);
Utils.drawStringCenteredScaledMaxWidth(
(useGodPot ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO",
- Minecraft.getMinecraft().fontRendererObj,
- x + 60,
- y + 77,
- true,
- 30,
- new Color(80, 80, 80).getRGB()
+ x + 60, y + 77, true, 30, gray()
);
- Utils.drawStringCenteredScaledMaxWidth(
- "Use God Potion",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 87,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
+ Utils.drawStringCenteredScaledMaxWidth("Use God Potion", x + 40, y + 87, false, 70, gray());
Utils.drawStringCenteredScaledMaxWidth((allowShaded ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES",
- Minecraft.getMinecraft().fontRendererObj, x + 20, y + 97,
- true, 30, new Color(80, 80, 80).getRGB()
+ x + 20, y + 97, true, 30, gray()
);
Utils.drawStringCenteredScaledMaxWidth((allowShaded ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO",
- Minecraft.getMinecraft().fontRendererObj, x + 60, y + 97,
- true, 30, new Color(80, 80, 80).getRGB()
+ x + 60, y + 97,
+ true, 30, gray()
);
- Utils.drawStringCenteredScaledMaxWidth(
- "Main Weapon",
- Minecraft.getMinecraft().fontRendererObj,
- x + 40,
- y + 107,
- false,
- 70,
- new Color(80, 80, 80).getRGB()
- );
- Utils.drawStringCenteredScaled("1 2 3 4 5 6 7 8 9",
- Minecraft.getMinecraft().fontRendererObj, x + 40, y + 117,
- true, 70, new Color(80, 80, 80).getRGB()
- );
+ Utils.drawStringCenteredScaledMaxWidth("Main Weapon", x + 40, y + 107, false, 70, gray());
+ Utils.drawStringCenteredScaled("1 2 3 4 5 6 7 8 9", x + 40, y + 117, true, 70, gray());
+ }
+
+ private static int gray() {
+ return new Color(80, 80, 80).getRGB();
}
private static Comparator<String> getItemComparator() {
@@ -1018,51 +857,8 @@ public class AccessoryBagOverlay {
}
}
- /*private static void renderAlignedString(String first, String second, float x, float y, int length) {
- FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
-
- if(fontRendererObj.getStringWidth(first + " " + second) >= length) {
- for(int xOff=-2; xOff<=2; xOff++) {
- for(int yOff=-2; yOff<=2; yOff++) {
- if(Math.abs(xOff) != Math.abs(yOff)) {
- Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(first + " " + second), Minecraft.getMinecraft().fontRendererObj,
- x+length/2f+xOff/2f, y+4+yOff/2f, false, length,
- new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB());
- }
- }
- }
-
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawStringCenteredScaledMaxWidth(first + " " + second, Minecraft.getMinecraft().fontRendererObj,
- x+length/2f, y+4, false, length, 4210752);
- } else {
- for(int xOff=-2; xOff<=2; xOff++) {
- for(int yOff=-2; yOff<=2; yOff++) {
- if(Math.abs(xOff) != Math.abs(yOff)) {
- fontRendererObj.drawString(Utils.cleanColourNotModifiers(first),
- x+xOff/2f, y+yOff/2f,
- new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false);
- }
- }
- }
-
- int secondLen = fontRendererObj.getStringWidth(second);
- GlStateManager.color(1, 1, 1, 1);
- fontRendererObj.drawString(first, x, y, 4210752, false);
- for(int xOff=-2; xOff<=2; xOff++) {
- for(int yOff=-2; yOff<=2; yOff++) {
- if(Math.abs(xOff) != Math.abs(yOff)) {
- fontRendererObj.drawString(Utils.cleanColourNotModifiers(second),
- x+length-secondLen+xOff/2f, y+yOff/2f,
- new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false);
- }
- }
- }
-
- GlStateManager.color(1, 1, 1, 1);
- fontRendererObj.drawString(second, x+length-secondLen, y, 4210752, false);
- }
- }*/
+
+
private static final HashMap<String, Pattern> STAT_PATTERN_MAP_BONUS = new HashMap<String, Pattern>() {{
String STAT_PATTERN_BONUS_END = ": (?:\\+|-)[0-9]+(?:\\.[0-9]+)?\\%? \\(((?:\\+|-)[0-9]+)%?";
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
index 87691631..3bd90db8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
@@ -129,11 +129,11 @@ public class CalendarOverlay {
private static final long HOUR = MINUTE * 60;
private static final long DAY = HOUR * 24;
- private static final long DA_OFFSET = 1000 * 60 * 55;
- private static final long JF_OFFSET = 1000 * 60 * 15;
+ private static final long DA_OFFSET = 1000 * 60 * 55; // Dark Auction
+ private static final long JF_OFFSET = 1000 * 60 * 15; // Jacob's Farming Contest
- private static final ItemStack DA_STACK;
- private static final ItemStack JF_STACK;
+ private static final ItemStack DA_STACK; // Dark Auction
+ private static final ItemStack JF_STACK; // Jacob's Farming Contest
static {
NBTTagCompound tag = new NBTTagCompound();
@@ -555,11 +555,11 @@ public class CalendarOverlay {
if (mouseX >= guiLeft + 151 && mouseX <= guiLeft + 151 + 14) {
if (mouseY <= guiTop + 26 + 70) {
Minecraft.getMinecraft().playerController.windowClick(cc.windowId,
- 50, 2, 3, Minecraft.getMinecraft().thePlayer
+ 41, 2, 3, Minecraft.getMinecraft().thePlayer
);
} else {
Minecraft.getMinecraft().playerController.windowClick(cc.windowId,
- 45, 2, 3, Minecraft.getMinecraft().thePlayer
+ 36, 2, 3, Minecraft.getMinecraft().thePlayer
);
}
}
@@ -653,7 +653,7 @@ public class CalendarOverlay {
}
//Special Events
- for (int i = 0; i < 21; i++) {
+ for (int i = 0; i < 14; i++) {
int itemIndex = 10 + i + (i / 7) * 2;
ItemStack item = cc.getLowerChestInventory().getStackInSlot(itemIndex);
if (item == null) continue;
@@ -822,7 +822,7 @@ public class CalendarOverlay {
int startingWidth = fr.getStringWidth(starting);
fr.drawString(starting, Math.max(guiLeft + 23, width / 2f - startingWidth / 2f), y + 7, -1, false);
} else {
- Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Event Starting Now!", fr, width / 2, y + 11, false, -1);
+ Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Event Starting Now!", width / 2, y + 11, false, -1);
}
int displayWidth = fr.getStringWidth(event.display);
@@ -981,7 +981,7 @@ public class CalendarOverlay {
GL11.glDisable(GL11.GL_SCISSOR_TEST);
} else {
if (guiLeft + xSize - 8 - untilLen > (width + displayWidth) / 2) {
- Utils.drawStringCentered(nextEvent.display, fr, width / 2f, guiTop + 10, false, -1);
+ Utils.drawStringCentered(nextEvent.display, width / 2f, guiTop + 10, false, -1);
} else {
fr.drawString(nextEvent.display, guiLeft + 8 + nextSLen, guiTop + 6, -1, false);
}
@@ -1026,7 +1026,7 @@ public class CalendarOverlay {
if (tooltipToDisplay != null) {
drawTimerForeground = true;
GlStateManager.translate(0, 0, 100);
- Utils.drawHoveringText(tooltipToDisplay, mouseX, Math.max(17, mouseY), width, height, -1, fr);
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, Math.max(17, mouseY), width, height, -1);
GlStateManager.translate(0, 0, -100);
}
}
@@ -1117,24 +1117,24 @@ public class CalendarOverlay {
int specialLen = fr.getStringWidth("Special");
fr.drawString("Special", guiLeft + 139 - specialLen, guiTop + 30, 0xffffaa00);
- ItemStack mayorStack = cc.getLowerChestInventory().getStackInSlot(46);
+ ItemStack mayorStack = cc.getLowerChestInventory().getStackInSlot(37);
if (mayorStack != null) {
String mayor = mayorStack.getDisplayName();
float verticalHeight = Utils.getVerticalHeight(mayor);
- Utils.drawStringVertical(mayor, fr, guiLeft + 8, guiTop + 96 - verticalHeight / 2,
+ Utils.drawStringVertical(mayor, guiLeft + 8, guiTop + 96 - verticalHeight / 2,
false, -1
);
}
String calendar = EnumChatFormatting.GREEN + "Calendar";
float calendarHeight = Utils.getVerticalHeight(calendar);
- Utils.drawStringVertical(calendar, fr, guiLeft + xSize - 12, guiTop + 60 - calendarHeight / 2,
+ Utils.drawStringVertical(calendar, guiLeft + xSize - 12, guiTop + 60 - calendarHeight / 2,
false, -1
);
String rewards = EnumChatFormatting.GOLD + "Rewards";
float rewardsHeight = Utils.getVerticalHeight(rewards);
- Utils.drawStringVertical(rewards, fr, guiLeft + xSize - 12, guiTop + 132 - rewardsHeight / 2,
+ Utils.drawStringVertical(rewards, guiLeft + xSize - 12, guiTop + 132 - rewardsHeight / 2,
false, -1
);
@@ -1144,11 +1144,11 @@ public class CalendarOverlay {
tooltipToDisplay = mayorStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
} else if (mouseX >= guiLeft + 151 && mouseX <= guiLeft + 151 + 14) {
if (mouseY <= guiTop + 26 + 70) {
- ItemStack calendarStack = cc.getLowerChestInventory().getStackInSlot(50);
+ ItemStack calendarStack = cc.getLowerChestInventory().getStackInSlot(41);
if (calendarStack != null)
tooltipToDisplay = calendarStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
} else {
- ItemStack rewardsStack = cc.getLowerChestInventory().getStackInSlot(45);
+ ItemStack rewardsStack = cc.getLowerChestInventory().getStackInSlot(36);
if (rewardsStack != null)
tooltipToDisplay = rewardsStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
}
@@ -1244,7 +1244,7 @@ public class CalendarOverlay {
}
//Special Events
- for (int i = 0; i < 21; i++) {
+ for (int i = 0; i < 14; i++) {
int itemIndex = 10 + i + (i / 7) * 2;
ItemStack item = cc.getLowerChestInventory().getStackInSlot(itemIndex);
if (item == null) continue;
@@ -1349,7 +1349,7 @@ public class CalendarOverlay {
tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "In order to show crop types for Jacob's Farming");
tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "contest, visit the full SkyBlock calendar and go all");
tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "the way to the end of the SkyBlock year");
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
tooltipToDisplay = null;
}
}
@@ -1415,7 +1415,7 @@ public class CalendarOverlay {
}
GlStateManager.translate(0, 0, -20);
} else if (tooltipToDisplay != null) {
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
}
GlStateManager.translate(0, 0, -10);
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 6f190ada..6d219999 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java
@@ -36,6 +36,7 @@ import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -146,7 +147,8 @@ public class GuiCustomEnchant extends Gui {
if (costs.size() >= 1) {
if (useMaxLevelForCost) {
- int cost = (maxLevel != null && maxLevel.has(this.enchId) ? maxLevel.get(this.enchId).getAsInt() : costs.size());
+ int cost =
+ (maxLevel != null && maxLevel.has(this.enchId) ? maxLevel.get(this.enchId).getAsInt() : costs.size());
this.xpCost = costs.get(cost - 1).getAsInt();
} else if (level - 1 < costs.size()) {
this.xpCost = costs.get(level - 1).getAsInt();
@@ -600,16 +602,15 @@ public class GuiCustomEnchant extends Gui {
0, X_SIZE / 512f, 0, Y_SIZE / 512f, GL11.GL_NEAREST
);
- Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
- Minecraft.getMinecraft().fontRendererObj.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false);
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
+ fr.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false);
//Page Text
if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) {
String pageStr = "Page: " + currentPage + "/" + expectedMaxPage;
- int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr);
- Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040
- );
+ int pageStrLen = fr.getStringWidth(pageStr);
+ Utils.drawStringCentered(pageStr, guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040);
//Page Arrows
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
@@ -727,12 +728,8 @@ public class GuiCustomEnchant extends Gui {
//Can't be enchanted text
if (currentState == EnchantState.INVALID_ITEM) {
GlStateManager.disableDepth();
- Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555
- );
- Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555
- );
+ Utils.drawStringCentered("This item can't", guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555);
+ Utils.drawStringCentered("be enchanted", guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555);
GlStateManager.enableDepth();
}
@@ -755,52 +752,24 @@ public class GuiCustomEnchant extends Gui {
//Text if no enchants appear
if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) {
if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromApplicable) {
- Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555
- );
- Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555
- );
+ Utils.drawStringCentered("Can't find that", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchant, perhaps", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("it is on", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555);
+ Utils.drawStringCentered("another page?", guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555);
} else if (applicable.isEmpty() && !searchRemovedFromApplicable) {
- Utils.drawStringCentered("No applicable", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555
- );
+ Utils.drawStringCentered("No applicable", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchants on", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("this page...", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555);
}
if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromRemovable) {
- Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555
- );
- Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555
- );
+ Utils.drawStringCentered("Can't find that", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchant, perhaps", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("it is on", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555);
+ Utils.drawStringCentered("another page?", guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555);
} else if (removable.isEmpty() && !searchRemovedFromRemovable) {
- Utils.drawStringCentered("No removable", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555
- );
+ Utils.drawStringCentered("No removable", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchants on", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("this page...", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555);
}
}
//Available enchants (left)
@@ -836,50 +805,14 @@ public class GuiCustomEnchant extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- ench.enchantName,
- guiLeft + 8 + 16 + 2 + textOffset,
- top + 4 + textOffset,
- 0xffffffdd,
- true
- );
+ fr.drawString(ench.enchantName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
@@ -916,53 +849,26 @@ public class GuiCustomEnchant extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(
levelStr,
guiLeft + 256 - levelWidth / 2 + 1,
top + 4,
0x2d2102,
false
);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(ench.enchantName,
- guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true
- );
+ fr.drawString(ench.enchantName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
//Player Inventory Items
- Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory
- .getDisplayName()
- .getUnformattedText(),
+ fr.drawString(
+ Minecraft.getMinecraft().thePlayer.inventory.getDisplayName().getUnformattedText(),
guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040
);
int inventoryStartIndex = cc.getLowerChestInventory().getSizeInventory();
@@ -1003,7 +909,7 @@ public class GuiCustomEnchant extends Gui {
searchField.setPrependText("\u00a77Search...");
} else {
if (searchField.getFocus()) {
- int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(searchField.getTextDisplay()) + 10;
+ int len = fr.getStringWidth(searchField.getTextDisplay()) + 10;
searchField.setSize(Math.max(90, len), 14);
} else {
searchField.setSize(90, 14);
@@ -1041,36 +947,12 @@ public class GuiCustomEnchant extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false);
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false);
//Enchant name
String name = WordUtils.capitalizeFully(ItemUtils
@@ -1085,14 +967,7 @@ public class GuiCustomEnchant extends Gui {
} else if (name.equalsIgnoreCase("Luck of the Sea")) {
name = "Luck of Sea";
}
- Utils.drawStringCentered(
- name,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2,
- top + 8,
- true,
- 0xffffffdd
- );
+ Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd);
if (isChangingEnchLevel) {
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
@@ -1105,42 +980,12 @@ public class GuiCustomEnchant extends Gui {
//Enchant level
levelStr = "" + enchanterCurrentEnch.level;
if (enchanterCurrentEnch.xpCost < 0) levelStr = "?";
- levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4,
- 0xea82ff,
- false
- );
+ levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4, 0xea82ff, false);
//Confirm button
@@ -1160,18 +1005,14 @@ public class GuiCustomEnchant extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040
- );
+ Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040);
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
GlStateManager.color(1, 1, 1, 1);
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040
- );
+ Utils.drawStringCentered(confirmText, guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040);
if (playerXpLevel < enchanterCurrentEnch.xpCost) {
Gui.drawRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, guiLeft + X_SIZE / 2 - 1, top + 18 + 14, 0x80000000);
@@ -1185,18 +1026,14 @@ public class GuiCustomEnchant extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040
- );
+ Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040);
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
GlStateManager.color(1, 1, 1, 1);
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040
- );
+ Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040);
}
if (mouseY > top + 18 && mouseY <= top + 18 + 16) {
@@ -1269,42 +1106,12 @@ public class GuiCustomEnchant extends Gui {
);
levelStr = "" + ench.level;
- levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 - 1,
- top + 16 * yIndex + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 + 1,
- top + 16 * yIndex + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 16 * yIndex + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 16 * yIndex + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 16 * yIndex + 4,
- 0xea82ff,
- false
- );
+ levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 16 * yIndex + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 16 * yIndex + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4, 0xea82ff, false);
}
GlStateManager.enableDepth();
}
@@ -1380,9 +1187,7 @@ public class GuiCustomEnchant extends Gui {
Utils.drawItemStack(stackOnMouse, mouseX - 8, mouseY - 8);
}
} else if (tooltipToDisplay != null) {
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
}
GlStateManager.translate(0, 0, -300);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
index 5053ae70..41208681 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
@@ -31,7 +31,6 @@ import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
@@ -132,7 +131,6 @@ public class GuiEnchantColour extends GuiScreen {
Utils.drawStringCentered(
"Add Ench Colour",
- fontRendererObj,
guiLeft + xSize / 2 + 1,
guiTop + ySize - 20,
false,
@@ -156,7 +154,7 @@ public class GuiEnchantColour extends GuiScreen {
if (colourCode.length() > 1) colourCode = String.valueOf(colourCode.toLowerCase().charAt(0));
if (comparator.length() > 1) comparator = String.valueOf(comparator.toLowerCase().charAt(0));
- Utils.drawStringCentered(comparator, fontRendererObj, guiLeft + 96, guiTop + 33 + 25 * yIndex, false, 4210752);
+ Utils.drawStringCentered(comparator, guiLeft + 96, guiTop + 33 + 25 * yIndex, false, 4210752);
if (guiElementTextFields.size() <= yIndex) {
guiElementTextFields.add(new GuiElementTextField[3]);
@@ -226,7 +224,6 @@ public class GuiEnchantColour extends GuiScreen {
yIndex++;
}
renderSideBar(mouseX, mouseY, partialTicks);
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
List<String> tooltipToDisplay = null;
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(help);
@@ -275,13 +272,13 @@ public class GuiEnchantColour extends GuiScreen {
if (mouseY >= guiTopSidebar - 34 && mouseY <= guiTopSidebar - 18 && maxedBookFound == 1) {
tooltipToDisplay = maxedBook.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
tooltipToDisplay = null;
renderingTooltip = true;
}
if (mouseY >= guiTopSidebar - 52 && mouseY <= guiTopSidebar - 34 && maxedAttBookFound == 1 && !renderingTooltip) {
tooltipToDisplay = maxedAttBook.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
tooltipToDisplay = null;
renderingTooltip = true;
}
@@ -326,7 +323,7 @@ public class GuiEnchantColour extends GuiScreen {
EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + "I" + EnumChatFormatting.RESET +
EnumChatFormatting.GRAY + " = " + EnumChatFormatting.ITALIC + "Italic"
);
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
tooltipToDisplay = null;
}
}
@@ -390,7 +387,6 @@ public class GuiEnchantColour extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"Load preset",
- fontRendererObj,
guiLeft + xSize + 4 + 44,
guiTopSidebar + 8,
false,
@@ -399,7 +395,6 @@ public class GuiEnchantColour extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"from Clipboard",
- fontRendererObj,
guiLeft + xSize + 4 + 44,
guiTopSidebar + 16,
false,
@@ -408,7 +403,6 @@ public class GuiEnchantColour extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"Save preset",
- fontRendererObj,
guiLeft + xSize + 4 + 44,
guiTopSidebar + 8 + 24,
false,
@@ -417,7 +411,6 @@ public class GuiEnchantColour extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"to Clipboard",
- fontRendererObj,
guiLeft + xSize + 4 + 44,
guiTopSidebar + 16 + 24,
false,
@@ -426,7 +419,6 @@ public class GuiEnchantColour extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"Reset Config",
- fontRendererObj,
guiLeft + xSize + 4 + 44,
guiTopSidebar + 12 + 24 * 2,
false,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
index d97227cf..147bf567 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java
@@ -411,7 +411,6 @@ public class GuiInvButtonEditor extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"Load preset",
- fontRendererObj,
guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0),
guiTop + 8,
false,
@@ -420,7 +419,6 @@ public class GuiInvButtonEditor extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"from Clipboard",
- fontRendererObj,
guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0),
guiTop + 16,
false,
@@ -429,7 +427,6 @@ public class GuiInvButtonEditor extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"Save preset",
- fontRendererObj,
guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0),
guiTop + 8 + 24,
false,
@@ -438,7 +435,6 @@ public class GuiInvButtonEditor extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"to Clipboard",
- fontRendererObj,
guiLeft - 44 - 2 - 22 - (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ? 25 : 0),
guiTop + 16 + 24,
false,
@@ -459,7 +455,6 @@ public class GuiInvButtonEditor extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"\u00a7nPresets",
- fontRendererObj,
guiLeft + xSize + 22 + 40,
guiTop + 10,
false,
@@ -471,7 +466,6 @@ public class GuiInvButtonEditor extends GuiScreen {
for (String presetName : presets.keySet()) {
Utils.drawStringCenteredScaledMaxWidth(
presetName,
- fontRendererObj,
guiLeft + xSize + 22 + 40,
guiTop + 25 + 10 * (index++),
false,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
index 129699da..d9b24895 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
@@ -53,8 +53,10 @@ public class GuiItemCustomize extends GuiScreen {
private static final ResourceLocation RESET = new ResourceLocation("notenoughupdates:itemcustomize/reset.png");
private final ItemStack stack;
+ private ItemStack customItemStack;
private final String itemUUID;
private final GuiElementTextField textFieldRename = new GuiElementTextField("", 158, 20, GuiElementTextField.COLOUR);
+ private final GuiElementTextField textFieldCustomItem = new GuiElementTextField("", 180, 20, GuiElementTextField.COLOUR);
private final GuiElementBoolean enchantGlintButton;
private int renderHeight = 0;
@@ -65,13 +67,15 @@ public class GuiItemCustomize extends GuiScreen {
private String customGlintColour = null;
private String customLeatherColour = null;
- private final boolean supportCustomLeatherColour;
+ private boolean supportCustomLeatherColour;
+ private String lastCustomItem = "";
private GuiElement editor = null;
public GuiItemCustomize(ItemStack stack, String itemUUID) {
this.stack = stack;
this.itemUUID = itemUUID;
+ this.customItemStack = copy(stack);
IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(stack);
boolean stackHasEffect = stack.hasEffect() && !model.isBuiltInRenderer();
@@ -82,14 +86,20 @@ public class GuiItemCustomize extends GuiScreen {
if (data.customName != null) {
textFieldRename.setText(data.customName);
}
+ if (data.customItem != null && data.customItem.length() > 0) {
+ textFieldCustomItem.setText(data.customItem);
+ } else {
+ textFieldCustomItem.setText(stack.getItem().getRegistryName().replace("minecraft:", ""));
+ }
this.customGlintColour = data.customGlintColour;
this.customLeatherColour = data.customLeatherColour;
} else {
this.enchantGlint = stackHasEffect;
+ textFieldCustomItem.setText(stack.getItem().getRegistryName().replace("minecraft:", ""));
}
- supportCustomLeatherColour = stack.getItem() instanceof ItemArmor &&
- ((ItemArmor) stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER;
+ supportCustomLeatherColour = customItemStack.getItem() instanceof ItemArmor &&
+ ((ItemArmor) customItemStack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER;
enchantGlintCustomColourAnimation.setValue(enchantGlint ? 17 : 0);
this.enchantGlintButton = new GuiElementBoolean(0, 0, () -> enchantGlint, (bool) -> {
@@ -105,7 +115,7 @@ public class GuiItemCustomize extends GuiScreen {
}
public String getChromaStrFromLeatherColour() {
- return ChromaColour.special(0, 0xff, ((ItemArmor) stack.getItem()).getColor(stack));
+ return ChromaColour.special(0, 0xff, ((ItemArmor) customItemStack.getItem()).getColor(customItemStack));
}
public void updateData() {
@@ -114,6 +124,9 @@ public class GuiItemCustomize extends GuiScreen {
IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(stack);
boolean stackHasEffect = stack.hasEffect() && !model.isBuiltInRenderer();
+ this.customItemStack = copy(stack);
+ data.defaultItem = stack.getItem().getRegistryName();
+
if (this.enchantGlint != stackHasEffect) {
data.overrideEnchantGlint = true;
data.enchantGlintValue = this.enchantGlint;
@@ -127,8 +140,8 @@ public class GuiItemCustomize extends GuiScreen {
data.customGlintColour = null;
}
- if (supportCustomLeatherColour && this.customLeatherColour != null && !this.customLeatherColour.equals(
- getChromaStrFromLeatherColour())) {
+ if (this.customLeatherColour != null && (!(customItemStack.getItem() instanceof ItemArmor) || !this.customLeatherColour.equals(
+ getChromaStrFromLeatherColour()))) {
data.customLeatherColour = this.customLeatherColour;
} else {
data.customLeatherColour = null;
@@ -157,9 +170,22 @@ public class GuiItemCustomize extends GuiScreen {
}
}
+ if (!this.textFieldCustomItem.getText().isEmpty()) {
+ data.customItem = this.textFieldCustomItem.getText();
+ }
+
ItemCustomizeManager.putItemData(itemUUID, data);
}
+ private ItemStack copy(ItemStack stack) {
+ ItemStack customStack = stack.copy();
+ if (!this.textFieldCustomItem.getText().isEmpty()) {
+ customStack.setItem(ItemCustomizeManager.getCustomItem(stack, this.textFieldCustomItem.getText().trim()));
+ customStack.setItemDamage(ItemCustomizeManager.getCustomItemDamage(stack));
+ }
+ return customStack;
+ }
+
private int getGlintColour() {
int col = customGlintColour == null
? ChromaColour.specialToChromaRGB(ItemCustomizeManager.DEFAULT_GLINT_COLOR)
@@ -171,7 +197,7 @@ public class GuiItemCustomize extends GuiScreen {
if (!supportCustomLeatherColour) return 0xff000000;
int col =
- customLeatherColour == null ? ((ItemArmor) stack.getItem()).getColor(stack) : ChromaColour.specialToChromaRGB(
+ customLeatherColour == null ? ((ItemArmor) customItemStack.getItem()).getColor(customItemStack) : ChromaColour.specialToChromaRGB(
customLeatherColour);
return 0xff000000 | col;
}
@@ -188,7 +214,7 @@ public class GuiItemCustomize extends GuiScreen {
int yTopStart = (scaledResolution.getScaledHeight() - renderHeight) / 2;
int yTop = yTopStart;
- RenderUtils.drawFloatingRectDark(xCenter - 100, yTop - 9, 200, renderHeight + 11);
+ RenderUtils.drawFloatingRectDark(xCenter - 100, yTop - 9, 200, renderHeight + 33);
RenderUtils.drawFloatingRectDark(xCenter - 90, yTop - 5, 180, 14);
Utils.renderShadowedString("\u00a75\u00a7lNEU Item Customizer", xCenter, yTop - 1, 180);
@@ -211,6 +237,7 @@ public class GuiItemCustomize extends GuiScreen {
}
textFieldRename.render(xCenter - textFieldRename.getWidth() / 2 - 10, yTop);
+ int yTopText = yTop;
Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.help);
GlStateManager.color(1, 1, 1, 1);
@@ -260,7 +287,8 @@ public class GuiItemCustomize extends GuiScreen {
GlStateManager.pushMatrix();
GlStateManager.translate(xCenter - 48, yTop + 7, 0);
GlStateManager.scale(6, 6, 1);
- Utils.drawItemStack(stack, 0, 0);
+ this.customItemStack = copy(stack);
+ Utils.drawItemStack(customItemStack, 0, 0);
GlStateManager.popMatrix();
yTop += 115;
@@ -308,6 +336,9 @@ public class GuiItemCustomize extends GuiScreen {
yTop += enchantGlintCustomColourAnimation.getValue() + 3;
}
+ supportCustomLeatherColour = customItemStack.getItem() instanceof ItemArmor &&
+ ((ItemArmor) customItemStack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER;
+
if (supportCustomLeatherColour) {
int leatherColour = getLeatherColour();
@@ -348,6 +379,32 @@ public class GuiItemCustomize extends GuiScreen {
}*/
+ if (!lastCustomItem.equals(textFieldCustomItem.getText())) {
+ updateData();
+ }
+ lastCustomItem = textFieldCustomItem.getText();
+
+ if (!textFieldCustomItem.getFocus() && textFieldCustomItem.getText().isEmpty()) {
+ textFieldCustomItem.setOptions(GuiElementTextField.SCISSOR_TEXT);
+ textFieldCustomItem.setPrependText("\u00a77Enter Custom Item ID...");
+ } else {
+ textFieldCustomItem.setOptions(GuiElementTextField.COLOUR | GuiElementTextField.SCISSOR_TEXT);
+ textFieldCustomItem.setPrependText("");
+ }
+
+ if (!textFieldCustomItem.getFocus()) {
+ textFieldCustomItem.setSize(180, 20);
+ } else {
+ int textSize = fontRendererObj.getStringWidth(textFieldCustomItem.getTextDisplay()) + 10;
+ textFieldCustomItem.setSize(Math.max(textSize, 180), 20);
+ }
+
+ int offset = 200;
+ if (!supportCustomLeatherColour) offset -= 20;
+ if (!enchantGlint) offset -= 16;
+
+ textFieldCustomItem.render(xCenter - textFieldCustomItem.getWidth() / 2 - 10 + 11, yTopText + offset);
+
renderHeight = yTop - yTopStart;
if (editor != null) {
@@ -355,7 +412,7 @@ public class GuiItemCustomize extends GuiScreen {
}
if (tooltipToDisplay != null) {
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fontRendererObj);
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
}
super.drawScreen(mouseX, mouseY, partialTicks);
@@ -389,6 +446,16 @@ public class GuiItemCustomize extends GuiScreen {
}
}
+ if (textFieldCustomItem.getFocus()) {
+ updateData();
+ if (keyCode == Keyboard.KEY_ESCAPE) {
+ textFieldCustomItem.setFocus(false);
+ return;
+ } else {
+ textFieldCustomItem.keyTyped(typedChar, keyCode);
+ }
+ }
+
super.keyTyped(typedChar, keyCode);
}
@@ -417,6 +484,7 @@ public class GuiItemCustomize extends GuiScreen {
@Override
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
textFieldRename.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
+ textFieldCustomItem.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
}
@Override
@@ -433,6 +501,18 @@ public class GuiItemCustomize extends GuiScreen {
textFieldRename.unfocus();
}
+ int offset = 200;
+ if (!supportCustomLeatherColour) offset -= 20;
+ if (!enchantGlint) offset -= 18;
+
+ if (mouseX >= xCenter - textFieldCustomItem.getWidth() / 2 - 10 + 11 &&
+ mouseX <= xCenter + textFieldCustomItem.getWidth() / 2 - 10 + 11 &&
+ mouseY >= yTop + offset + 14 && mouseY <= yTop + offset + 14 + textFieldCustomItem.getHeight()) {
+ textFieldCustomItem.mouseClicked(mouseX, mouseY, mouseButton);
+ } else {
+ textFieldCustomItem.unfocus();
+ }
+
if (enchantGlint && mouseX >= xCenter - 90 && mouseX <= xCenter + 90 &&
mouseY >= yTop + 174 && mouseY <= yTop + 174 + enchantGlintCustomColourAnimation.getValue()) {
if (mouseX >= xCenter + 90 - 12) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
index e81834d3..3627a94e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
@@ -29,7 +29,6 @@ import io.github.moulberry.notenoughupdates.recipes.RecipeSlot;
import io.github.moulberry.notenoughupdates.recipes.RecipeType;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
@@ -127,7 +126,6 @@ public class GuiItemRecipe extends GuiScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
- FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
@@ -150,7 +148,6 @@ public class GuiItemRecipe extends GuiScreen {
Utils.drawStringScaledMaxWidth(
currentRecipe.getTitle(),
- fontRendererObj,
guiLeft + TITLE_X,
guiTop + TITLE_Y,
false,
@@ -165,12 +162,7 @@ public class GuiItemRecipe extends GuiScreen {
if (slot.getItemStack() == null) continue;
Utils.drawHoveringText(
slot.getItemStack().getTooltip(Minecraft.getMinecraft().thePlayer, false),
- mouseX,
- mouseY,
- width,
- height,
- -1,
- fontRendererObj
+ mouseX, mouseY, width, height, -1
);
}
}
@@ -195,7 +187,7 @@ public class GuiItemRecipe extends GuiScreen {
"" + EnumChatFormatting.RESET + EnumChatFormatting.GREEN + type.getLabel(),
"" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + craftingRecipes.get(type).size() + " Recipes"
),
- mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj
+ mouseX, mouseY, width, height, -1
);
return;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java
index 35c80579..ba3f95df 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiNavigation.java
@@ -104,7 +104,6 @@ public class GuiNavigation extends GuiScreen {
);
Utils.drawStringF(
json.get("displayname").getAsString(),
- Minecraft.getMinecraft().fontRendererObj,
baseX + TEXT_OFFSET_X,
baseY + LIST_OFFSET_Y / 2F - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2F,
false,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
index eb6aa956..c03a72a6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
@@ -139,20 +139,16 @@ public class GuiPriceGraph extends GuiScreen {
if (itemName != null && itemStack != null) {
Utils.drawItemStack(itemStack, guiLeft + 16, guiTop + 11);
- Utils.drawStringScaledMax(itemName, Minecraft.getMinecraft().fontRendererObj, guiLeft + 35, guiTop + 13, false,
+ Utils.drawStringScaledMax(itemName, guiLeft + 35, guiTop + 13, false,
0xffffff, 1.77f, 208
);
}
if (!loaded)
- Utils.drawStringCentered("Loading...", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 166, guiTop + 116, false, 0xffffff00
- );
+ Utils.drawStringCentered("Loading...", guiLeft + 166, guiTop + 116, false, 0xffffff00);
else if (
itemData == null || itemData.get() == null || itemData.get().size() <= 1)
- Utils.drawStringCentered("No data found.", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 166, guiTop + 116, false, 0xffff0000
- );
+ Utils.drawStringCentered("No data found.", guiLeft + 166, guiTop + 116, false, 0xffff0000);
else {
int graphColor = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.ahGraph.graphColor);
int graphColor2 = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.ahGraph.graphColor2);
@@ -226,9 +222,7 @@ public class GuiPriceGraph extends GuiScreen {
if (num != prevNum) {
int xPos = (int) map(time, firstTime, lastTime, guiLeft + 17, guiLeft + 315);
if (Math.abs(prevXPos - xPos) > 30) {
- Utils.drawStringCentered(String.valueOf(num), Minecraft.getMinecraft().fontRendererObj,
- xPos, guiTop + 206, false, 0x8b8b8b
- );
+ Utils.drawStringCentered(String.valueOf(num), xPos, guiTop + 206, false, 0x8b8b8b);
prevXPos = xPos;
}
prevNum = num;
@@ -237,10 +231,9 @@ public class GuiPriceGraph extends GuiScreen {
for (int i = 0; i <= 6; i++) {
long price = (long) map(i, 0, 6, highestValue, lowestValue);
String formattedPrice = formatPrice(price);
- Utils.drawStringF(formattedPrice, Minecraft.getMinecraft().fontRendererObj, guiLeft + 320,
+ Utils.drawStringF(formattedPrice, guiLeft + 320,
(float) map(i, 0, 6, guiTop + 35, guiTop + 198)
- - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2f,
- false, 0x8b8b8b
+ - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2f, false, 0x8b8b8b
);
}
if (customSelecting) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
index 8ee68457..648345bf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
@@ -25,7 +25,6 @@ import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -40,6 +39,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
+
@NEUAutoSubscribe
public class InventoryStorageSelector {
private static final InventoryStorageSelector INSTANCE = new InventoryStorageSelector();
@@ -266,7 +266,6 @@ public class InventoryStorageSelector {
int width = scaledResolution.getScaledWidth();
int height = scaledResolution.getScaledHeight();
- FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
int centerX = width / 2;
int offset = 91 + 10 + 12;
@@ -439,32 +438,18 @@ public class InventoryStorageSelector {
Utils.drawItemStack(held, centerX - 8, startY - 8);
GlStateManager.translate(0, 0, 100);
- Utils.drawStringCentered(pageTitle, fontRendererObj, centerX, height - 76, true, 0xffff0000);
+ Utils.drawStringCentered(pageTitle, centerX, height - 76, true, 0xffff0000);
int keyCode = NotEnoughUpdates.INSTANCE.config.storageGUI.backpackScrollKey;
if (KeybindHelper.isKeyValid(keyCode) && !KeybindHelper.isKeyDown(keyCode)) {
String keyName = KeybindHelper.getKeyName(keyCode);
- Utils.drawStringCentered(
- "[" + keyName + "] Scroll Backpacks",
- fontRendererObj,
- centerX,
- startY - 10,
- true,
- 0xff32CD32
- );
+ Utils.drawStringCentered("[" + keyName + "] Scroll Backpacks", centerX, startY - 10, true, 0xff32CD32);
}
GlStateManager.translate(0, 0, -200);
} else if (page == null) {
- Utils.drawStringCentered(
- "Run /storage to enable this feature!",
- fontRendererObj,
- centerX,
- height - 80,
- true,
- 0xffff0000
- );
+ Utils.drawStringCentered("Run /storage to enable this feature!", centerX, height - 80, true, 0xffff0000);
} else {
- Utils.drawStringCentered("Right-click to load items", fontRendererObj, centerX, height - 80, true, 0xffff0000);
+ Utils.drawStringCentered("Right-click to load items", centerX, height - 80, true, 0xffff0000);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
index 288c3926..c2908807 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
@@ -95,11 +95,10 @@ public class KatSitterOverlay {
) : currentWidth);
GlStateManager.disableLighting();
GlStateManager.color(1F, 1F, 1F, 1F);
- Utils.drawStringScaled(currentText, font, left, ((AccessorGuiContainer) gui).getGuiTop() + 25, false, 0xFFD700, 1F);
+ Utils.drawStringScaled(currentText, left, ((AccessorGuiContainer) gui).getGuiTop() + 25, false, 0xFFD700, 1F);
if (upgradedLevel != null)
Utils.drawStringScaled(
upgradedText,
- font,
left,
((AccessorGuiContainer) gui).getGuiTop() + 45,
false,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java
index ac96f527..30907836 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java
@@ -74,14 +74,7 @@ public class NEUOverlayPlacements extends GuiScreen {
drawRect((width - 176) / 2, (height - 166) / 2,
(width + 176) / 2, (height + 166) / 2, new Color(100, 100, 100, 200).getRGB()
);
- Utils.drawStringCentered(
- GOLD + "Inventory",
- Minecraft.getMinecraft().fontRendererObj,
- width / 2f,
- height / 2f,
- false,
- 0
- );
+ Utils.drawStringCentered(GOLD + "Inventory", width / 2f, height / 2f, false, 0);
MBGuiGroupFloating mainGroup = NotEnoughUpdates.INSTANCE.overlay.guiGroup;
mainGroup.render(0, 0);
@@ -145,7 +138,8 @@ public class NEUOverlayPlacements extends GuiScreen {
}
if (anchorPoint.inventoryRelative) {
- Utils.drawStringCentered(GOLD + "Inv-Relative", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(
+ GOLD + "Inv-Relative",
position.x + element.getWidth() * 0.5f, position.y + element.getHeight() * 0.5f, false, 0
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
index 4f01e551..31331ab3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
@@ -32,8 +32,8 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import java.text.DecimalFormat;
import java.math.BigDecimal;
+import java.text.DecimalFormat;
import java.util.Objects;
@NEUAutoSubscribe
@@ -62,14 +62,7 @@ public class SignCalculator {
int calculationMode = NotEnoughUpdates.INSTANCE.config.misc.calculationMode;
if ((calculationMode == 1 && !source.startsWith("!"))) return;
- Utils.drawStringCentered(
- getRenderedString(),
- Minecraft.getMinecraft().fontRendererObj,
- guiEditSign.width / 2F,
- 58,
- false,
- 0x808080FF
- );
+ Utils.drawStringCentered(getRenderedString(), guiEditSign.width / 2F, 58, false, 0x808080FF);
}
@SubscribeEvent
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 5dd8bd9c..ff1d8687 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
@@ -862,11 +862,11 @@ public class StorageOverlay extends GuiElement {
Gui.drawRect(storageX, storageY, storageX + 162, storageY + h, 0x80000000);
if (storageId < 9) {
- Utils.drawStringCenteredScaledMaxWidth("Locked Page", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Locked Page",
storageX + 81, storageY + h / 2, true, 150, 0xd94c00
);
} else {
- Utils.drawStringCenteredScaledMaxWidth("Empty Backpack Slot", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Empty Backpack Slot",
storageX + 81, storageY + h / 2, true, 150, 0xd94c00
);
}
@@ -889,7 +889,7 @@ public class StorageOverlay extends GuiElement {
Gui.drawRect(storageX, storageY, storageX + 162, storageY + h, 0x80000000);
- Utils.drawStringCenteredScaledMaxWidth("Click to load items", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Click to load items",
storageX + 81, storageY + h / 2, true, 150, 0xffdf00
);
} else {
@@ -1233,35 +1233,35 @@ public class StorageOverlay extends GuiElement {
if (StorageManager.getInstance().desiredStoragePage == storageId &&
StorageManager.getInstance().onStorageMenu) {
- Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Please click again to load...",
storageX + 81 - 1, storageY + storageH / 2 - 5, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Please click again to load...",
storageX + 81 + 1, storageY + storageH / 2 - 5, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Please click again to load...",
storageX + 81, storageY + storageH / 2 - 5 - 1, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Please click again to load...",
storageX + 81, storageY + storageH / 2 - 5 + 1, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Please click again to load...", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Please click again to load...",
storageX + 81, storageY + storageH / 2 - 5, false, 150, 0xffdf00
);
- Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info",
storageX + 81 - 1, storageY + storageH / 2 + 5, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info",
storageX + 81 + 1, storageY + storageH / 2 + 5, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info",
storageX + 81, storageY + storageH / 2 + 5 - 1, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info",
storageX + 81, storageY + storageH / 2 + 5 + 1, false, 150, 0x111111
);
- Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info", fontRendererObj,
+ Utils.drawStringCenteredScaledMaxWidth("Use /neustwhy for more info",
storageX + 81, storageY + storageH / 2 + 5, false, 150, 0xffdf00
);
}
@@ -1685,26 +1685,10 @@ public class StorageOverlay extends GuiElement {
}
GlStateManager.translate(0, 0, -100);
} else {
- Utils.drawHoveringText(
- tooltipToDisplay,
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
}
} else if (tooltipToDisplay != null) {
- Utils.drawHoveringText(
- tooltipToDisplay,
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
} else {
allowTypingInSearchBar = true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
index 16b5015b..6d565bb3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
@@ -107,7 +107,6 @@ public class TradeWindow {
for (int yOff = -2; yOff <= 2; yOff++) {
if (Math.abs(xOff) != Math.abs(yOff)) {
Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(str),
- Minecraft.getMinecraft().fontRendererObj,
x + xOff / 2f, y + yOff / 2f, false, len,
new Color(20, 20, 20, 100 / Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB()
);
@@ -115,11 +114,7 @@ public class TradeWindow {
}
}
- Utils.drawStringCenteredScaledMaxWidth(str,
- Minecraft.getMinecraft().fontRendererObj,
- x, y, false, len,
- new Color(64, 64, 64, 255).getRGB()
- );
+ Utils.drawStringCenteredScaledMaxWidth(str, x, y, false, len, new Color(64, 64, 64, 255).getRGB());
}
private static long getPrice(String internalName) {
@@ -567,14 +562,12 @@ public class TradeWindow {
Utils.drawTexturedRect(guiLeft, guiTop, xSize, ySize, 0, 176 / 256f, 0, 204 / 256f, GL11.GL_NEAREST);
Utils.drawStringF(new ChatComponentTranslation("container.inventory").getUnformattedText(),
- Minecraft.getMinecraft().fontRendererObj, guiLeft + 8, guiTop + 111, false, 4210752
- );
- Utils.drawStringF("You", Minecraft.getMinecraft().fontRendererObj, guiLeft + 8,
- guiTop + 5, false, 4210752
+ guiLeft + 8, guiTop + 111, false, 4210752
);
+ Utils.drawStringF("You", guiLeft + 8, guiTop + 5, false, 421752);
String[] split = containerName.split(" ");
if (split.length >= 1) {
- Utils.drawStringF(split[split.length - 1], Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringF(split[split.length - 1],
guiLeft + 167 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length - 1]),
guiTop + 5, false, 4210752
);
@@ -692,31 +685,19 @@ public class TradeWindow {
Utils.drawStringCentered(
EnumChatFormatting.DARK_RED + "Check " + EnumChatFormatting.BOLD + (char) (9311 + num),
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 56,
- guiTop + 99,
+ guiLeft + 56, guiTop + 99,
false,
4210752
);
} else if (confirmDisplay.equals(EnumChatFormatting.AQUA + "Gift!")) {
- Utils.drawStringCentered(
- EnumChatFormatting.GREEN + "Accept",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 56,
- guiTop + 99,
- true,
- 4210752
- );
+ Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accept", guiLeft + 56, guiTop + 99, true, 4210752);
} else if (confirmDisplay.equals(EnumChatFormatting.GREEN + "Deal accepted!")) {
- Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accepted", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 56, guiTop + 99, true, 4210752
- );
+ Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accepted", guiLeft + 56, guiTop + 99, true, 4210752);
} else if (lastTradeMillis > 0) {
long delta = System.currentTimeMillis() - lastTradeMillis;
if (delta > 2000) {
Utils.drawStringCentered(
EnumChatFormatting.GREEN + "Accept",
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 56,
guiTop + 99,
true,
@@ -725,7 +706,6 @@ public class TradeWindow {
} else {
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "Trade " + EnumChatFormatting.BOLD + (char) (9312 + (2000 - delta) / 1000),
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 56,
guiTop + 99,
true,
@@ -735,7 +715,6 @@ public class TradeWindow {
} else {
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "Trade " + EnumChatFormatting.BOLD + (char) (9314),
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 56,
guiTop + 99,
true,
@@ -764,32 +743,11 @@ public class TradeWindow {
);
if (confirmDisplay.equals(EnumChatFormatting.YELLOW + "Pending their confirm")) {
- Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Pending",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 120,
- guiTop + 99,
- true,
- 4210752
- );
+ Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Pending", guiLeft + 120, guiTop + 99, true, 4210752);
} else if (confirmDisplay.equals(EnumChatFormatting.YELLOW + "Deal timer...")) {
- Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Pending",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 120,
- guiTop + 99,
- true,
- 4210752
- );
+ Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Pending", guiLeft + 120, guiTop + 99, true, 4210752);
} else if (confirmDisplay.equals(EnumChatFormatting.GREEN + "Other player confirmed!")) {
- Utils.drawStringCentered(
- EnumChatFormatting.GREEN + "Accepted",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 120,
- guiTop + 99,
- true,
- 4210752
- );
+ Utils.drawStringCentered(EnumChatFormatting.GREEN + "Accepted", guiLeft + 120, guiTop + 99, true, 4210752);
}
}
@@ -1041,8 +999,7 @@ public class TradeWindow {
mouseY,
scaledResolution.getScaledWidth(),
scaledResolution.getScaledHeight(),
- tooltipLen,
- Minecraft.getMinecraft().fontRendererObj
+ tooltipLen
);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
index e13934e1..e8653d53 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TrophyRewardOverlay.java
@@ -23,9 +23,11 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -97,6 +99,21 @@ public class TrophyRewardOverlay {
return line.get(1);
}
+ @SubscribeEvent
+ public void onButtonExclusionZones(ButtonExclusionZoneEvent event) {
+ if (inTrophyFishingInventory()) {
+ event.blockArea(
+ new Rectangle(
+ event.getGuiBaseRect().getRight(),
+ event.getGuiBaseRect().getTop(),
+ 168 /*width*/ + 4 /*space*/,
+ 128
+ ),
+ ButtonExclusionZoneEvent.PushDirection.TOWARDS_RIGHT
+ );
+ }
+ }
+
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!inTrophyFishingInventory()) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
index 4dbe7f94..deef7bdc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
@@ -37,6 +37,7 @@ import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -539,7 +540,8 @@ public class GuiCustomHex extends Gui {
if (enchanterCurrentEnch == null) {
enchanterCurrentEnch = enchantment;
} else if (updateLevel) {
- if (removingEnchantPlayerLevel < 0 && enchantment.level > enchanterCurrentEnch.level && !aboveMaxLevelFromEt) {
+ if (removingEnchantPlayerLevel < 0 && enchantment.level > enchanterCurrentEnch.level &&
+ !aboveMaxLevelFromEt) {
enchanterCurrentEnch = enchantment;
} else if (removingEnchantPlayerLevel >= 0 && enchantment.level < enchanterCurrentEnch.level) {
enchanterCurrentEnch = enchantment;
@@ -1286,14 +1288,15 @@ public class GuiCustomHex extends Gui {
renderBaseTexture();
- Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
- Minecraft.getMinecraft().fontRendererObj.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false);
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
+ fr.drawString("Removable", guiLeft + 247, guiTop + 7, 0x404040, false);
//Page Text
if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) {
String pageStr = "Page: " + currentPage + "/" + expectedMaxPage;
- int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr);
- Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj,
+ int pageStrLen = fr.getStringWidth(pageStr);
+ Utils.drawStringCentered(pageStr,
guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040
);
@@ -1318,10 +1321,10 @@ public class GuiCustomHex extends Gui {
//Can't be enchanted text
if (currentState == EnchantState.INVALID_ITEM) {
GlStateManager.disableDepth();
- Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("This item can't",
guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555
);
- Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("be enchanted",
guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555
);
GlStateManager.enableDepth();
@@ -1332,52 +1335,24 @@ public class GuiCustomHex extends Gui {
//Text if no enchants appear
if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) {
if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromApplicable) {
- Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555
- );
- Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555
- );
+ Utils.drawStringCentered("Can't find that", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchant, perhaps", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("it is on", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555);
+ Utils.drawStringCentered("another page?", guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555);
} else if (applicable.isEmpty() && !searchRemovedFromApplicable) {
- Utils.drawStringCentered("No applicable", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555
- );
+ Utils.drawStringCentered("No applicable", guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchants on", guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("this page...", guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555);
}
if (applicable.isEmpty() && removable.isEmpty() && searchRemovedFromRemovable) {
- Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555
- );
- Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555
- );
+ Utils.drawStringCentered("Can't find that", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchant, perhaps", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("it is on", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555);
+ Utils.drawStringCentered("another page?", guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555);
} else if (removable.isEmpty() && !searchRemovedFromRemovable) {
- Utils.drawStringCentered("No removable", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555
- );
- Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555
- );
- Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555
- );
+ Utils.drawStringCentered("No removable", guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555);
+ Utils.drawStringCentered("enchants on", guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555);
+ Utils.drawStringCentered("this page...", guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555);
}
}
//Available enchants (left)
@@ -1413,50 +1388,14 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- ench.enchantName,
- guiLeft + 8 + 16 + 2 + textOffset,
- top + 4 + textOffset,
- 0xffffffdd,
- true
- );
+ fr.drawString(ench.enchantName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
@@ -1493,51 +1432,19 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(ench.enchantName,
- guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true
- );
+ fr.drawString(ench.enchantName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
//Player Inventory Items
- Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory
+ fr.drawString(Minecraft.getMinecraft().thePlayer.inventory
.getDisplayName()
.getUnformattedText(),
guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040
@@ -1580,7 +1487,7 @@ public class GuiCustomHex extends Gui {
searchField.setPrependText("\u00a77Search...");
} else {
if (searchField.getFocus()) {
- int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(searchField.getTextDisplay()) + 10;
+ int len = fr.getStringWidth(searchField.getTextDisplay()) + 10;
searchField.setSize(Math.max(90, len), 14);
} else {
searchField.setSize(90, 14);
@@ -1618,78 +1525,24 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false);
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false);
String priceStr = "" + numberFormat.format(enchanterCurrentEnch.price) + " Coins";
if (enchanterCurrentEnch.price < 0) priceStr = "";
- int priceWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(priceStr);
+ int priceWidth = fr.getStringWidth(priceStr);
int priceTop = guiTop + 16;
int x = 180;
int color = 0x2d2102;
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2 - 1,
- priceTop + 4,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2 + 1,
- priceTop + 4,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2,
- priceTop + 4 - 1,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2,
- priceTop + 4 + 1,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2,
- priceTop + 4,
- 0xfcba03,
- false
- );
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2 - 1, priceTop + 4, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2 + 1, priceTop + 4, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 - 1, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 + 1, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4, 0xfcba03, false);
//Enchant name
String name = WordUtils.capitalizeFully(ItemUtils
@@ -1706,14 +1559,7 @@ public class GuiCustomHex extends Gui {
} else if (name.equalsIgnoreCase("Turbo Mushrooms")) {
name = "Turbo-Mush";
}
- Utils.drawStringCentered(
- name,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2,
- top + 8,
- true,
- 0xffffffdd
- );
+ Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd);
if (isChangingEnchLevel) {
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
@@ -1726,42 +1572,12 @@ public class GuiCustomHex extends Gui {
//Enchant level
levelStr = "" + enchanterCurrentEnch.level;
if (enchanterCurrentEnch.xpCost < 0) levelStr = "?";
- levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4,
- 0xea82ff,
- false
- );
+ levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4, 0xea82ff, false);
//Confirm button
@@ -1781,7 +1597,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(confirmText,
guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040
);
} else {
@@ -1790,7 +1606,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(confirmText,
guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040
);
@@ -1806,7 +1622,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Cancel",
guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040
);
} else {
@@ -1815,7 +1631,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Cancel",
guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040
);
}
@@ -1890,42 +1706,12 @@ public class GuiCustomHex extends Gui {
);
levelStr = "" + ench.level;
- levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 - 1,
- top + 16 * yIndex + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 + 1,
- top + 16 * yIndex + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 16 * yIndex + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 16 * yIndex + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 16 * yIndex + 4,
- 0xea82ff,
- false
- );
+ levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 16 * yIndex + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 16 * yIndex + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 16 * yIndex + 4, 0xea82ff, false);
}
GlStateManager.enableDepth();
}
@@ -2034,14 +1820,15 @@ public class GuiCustomHex extends Gui {
renderBaseTexture();
- Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
- Minecraft.getMinecraft().fontRendererObj.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false);
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
+ fr.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false);
//Page Text
/*if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) {
String pageStr = "Page: " + currentPage + "/" + expectedMaxPage;
int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr);
- Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(pageStr,
guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040
);
@@ -2066,10 +1853,10 @@ public class GuiCustomHex extends Gui {
//Can't be enchanted text
/*if (currentState == EnchantState.INVALID_ITEM) {
GlStateManager.disableDepth();
- Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("This item can't",
guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555
);
- Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("be enchanted",
guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555
);
GlStateManager.enableDepth();
@@ -2081,50 +1868,50 @@ public class GuiCustomHex extends Gui {
if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT ||
currentState == EnchantState.HAS_ITEM_IN_BOOKS || currentState == EnchantState.ADDING_BOOK) {
if (applicableItem.isEmpty() && removableItem.isEmpty() && searchRemovedFromApplicable) {
- Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Can't find that",
guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555
);
- Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("enchant, perhaps",
guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555
);
- Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("it is on",
guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555
);
- Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("another page?",
guiLeft + 8 + 48, guiTop + 58, true, 0xffff5555
);
} else if (applicableItem.isEmpty() && !searchRemovedFromApplicable) {
- Utils.drawStringCentered("No applicable", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("No applicable",
guiLeft + 8 + 48, guiTop + 28, true, 0xffff5555
);
- Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("enchants on",
guiLeft + 8 + 48, guiTop + 38, true, 0xffff5555
);
- Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("this page...",
guiLeft + 8 + 48, guiTop + 48, true, 0xffff5555
);
}
if (applicableItem.isEmpty() && removableItem.isEmpty() && searchRemovedFromRemovable) {
- Utils.drawStringCentered("Can't find that", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Can't find that",
guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555
);
- Utils.drawStringCentered("enchant, perhaps", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("enchant, perhaps",
guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555
);
- Utils.drawStringCentered("it is on", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("it is on",
guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555
);
- Utils.drawStringCentered("another page?", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("another page?",
guiLeft + 248 + 48, guiTop + 58, true, 0xffff5555
);
} else if (removableItem.isEmpty() && !searchRemovedFromRemovable) {
- Utils.drawStringCentered("No removable", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("No removable",
guiLeft + 248 + 48, guiTop + 28, true, 0xffff5555
);
- Utils.drawStringCentered("enchants on", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("enchants on",
guiLeft + 248 + 48, guiTop + 38, true, 0xffff5555
);
- Utils.drawStringCentered("this page...", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("this page...",
guiLeft + 248 + 48, guiTop + 48, true, 0xffff5555
);
}
@@ -2162,50 +1949,14 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- item.itemName,
- guiLeft + 8 + 16 + 2 + textOffset,
- top + 4 + textOffset,
- 0xffffffdd,
- true
- );
+ fr.drawString(item.itemName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
@@ -2241,51 +1992,19 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}*/
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(item.itemName,
- guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true
- );
+ fr.drawString(item.itemName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
//Player Inventory Items
- Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory
+ fr.drawString(Minecraft.getMinecraft().thePlayer.inventory
.getDisplayName()
.getUnformattedText(),
guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040
@@ -2328,7 +2047,7 @@ public class GuiCustomHex extends Gui {
searchField.setPrependText("\u00a77Search...");
} else {
if (searchField.getFocus()) {
- int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(searchField.getTextDisplay()) + 10;
+ int len = fr.getStringWidth(searchField.getTextDisplay()) + 10;
searchField.setSize(Math.max(90, len), 14);
} else {
searchField.setSize(90, 14);
@@ -2359,57 +2078,20 @@ public class GuiCustomHex extends Gui {
String priceStr = "" + numberFormat.format(enchanterCurrentItem.getPrice()) + " Coins";
if (enchanterCurrentItem.price < 0) priceStr = "";
- int priceWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(priceStr);
+ int priceWidth = fr.getStringWidth(priceStr);
int priceTop = guiTop + 10;
int x = 180;
int color = 0x2d2102;
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2 - 1,
- priceTop + 4,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2 + 1,
- priceTop + 4,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2,
- priceTop + 4 - 1,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2,
- priceTop + 4 + 1,
- color,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- priceStr,
- guiLeft + x - priceWidth / 2,
- priceTop + 4,
- 0xfcba03,
- false
- );
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2 - 1, priceTop + 4, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2 + 1, priceTop + 4, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 - 1, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4 + 1, color, false);
+ fr.drawString(priceStr, guiLeft + x - priceWidth / 2, priceTop + 4, 0xfcba03, false);
//Enchant name
String name = WordUtils.capitalizeFully(enchanterCurrentItem.itemId.replace("_", " "));
name = fixName(name);
- Utils.drawStringCentered(
- name,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2,
- top + 8,
- true,
- 0xffffffdd
- );
+ Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd);
//Confirm button
String confirmText = "Apply";
@@ -2428,7 +2110,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(confirmText,
guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040
);
} else {
@@ -2437,7 +2119,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(confirmText,
guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040
);
@@ -2453,7 +2135,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Cancel",
guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040
);
} else {
@@ -2462,7 +2144,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Cancel",
guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040
);
}
@@ -2574,7 +2256,8 @@ public class GuiCustomHex extends Gui {
renderBaseTexture();
- Minecraft.getMinecraft().fontRendererObj.drawString("The Hex", guiLeft + 7, guiTop + 7, 0x404040, false);
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString("The Hex", guiLeft + 7, guiTop + 7, 0x404040, false);
//Minecraft.getMinecraft().fontRendererObj.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false);
tooltipToDisplay = renderSettings(mouseX, mouseY, tooltipToDisplay);
@@ -2587,10 +2270,10 @@ public class GuiCustomHex extends Gui {
//Can't be enchanted text
if (currentState == EnchantState.INVALID_ITEM_HEX) {
GlStateManager.disableDepth();
- Utils.drawStringCentered("This item can't", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("This item can't",
guiLeft + X_SIZE / 2, guiTop + 88, true, 0xffff5555
);
- Utils.drawStringCentered("be enchanted", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("be enchanted",
guiLeft + X_SIZE / 2, guiTop + 98, true, 0xffff5555
);
GlStateManager.enableDepth();
@@ -2631,50 +2314,14 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- item.itemName,
- guiLeft + 8 + 16 + 2 + textOffset,
- top + 4 + textOffset,
- 0xffffffdd,
- true
- );
+ fr.drawString(item.itemName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
@@ -2710,53 +2357,20 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(item.itemName,
- guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true
- );
+ fr.drawString(item.itemName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
//Player Inventory Items
- Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory
- .getDisplayName()
- .getUnformattedText(),
+ fr.drawString(
+ Minecraft.getMinecraft().thePlayer.inventory.getDisplayName().getUnformattedText(),
guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040
);
int inventoryStartIndex = cc.getLowerChestInventory().getSizeInventory();
@@ -2918,14 +2532,15 @@ public class GuiCustomHex extends Gui {
renderBaseTexture();
- Minecraft.getMinecraft().fontRendererObj.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
- Minecraft.getMinecraft().fontRendererObj.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false);
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString("Applicable", guiLeft + 7, guiTop + 7, 0x404040, false);
+ fr.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false);
//Page Text
if (currentState == EnchantState.ADDING_GEMSTONE || currentState == EnchantState.APPLYING_GEMSTONE) {
String pageStr = "Page: " + currentPage + "/" + expectedMaxPage;
- int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr);
- Utils.drawStringCentered(pageStr, Minecraft.getMinecraft().fontRendererObj,
+ int pageStrLen = fr.getStringWidth(pageStr);
+ Utils.drawStringCentered(pageStr,
guiLeft + X_SIZE / 2, guiTop + 14, false, 0x404040
);
@@ -2960,7 +2575,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(confirmText,
guiLeft + X_SIZE / 2 - 1 - 23, top + 18 + 9, false, 0x408040
);
} else {
@@ -2969,7 +2584,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 - 1 - 48, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered(confirmText, Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered(confirmText,
guiLeft + X_SIZE / 2 - 1 - 24, top + 18 + 8, false, 0x408040
);
}
@@ -2983,7 +2598,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Cancel",
guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040
);
} else {
@@ -2992,7 +2607,7 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
+ Utils.drawStringCentered("Cancel",
guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040
);
}
@@ -3040,50 +2655,14 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 16 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 16 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- item.itemName,
- guiLeft + 8 + 16 + 2 + textOffset,
- top + 4 + textOffset,
- 0xffffffdd,
- true
- );
+ fr.drawString(item.itemName, guiLeft + 8 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
@@ -3119,51 +2698,19 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- guiLeft + 256 - levelWidth / 2,
- top + 4,
- colour,
- false
- );
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, guiLeft + 256 - levelWidth / 2, top + 4, colour, false);
- Minecraft.getMinecraft().fontRendererObj.drawString(item.itemName,
- guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true
- );
+ fr.drawString(item.itemName, guiLeft + 248 + 16 + 2 + textOffset, top + 4 + textOffset, 0xffffffdd, true);
}
GlScissorStack.pop(scaledResolution);
//Player Inventory Items
- Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().thePlayer.inventory
+ fr.drawString(Minecraft.getMinecraft().thePlayer.inventory
.getDisplayName()
.getUnformattedText(),
guiLeft + 102, guiTop + Y_SIZE - 96 + 2, 0x404040
@@ -3286,36 +2833,12 @@ public class GuiCustomHex extends Gui {
colour = 0xff5555;
}
- int levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 8 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false);
+ int levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false);
//Enchant name
String name = WordUtils.capitalizeFully(enchanterCurrentItem.itemName);
@@ -3330,14 +2853,7 @@ public class GuiCustomHex extends Gui {
} else if (name.equalsIgnoreCase("Turbo Mushrooms")) {
name = "Turbo-Mush";
}
- Utils.drawStringCentered(
- name,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2,
- top + 8,
- true,
- 0xffffffdd
- );
+ Utils.drawStringCentered(name, guiLeft + X_SIZE / 2, top + 8, true, 0xffffffdd);
if (isChangingEnchLevel) {
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
@@ -3349,42 +2865,12 @@ public class GuiCustomHex extends Gui {
//Enchant level
levelStr = "";
- levelWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(levelStr);
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 - 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2 + 1,
- top + 4,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4 - 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4 + 1,
- 0x2d2102,
- false
- );
- Minecraft.getMinecraft().fontRendererObj.drawString(
- levelStr,
- left + 96 + 8 - levelWidth / 2,
- top + 4,
- 0xea82ff,
- false
- );
+ levelWidth = fr.getStringWidth(levelStr);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 - 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2 + 1, top + 4, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 - 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4 + 1, 0x2d2102, false);
+ fr.drawString(levelStr, left + 96 + 8 - levelWidth / 2, top + 4, 0xea82ff, false);
}
if (!isChangingEnchLevel && itemHoverX >= 0 && itemHoverY >= 0) {
@@ -3604,7 +3090,8 @@ public class GuiCustomHex extends Gui {
Gui.drawRect(guiLeft + 295 + 18, guiTop + 147, guiLeft + 295 + 16 + 18, guiTop + 147 + 16, 0x80ffffff);
tooltipToDisplay = createTooltip("Max Level",
(NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel ? 0 : 1),
- "Enabled", "Disabled");
+ "Enabled", "Disabled"
+ );
tooltipToDisplay.add(1, EnumChatFormatting.GRAY + "Show max level of enchant");
tooltipToDisplay.add(2, EnumChatFormatting.GRAY + "from either hex or enchantment table");
tooltipToDisplay.add(3, EnumChatFormatting.GRAY + "max level");
@@ -3700,18 +3187,14 @@ public class GuiCustomHex extends Gui {
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 342 / 512f, (342 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040
- );
+ Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 25, top + 18 + 9, false, 0xa04040);
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE);
GlStateManager.color(1, 1, 1, 1);
Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + 1, top + 18, 48, 14,
0, 48 / 512f, 328 / 512f, (328 + 14) / 512f, GL11.GL_NEAREST
);
- Utils.drawStringCentered("Cancel", Minecraft.getMinecraft().fontRendererObj,
- guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040
- );
+ Utils.drawStringCentered("Cancel", guiLeft + X_SIZE / 2 + 1 + 24, top + 18 + 8, false, 0xa04040);
}
}
@@ -3735,9 +3218,7 @@ public class GuiCustomHex extends Gui {
Utils.drawItemStack(stackOnMouse, mouseX - 8, mouseY - 8);
}
} else if (tooltipToDisplay != null) {
- Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
}
}
@@ -4380,7 +3861,8 @@ public class GuiCustomHex extends Gui {
break;
}
case 1: {
- NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel = !NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel;
+ NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel =
+ !NotEnoughUpdates.INSTANCE.config.enchantingSolvers.maxEnchLevel;
break;
}
case 2: {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
index aaa398f4..ecf02236 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
@@ -47,7 +47,6 @@ import java.util.Map;
public class MinionHelperApiLoader {
private final MinionHelperManager manager;
private boolean dirty = true;
- private int ticks = 0;
private boolean collectionApiEnabled = true;
private boolean ignoreWorldSwitches = false;
private boolean readyToUse = false;
@@ -72,11 +71,7 @@ public class MinionHelperApiLoader {
if (Minecraft.getMinecraft().thePlayer == null) return;
if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
- ticks++;
-
- if (ticks % 20 != 0) return;
-
- if (dirty) {
+ if (dirty && "Crafted Minions".equals(Utils.getOpenChestName())) {
load();
} else {
if (System.currentTimeMillis() > lastLoaded + 60_000 * 3) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java
index 1a625794..93a39ec0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java
@@ -24,6 +24,7 @@ import com.google.common.collect.Lists;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.ArrowPagesUtils;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.Minion;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
@@ -34,6 +35,7 @@ import io.github.moulberry.notenoughupdates.miscgui.minionhelper.sources.NpcSour
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
+import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -94,6 +96,20 @@ public class MinionHelperOverlay {
}
@SubscribeEvent
+ public void onButtonExclusionZones(ButtonExclusionZoneEvent event) {
+ if (manager.inCraftedMinionsInventory() && NotEnoughUpdates.INSTANCE.config.minionHelper.gui) {
+ event.blockArea(
+ new Rectangle(
+ event.getGuiBaseRect().getRight(),
+ event.getGuiBaseRect().getTop(),
+ 168 /*width*/ + 4 /*space*/, 128
+ ),
+ ButtonExclusionZoneEvent.PushDirection.TOWARDS_RIGHT
+ );
+ }
+ }
+
+ @SubscribeEvent
public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!manager.inCraftedMinionsInventory()) return;
if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java
index 84678c0c..a3549d51 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlayHover.java
@@ -68,9 +68,7 @@ public class MinionHelperOverlayHover {
OverviewLine mouseObject = overlay.getObjectOverMouse(renderMap);
if (mouseObject != null) {
- Utils.drawHoveringText(getTooltip(mouseObject), mouseX, mouseY,
- scaledWidth, scaledHeight, -1, Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(getTooltip(mouseObject), mouseX, mouseY, scaledWidth, scaledHeight, -1);
}
renderButtons();
@@ -90,7 +88,6 @@ public class MinionHelperOverlayHover {
int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth;
int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1;
-
int x = guiLeft + xSize + 4 + 149 - 3;
int y = guiTop + 109 - 3;
if (mouseX > x && mouseX < x + 16 &&
@@ -122,9 +119,7 @@ public class MinionHelperOverlayHover {
list.add("");
list.add("§eClick to toggle!");
- Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1);
}
private void renderBuyPriceButton(int scaledWidth, int scaledHeight, int mouseX, int mouseY) {
@@ -145,9 +140,7 @@ public class MinionHelperOverlayHover {
list.add("");
list.add("§eClick to toggle!");
- Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(list, mouseX, mouseY, scaledWidth, scaledHeight, -1);
}
private List<String> getTooltip(OverviewLine overviewLine) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DhCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorCommandHandler.java
index 222862f9..73d31196 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DhCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/AccessorCommandHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
+ * Copyright (C) 2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -17,21 +17,17 @@
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-package io.github.moulberry.notenoughupdates.commands.dungeon;
+package io.github.moulberry.notenoughupdates.mixins;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
+import net.minecraft.command.CommandHandler;
+import net.minecraft.command.ICommand;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
-public class DhCommand extends ClientCommandBase {
+import java.util.Set;
- public DhCommand() {
- super("dh");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub");
- }
+@Mixin(CommandHandler.class)
+public interface AccessorCommandHandler {
+ @Accessor("commandSet")
+ Set<ICommand> neuGetClientCommands();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
index a5bb99b8..adae04f8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -21,6 +21,7 @@ package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NEUOverlay;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.events.GuiContainerBackgroundDrawnEvent;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneFavourites;
@@ -30,6 +31,8 @@ import io.github.moulberry.notenoughupdates.miscfeatures.AuctionSortModeWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
import io.github.moulberry.notenoughupdates.miscfeatures.DungeonNpcProfitOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
+import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
+import io.github.moulberry.notenoughupdates.miscfeatures.PresetWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
import io.github.moulberry.notenoughupdates.miscgui.GuiCustomEnchant;
import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay;
@@ -55,6 +58,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -201,6 +205,7 @@ public abstract class MixinGuiContainer extends GuiScreen {
GuiCustomHex.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
AuctionBINWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
AbiphoneWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
+ PresetWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
}
@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGradientRect(IIIIII)V"))
@@ -330,6 +335,16 @@ public abstract class MixinGuiContainer extends GuiScreen {
@Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V", ordinal = 1))
private void drawBackground(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
- AbiphoneFavourites.getInstance().onDrawBackground(this);
+ new GuiContainerBackgroundDrawnEvent(((GuiContainer) (Object) this), partialTicks).post();
+ }
+
+ @ModifyArg(method = "drawSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItemAndEffectIntoGUI(Lnet/minecraft/item/ItemStack;II)V", ordinal = 0))
+ public ItemStack drawSlot_renderItemAndEffectIntoGUI(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack);
+ }
+
+ @ModifyArg(method = "drawSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItemOverlayIntoGUI(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V"))
+ public ItemStack drawSlot_renderItemOverlays(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java
index 381f5934..285163ab 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java
@@ -20,24 +20,36 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
import io.github.moulberry.notenoughupdates.miscfeatures.StreamerMode;
import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
+import org.spongepowered.asm.lib.Opcodes;
+import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin({GuiIngame.class})
public class MixinGuiIngame {
+ @Shadow
+ @Final
+ protected RenderItem itemRenderer;
+ @Shadow
+ @Final
+ protected Minecraft mc;
private static final String TARGET = "Lnet/minecraft/scoreboard/ScorePlayerTeam;" +
"formatPlayerName(Lnet/minecraft/scoreboard/Team;Ljava/lang/String;)Ljava/lang/String;";
@@ -80,4 +92,19 @@ public class MixinGuiIngame {
}
return inventory.getCurrentItem();
}
+
+ @Redirect(method = "renderHotbarItem", at = @At(value = "FIELD", target = "Lnet/minecraft/item/ItemStack;animationsToGo:I", opcode = Opcodes.GETFIELD))
+ public int renderHotbarItem_animationsToGo(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack).animationsToGo;
+ }
+
+ @ModifyArg(method = "renderHotbarItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItemAndEffectIntoGUI(Lnet/minecraft/item/ItemStack;II)V", ordinal = 0))
+ public ItemStack renderHotbarItem_renderItemAndEffectIntoGUI(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack);
+ }
+
+ @ModifyArg(method = "renderHotbarItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItemOverlays(Lnet/minecraft/client/gui/FontRenderer;Lnet/minecraft/item/ItemStack;II)V", ordinal = 0))
+ public ItemStack renderHotbarItem_renderItemOverlays(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack);
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java
new file mode 100644
index 00000000..b263cf31
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngameForge.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.client.GuiIngameForge;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+@Mixin(GuiIngameForge.class)
+public class MixinGuiIngameForge {
+
+ @Redirect(method = "renderHelmet", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;", ordinal = 1))
+ public Item renderHelmet(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack).getItem();
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java
index c2739ad8..eb32ed70 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java
@@ -19,16 +19,20 @@
package io.github.moulberry.notenoughupdates.mixins;
+import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ItemRenderer.class)
public abstract class MixinItemRenderer {
+
@Redirect(method = "updateEquippedItem", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/player/InventoryPlayer;getCurrentItem()Lnet/minecraft/item/ItemStack;"
@@ -39,4 +43,19 @@ public abstract class MixinItemRenderer {
}
return player.getCurrentItem();
}
+
+ @Redirect(method = "renderItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"))
+ public Item renderItem_getItem(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack).getItem();
+ }
+
+ @ModifyArg(method = "renderItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;shouldRenderItemIn3D(Lnet/minecraft/item/ItemStack;)Z"))
+ public ItemStack renderItem_shouldRenderItemIn3D(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack);
+ }
+
+ @ModifyArg(method = "renderItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItemModelForEntity(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/client/renderer/block/model/ItemCameraTransforms$TransformType;)V", ordinal = 0))
+ public ItemStack renderItem_renderItemModelForEntity(ItemStack stack) {
+ return ItemCustomizeManager.useCustomItem(stack);
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java
index 83379a18..127e4216 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.mixins;
+import io.github.moulberry.notenoughupdates.core.ChromaColour;
import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.item.ItemStack;
@@ -27,8 +28,11 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+import java.awt.*;
+
@Mixin({ItemStack.class})
public class MixinItemStack {
@Inject(method = "hasEffect", at = @At("HEAD"), cancellable = true)
@@ -66,4 +70,32 @@ public class MixinItemStack {
} catch (Exception ignored) {
}
}
+
+ @Redirect(method = "getTooltip", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NBTTagCompound;hasKey(Ljava/lang/String;I)Z", ordinal = 2))
+ public boolean getTooltip_hasKey2(NBTTagCompound nbttagcompound, String key, int type) {
+ ItemStack stack = (ItemStack) (Object) this;
+ ItemCustomizeManager.ItemData data = ItemCustomizeManager.getDataForItem(stack);
+ if (data != null && data.customLeatherColour != null && ItemCustomizeManager.shouldRenderLeatherColour(stack)) {
+ return true;
+ } else if (data != null && !ItemCustomizeManager.shouldRenderLeatherColour(stack)) {
+ return false;
+ }
+ return nbttagcompound.hasKey("color", 3);
+ }
+
+ @Redirect(method = "getTooltip", at = @At(value = "INVOKE", target = "Ljava/lang/Integer;toHexString(I)Ljava/lang/String;"))
+ public String getTooltip_toHexString(int colour) {
+ ItemStack stack = (ItemStack) (Object) this;
+ ItemCustomizeManager.ItemData data = ItemCustomizeManager.getDataForItem(stack);
+ if (data != null && data.customLeatherColour != null && ItemCustomizeManager.shouldRenderLeatherColour(stack)) {
+ int currentColour = ChromaColour.specialToChromaRGB(data.customLeatherColour);
+ Color c = new Color(currentColour, false);
+ String hex = Integer.toHexString(c.getRGB() & 0xFFFFFF);
+ if (hex.length() < 6) {
+ hex = hex + "000000".substring(0, 6 - hex.length());
+ }
+ return hex.length() < 6 ? "0" + hex : hex;
+ }
+ return Integer.toHexString(colour);
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerArmorBase.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerArmorBase.java
index 773e7ebe..0a5acedf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerArmorBase.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerArmorBase.java
@@ -76,10 +76,20 @@ public abstract class MixinLayerArmorBase<T extends ModelBase> {
)
public int renderItem_getColor(ItemArmor item, ItemStack stack) {
ItemCustomizeManager.ItemData data = ItemCustomizeManager.getDataForItem(stack);
- if (data != null && data.customLeatherColour != null) {
+ if (data != null && data.customLeatherColour != null && ItemCustomizeManager.shouldRenderLeatherColour(stack)) {
return ChromaColour.specialToChromaRGB(data.customLeatherColour);
}
return item.getColor(stack);
}
+
+ @Redirect(method = "renderLayer",
+ at = @At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/renderer/entity/layers/LayerArmorBase;getCurrentArmor(Lnet/minecraft/entity/EntityLivingBase;I)Lnet/minecraft/item/ItemStack;"
+ )
+ )
+ public ItemStack renderItem_getCurrentArmor(LayerArmorBase<?> instance, EntityLivingBase entitylivingbaseIn, int armorSlot) {
+ return ItemCustomizeManager.useCustomArmour(instance, entitylivingbaseIn, armorSlot);
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerCustomHead.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerCustomHead.java
index 90101696..c3d92ab7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerCustomHead.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLayerCustomHead.java
@@ -53,6 +53,11 @@ public class MixinLayerCustomHead {
}
}
+ @Redirect(method = "doRenderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;getCurrentArmor(I)Lnet/minecraft/item/ItemStack;"))
+ public ItemStack doRenderLayer_getCurrentArmor(EntityLivingBase instance, int i) {
+ return ItemCustomizeManager.setHeadArmour(instance, i);
+ }
+
@Redirect(method = "doRenderLayer",
at = @At(
value = "INVOKE",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOFDynamicLights.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOFDynamicLights.java
new file mode 100644
index 00000000..68f75d49
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinOFDynamicLights.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.miscgui.DynamicLightItemsEditor;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Pseudo;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Pseudo
+@Mixin(targets = "net.optifine.DynamicLights", remap = false)
+public class MixinOFDynamicLights {
+
+ @Inject(method = "getLightLevel(Lnet/minecraft/item/ItemStack;)I", at = @At("TAIL"), cancellable = true)
+ private static void getLightLevel(ItemStack itemStack, CallbackInfoReturnable<Integer> cir) {
+ int lightLevel = DynamicLightItemsEditor.findDynamicLightItems(itemStack);
+ if (lightLevel != 0) cir.setReturnValue(lightLevel);
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
index 7c2cfcbf..633a82a2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
+ * Copyright (C) 2022-2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -131,7 +131,7 @@ public abstract class MixinRenderItem {
public int renderItem_renderByItem(Item item, ItemStack stack, int renderPass) {
if (renderPass == 0) {
ItemCustomizeManager.ItemData data = ItemCustomizeManager.getDataForItem(stack);
- if (data != null && data.customLeatherColour != null) {
+ if (data != null && data.customLeatherColour != null && ItemCustomizeManager.shouldRenderLeatherColour(stack)) {
return ChromaColour.specialToChromaRGB(data.customLeatherColour);
}
}
@@ -148,51 +148,6 @@ public abstract class MixinRenderItem {
@Shadow
abstract void renderModel(IBakedModel model, int color);
- /*@Redirect(method="renderEffect",
- at=@At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderModel(Lnet/minecraft/client/resources/model/IBakedModel;I)V"
- )
- )
- public void renderEffect_renderModel(RenderItem renderItem, IBakedModel model, int colour) {
- if(customEnchGlint != null) {
- renderModel(model, ChromaColour.specialToChromaRGB(customEnchGlint));
- } else {
- renderModel(model, colour);
- }
- }
-
- @Redirect(method="renderEffect",
- at=@At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V"
- )
- )
- public void renderEffect_bindTexture(TextureManager textureManager, ResourceLocation location) {
- if(customEnchGlint != null) {
- textureManager.bindTexture(GlintManager.getCustomGlintTexture());
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
- } else {
- textureManager.bindTexture(location);
- }
- }
-
- @Redirect(method="renderEffect",
- at=@At(
- value = "INVOKE",
- target = "Lnet/minecraft/client/renderer/GlStateManager;blendFunc(II)V"
- )
- )
- public void renderEffect_blendFunc(int src, int dst) {
- if(dst != 1) {
- GlStateManager.blendFunc(src, dst);
- } else if(customEnchGlint != null) {
- GlintManager.setCustomBlendFunc(customEnchGlint);
- } else {
- GlStateManager.blendFunc(GL11.GL_SRC_COLOR, 1);
- }
- }*/
@Inject(method = "renderItemIntoGUI", at = @At("HEAD"))
public void renderItemHead(ItemStack stack, int x, int y, CallbackInfo ci) {
@@ -301,4 +256,12 @@ public abstract class MixinRenderItem {
GlStateManager.enableDepth();
}
}
+
+ @Redirect(method = "renderItemOverlayIntoGUI", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;showDurabilityBar(Lnet/minecraft/item/ItemStack;)Z"))
+ public boolean renderItemOverlayIntoGUI_showDurabilityBar(
+ Item instance, ItemStack stack
+ ) {
+ if (ItemCustomizeManager.hasCustomItem(stack)) return false;
+ return stack.getItem().showDurabilityBar(stack);
+ }
}
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 a289ca51..53906cd8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -34,6 +34,8 @@ 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.customtypes.NEUDebugFlag;
+import io.github.moulberry.notenoughupdates.options.seperateSections.Garden;
+import io.github.moulberry.notenoughupdates.options.seperateSections.WorldConfig;
import io.github.moulberry.notenoughupdates.options.seperateSections.AHGraph;
import io.github.moulberry.notenoughupdates.options.seperateSections.AHTweaks;
import io.github.moulberry.notenoughupdates.options.seperateSections.AccessoryBag;
@@ -54,6 +56,7 @@ import io.github.moulberry.notenoughupdates.options.seperateSections.Mining;
import io.github.moulberry.notenoughupdates.options.seperateSections.MinionHelper;
import io.github.moulberry.notenoughupdates.options.seperateSections.Misc;
import io.github.moulberry.notenoughupdates.options.seperateSections.MiscOverlays;
+import io.github.moulberry.notenoughupdates.options.seperateSections.Museum;
import io.github.moulberry.notenoughupdates.options.seperateSections.NeuAuctionHouse;
import io.github.moulberry.notenoughupdates.options.seperateSections.Notifications;
import io.github.moulberry.notenoughupdates.options.seperateSections.PetOverlay;
@@ -73,16 +76,17 @@ import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.ClientCommandHandler;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
public class NEUConfig extends Config {
public void editOverlay() {
@@ -246,8 +250,8 @@ public class NEUConfig extends Config {
@Expose
@Category(
- name = "Todo Overlay",
- desc = "Todo Overlay"
+ name = "Todo Overlays",
+ desc = "Todo Overlays"
)
public MiscOverlays miscOverlays = new MiscOverlays();
@@ -295,6 +299,13 @@ public class NEUConfig extends Config {
@Expose
@Category(
+ name = "Garden",
+ desc = "Garden"
+ )
+ public Garden garden = new Garden();
+
+ @Expose
+ @Category(
name = "NEU Auction House",
desc = "NEU Auction House"
)
@@ -379,6 +390,13 @@ public class NEUConfig extends Config {
@Expose
@Category(
+ name = "Museum",
+ desc = "Museum overlays"
+ )
+ public Museum museum = new Museum();
+
+ @Expose
+ @Category(
name = "Profile Viewer",
desc = "Profile Viewer"
)
@@ -455,6 +473,8 @@ public class NEUConfig extends Config {
public ArrayList<String> quickCommands = createDefaultQuickCommands();
@Expose
public ArrayList<String> enchantColours = createDefaultEnchantColours();
+ @Expose
+ public Set<String> dynamicLightItems = new HashSet<>();
@Expose
public boolean firstTimeSearchFocus = true;
@@ -573,6 +593,8 @@ public class NEUConfig extends Config {
@Expose
public long questBoardCompleted = 0L;
@Expose
+ public long dailyShopLimitCompleted = 0L;
+ @Expose
public HashMap<Integer, JsonObject> savedEquipment = new HashMap<>();
@Expose
public int magicalPower = 0;
@@ -594,6 +616,9 @@ public class NEUConfig extends Config {
@Expose
public boolean abiphoneShowOnlyFavourites = false;
+
+ @Expose
+ public Map<String, Integer> hotmTree = new HashMap<>();
}
public HiddenLocationSpecific getLocationSpecific() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
index fe1f0af4..677e5822 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
@@ -34,7 +34,6 @@ import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -289,15 +288,9 @@ public class NEUConfigEditor extends GuiElement {
RenderUtils.drawFloatingRectDark(x + 5, y + 5, xSize - 10, 20, false);
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
TextRenderUtils.drawStringCenteredScaledMaxWidth(
"NotEnoughUpdates by " + EnumChatFormatting.DARK_PURPLE + "Moulberry",
- fr,
- x + xSize / 2,
- y + 15,
- false,
- 200,
- 0xa0a0a0
+ x + xSize / 2, y + 15, false, 200, 0xa0a0a0
);
RenderUtils.drawFloatingRectDark(x + 4, y + 49 - 20,
@@ -334,9 +327,7 @@ public class NEUConfigEditor extends GuiElement {
} else {
catName = EnumChatFormatting.GRAY + catName;
}
- TextRenderUtils.drawStringCenteredScaledMaxWidth(catName,
- fr, x + 75, y + 70 + catY, false, 100, -1
- );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(catName, x + 75, y + 70 + catY, false, 100, -1);
catY += 15;
if (catY > 0) {
catBarSize =
@@ -366,9 +357,7 @@ public class NEUConfigEditor extends GuiElement {
GlScissorStack.pop(scaledResolution);
- TextRenderUtils.drawStringCenteredScaledMaxWidth("Categories",
- fr, x + 75, y + 44, false, 120, 0xa368ef
- );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Categories", x + 75, y + 44, false, 120, 0xa368ef);
RenderUtils.drawFloatingRectDark(x + 149, y + 29, xSize - 154, ySize - 34, false);
@@ -405,8 +394,9 @@ public class NEUConfigEditor extends GuiElement {
if (getSelectedCategory() != null && currentConfigEditing.containsKey(getSelectedCategory())) {
ConfigProcessor.ProcessedCategory cat = currentConfigEditing.get(getSelectedCategory());
- TextRenderUtils.drawStringScaledMaxWidth(cat.desc,
- fr, innerLeft + 5, y + 40, true, innerRight - innerLeft - rightStuffLen - 10, 0xb0b0b0
+ TextRenderUtils.drawStringScaledMaxWidth(
+ cat.desc,
+ innerLeft + 5, y + 40, true, innerRight - innerLeft - rightStuffLen - 10, 0xb0b0b0
);
}
@@ -552,7 +542,9 @@ public class NEUConfigEditor extends GuiElement {
GlScissorStack.clear();
if (tooltipToDisplay != null) {
- TextRenderUtils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
+ TextRenderUtils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1,
+ Minecraft.getMinecraft().fontRendererObj
+ );
}
GlStateManager.translate(0, 0, -2);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java b/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java
index 50f459c0..90ef93bb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java
@@ -31,6 +31,7 @@ public enum NEUDebugFlag {
WISHING("Wishing Compass Solver"),
MAP("Dungeon Map Player Information"),
SEARCH("SearchString Matches"),
+ API_CACHE("Api Cache"),
;
private final String description;
@@ -43,6 +44,10 @@ public enum NEUDebugFlag {
return description;
}
+ public void log(String message) {
+ NEUDebugLogger.log(this, message);
+ }
+
public boolean isSet() {
return NEUDebugLogger.isFlagEnabled(this);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/EnableStorageCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Garden.java
index 3415b030..b5f11906 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/EnableStorageCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Garden.java
@@ -17,23 +17,26 @@
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-package io.github.moulberry.notenoughupdates.commands.dev;
+package io.github.moulberry.notenoughupdates.options.seperateSections;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
+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 EnableStorageCommand extends ClientCommandBase {
-
- public EnableStorageCommand() {
- super("neuenablestorage");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 = true;
- NotEnoughUpdates.INSTANCE.saveConfig();
- }
+public class Garden {
+ @Expose
+ @ConfigOption(
+ name = "Mute Composter",
+ desc = "Mute sounds of composting"
+ )
+ @ConfigEditorBoolean
+ public boolean muteComposterSounds = false;
+ @Expose
+ @ConfigOption(
+ name = "Enable Preset Delete Warning",
+ desc = "Asks for confirmation when deleting a preset"
+ )
+ @ConfigEditorBoolean
+ public boolean presetDeleteWarning = true;
}
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
index 081fd4b3..96ce838a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
@@ -377,6 +377,15 @@ public class ItemOverlays {
@ConfigAccordionId(id = 7)
public boolean enableDirtWandOverlay = true;
+ @Expose
+ @ConfigOption(
+ name = "Enable Scythe Overlay",
+ desc = "Show a block overlay for the effected blocks of scythe's ability."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean enableScytheOverlay = true;
+
@ConfigOption(
name="Custom Wither Cloak",
desc = ""
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
index 74400f59..e1b2662a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
@@ -152,16 +152,17 @@ public class Mining {
)
@ConfigEditorDraggableList(
exampleText = {
- "\u00a73Goblin Slayer: \u00a7626.5%\n\u00a73Lucky Raffle: \u00a7c0.0%",
- "\u00a73Mithril Powder: \u00a726,243",
- "\u00a73Gemstone Powder: \u00a7d6,243",
- "\u00a73Forge 1) \u00a79Diamonite\u00a77: \u00a7aReady!",
- "\u00a73Pickaxe CD: \u00a7a78s",
- "\u00a73Star Cult: \u00a7a78s"
+ "§3Goblin Slayer: §626.5%\n§3Lucky Raffle: §c0.0%",
+ "§3Mithril Powder: §26,243",
+ "§3Gemstone Powder: §d6,243",
+ "§3Forge 1) §9Diamonite§7: §aReady!",
+ "§3Pickaxe CD: §a78s",
+ "§3Star Cult: §a78s",
+ "§3Sky Mall: §a5x Titanium (78s)"
}
)
@ConfigAccordionId(id = 2)
- public List<Integer> dwarvenText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5));
+ public List<Integer> dwarvenText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6));
@Expose
public Position overlayPosition = new Position(10, 100);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
index 47e51eec..02630df9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
@@ -311,4 +311,12 @@ public class Misc {
@ConfigEditorBoolean
public boolean dungeonGroupsPV = true;
+ @Expose
+ @ConfigOption(
+ name = "Old SkyBlock Menu",
+ desc = "Show old buttons in the SkyBlock Menu: Trade, Accessories, Potions, Quiver, Fishing and Sacks. " +
+ "§cOnly works with the booster cookie effect active."
+ )
+ @ConfigEditorBoolean
+ public boolean oldSkyBlockMenu = false;
}
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
index 5634a4b7..97b11d27 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java
@@ -86,10 +86,11 @@ public class MiscOverlays {
"\u00a73Gemstone Powder: \u00a7e3h38m",
"\u00a73Heavy Pearls: \u00a7e3h38m",
"\u00a73Crimson Isle Quests: \u00a7e3h38m",
+ "\u00a73NPC Buy Daily Limit: \u00a7e3h38m",
}
)
@ConfigAccordionId(id = 0)
- public List<Integer> todoText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
+ public List<Integer> todoText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11));
@ConfigOption(
name = "Show Only If Soon",
@@ -232,6 +233,18 @@ public class MiscOverlays {
)
public int questBoardDisplay = 0;
+ @Expose
+ @ConfigOption(
+ name = "NPC Buy Daily Limit Display",
+ desc = "Change the way the NPC shop limit 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 shopLimitDisplay = 0;
+
@ConfigOption(
name = "Colours",
desc = "",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Museum.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Museum.java
new file mode 100644
index 00000000..6f03c2bb
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Museum.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+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.ConfigEditorColour;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+
+public class Museum {
+
+ @Expose
+ @ConfigOption(
+ name = "Show Museum Items",
+ desc = "Show real items instead of green dye in the museum"
+ )
+ @ConfigEditorBoolean
+ public boolean museumItemShow = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Highlight virtual museum items",
+ desc = "Highlight virtual museum items with a background color"
+ )
+ @ConfigEditorColour
+ public String museumItemColor = "0:255:0:255:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Show Items to donate",
+ desc = "Show the cheapest items you have not yet donated to the Museum"
+ )
+ @ConfigEditorBoolean
+ public boolean museumCheapestItemOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Value calculation",
+ desc = "Choose the source for the value calculation"
+ )
+ @ConfigEditorDropdown(
+ values = {"Lowest BIN", "Craft cost"}
+ )
+ public int museumCheapestItemOverlayValueSource = 0;
+
+}
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
index fce1f9af..9d88e8f1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java
@@ -22,7 +22,6 @@ 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.ConfigEditorBoolean;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDraggableList;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
@@ -131,4 +130,12 @@ public class PetOverlay {
)
@ConfigEditorBoolean
public boolean showKatSitting = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Pet Level Progress",
+ desc = "Hide the pet level progress information for maxed out pets."
+ )
+ @ConfigEditorBoolean
+ public boolean hidePetLevelProgress = false;
}
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
index 29fc24c1..d3ebe1a9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
@@ -267,4 +267,12 @@ public class TooltipTweaks {
)
@ConfigEditorBoolean
public boolean essencePriceInEssenceShop = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Item Cost in Garden NPC",
+ desc = "Show the item cost in garden NPC shop"
+ )
+ @ConfigEditorBoolean
+ public boolean gardenNpcPrice = true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
index fcea79dd..942eee8b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
@@ -274,15 +274,7 @@ public class AuctionSearchOverlay {
}
if (tooltipToDisplay != null) {
- Utils.drawHoveringText(
- tooltipToDisplay,
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java
index 66dacda3..dab9156e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BazaarSearchOverlay.java
@@ -225,15 +225,7 @@ public class BazaarSearchOverlay {
}
if (tooltipToDisplay != null) {
- Utils.drawHoveringText(
- tooltipToDisplay,
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CombatSkillOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CombatSkillOverlay.java
index 45ce0098..3bd5150f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CombatSkillOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CombatSkillOverlay.java
@@ -245,7 +245,7 @@ public class CombatSkillOverlay
lineMap.put(0, EnumChatFormatting.AQUA + "Kills: " + EnumChatFormatting.YELLOW + format.format(counterInterp));
}
- if (championTier <= 9) {
+ if (championTier <= 9 && championXp >= 0) {
int counterInterp = (int) interp(championXp, championXpLast);
lineMap.put(
6,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
index db81bfa4..4d14e47f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java
@@ -25,16 +25,17 @@ import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
import io.github.moulberry.notenoughupdates.events.GuiInventoryBackgroundDrawnEvent;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
+import io.github.moulberry.notenoughupdates.util.Rectangle;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiInventory;
@@ -108,7 +109,9 @@ public class EquipmentOverlay {
case 2:
return ARMOR_DISPLAY_DARK;
case 3:
- return NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3 && isPetRendering ? ARMOR_DISPLAY_TRANSPARENT_PET : ARMOR_DISPLAY_TRANSPARENT;
+ return NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3 && isPetRendering
+ ? ARMOR_DISPLAY_TRANSPARENT_PET
+ : ARMOR_DISPLAY_TRANSPARENT;
case 4:
return ARMOR_DISPLAY_FSR;
}
@@ -142,13 +145,35 @@ public class EquipmentOverlay {
public static final int PET_OVERLAY_OFFSET_Y = ARMOR_OVERLAY_HEIGHT - 14 /* overlaying pixels */;
//</editor-fold>
-
public boolean shouldRenderPets;
public boolean shouldRenderArmorHud;
public ItemStack petStack;
//<editor-fold desc="events">
+ @SubscribeEvent
+ public void onButtonExclusionZones(ButtonExclusionZoneEvent event) {
+ if (isRenderingArmorHud()) {
+ event.blockArea(
+ new Rectangle(
+ event.getGuiBaseRect().getRight() - 200,
+ event.getGuiBaseRect().getTop(),
+ 50, 84
+ ),
+ ButtonExclusionZoneEvent.PushDirection.TOWARDS_LEFT
+ );
+ }
+ if (isRenderingPetHud()) {
+ event.blockArea(
+ new Rectangle(
+ event.getGuiBaseRect().getRight() - 200,
+ event.getGuiBaseRect().getTop() + 60,
+ 50, 60
+ ),
+ ButtonExclusionZoneEvent.PushDirection.TOWARDS_LEFT
+ );
+ }
+ }
@SubscribeEvent
public void onGuiTick(TickEvent.ClientTickEvent event) {
@@ -229,12 +254,7 @@ public class EquipmentOverlay {
)) {
Utils.drawHoveringText(
tooltipToDisplay,
- mouseX - calculateTooltipXOffset(tooltipToDisplay, Minecraft.getMinecraft().fontRendererObj),
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
+ mouseX - calculateTooltipXOffset(tooltipToDisplay), mouseY, width, height, -1
);
}
@@ -263,7 +283,8 @@ public class EquipmentOverlay {
slot4 = getWardrobeSlot(37);
}
- if ((screen instanceof GuiChest || screen instanceof GuiInventory) && NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay){
+ if ((screen instanceof GuiChest || screen instanceof GuiInventory) &&
+ NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay) {
petStack = getRepoPetStack();
}
if ((!(screen instanceof GuiInventory) && !(screen instanceof GuiInvButtonEditor))
@@ -321,12 +342,8 @@ public class EquipmentOverlay {
tooltipToDisplay = petInfo.getTooltip(Minecraft.getMinecraft().thePlayer, false);
Utils.drawHoveringText(
tooltipToDisplay,
- mouseX - calculateTooltipXOffset(tooltipToDisplay, Minecraft.getMinecraft().fontRendererObj),
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
+ mouseX - calculateTooltipXOffset(tooltipToDisplay),
+ mouseY, width, height, -1
);
}
}
@@ -413,14 +430,13 @@ public class EquipmentOverlay {
* Calculates the width of the longest String in the tooltip, which can be used to offset the entire tooltip to the left more precisely
*
* @param tooltipToDisplay tooltip
- * @param fr FontRenderer object
* @return offset to apply
*/
- private int calculateTooltipXOffset(List<String> tooltipToDisplay, FontRenderer fr) {
+ private int calculateTooltipXOffset(List<String> tooltipToDisplay) {
int offset = 0;
if (tooltipToDisplay != null) {
for (String line : tooltipToDisplay) {
- int lineWidth = fr.getStringWidth(line);
+ int lineWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line);
if (lineWidth > offset) {
offset = lineWidth;
}
@@ -430,7 +446,8 @@ public class EquipmentOverlay {
}
public void renderPreviewArmorHud() {
- if (!NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud || !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return;
+ if (!NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud ||
+ !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return;
GuiInvButtonEditor container = (GuiInvButtonEditor) Minecraft.getMinecraft().currentScreen;
int overlayLeft = container.getGuiLeft() - ARMOR_OVERLAY_OVERHAND_WIDTH;
@@ -443,7 +460,8 @@ public class EquipmentOverlay {
}
public void renderPreviewPetInvHud() {
- if (!NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay || !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return;
+ if (!NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay ||
+ !(Minecraft.getMinecraft().currentScreen instanceof GuiInvButtonEditor)) return;
GuiInvButtonEditor container = (GuiInvButtonEditor) Minecraft.getMinecraft().currentScreen;
int overlayLeft = container.getGuiLeft() - ARMOR_OVERLAY_OVERHAND_WIDTH;
int overlayTop = container.getGuiTop() + PET_OVERLAY_OFFSET_Y;
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 ea253e94..db1a7755 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -24,6 +24,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
+import io.github.moulberry.notenoughupdates.guifeatures.SkyMallDisplay;
import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.SBInfo;
@@ -45,6 +46,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -439,6 +441,12 @@ public class MiningOverlay extends TextTabOverlay {
DARK_AQUA + "Star Cult: " + GREEN +
StarCultCalculator.getNextStarCult());
break;
+ case 6:
+
+ if (Objects.equals(SBInfo.getInstance().getLocation(), "mining_3")) {
+ overlayStrings.add("§3Sky Mall: §a" + SkyMallDisplay.Companion.getDisplayText());
+ }
+ break;
}
}
} else {
@@ -714,17 +722,17 @@ public class MiningOverlay extends TextTabOverlay {
String cleaned = Utils.cleanColour(line);
String beforeColon = cleaned.split(":")[0];
- if (miningOverlayCommisionItems == null) {
- setupMiningOverlayCommisionItems();
+ if (miningOverlayCommissionItems == null) {
+ setupMiningOverlayCommissionItems();
}
- if (miningOverlayCommisionItems.containsKey(beforeColon)) {
- icon = miningOverlayCommisionItems.get(beforeColon);
+ if (miningOverlayCommissionItems.containsKey(beforeColon)) {
+ icon = miningOverlayCommissionItems.get(beforeColon);
} else {
if (beforeColon.startsWith("Forge")) {
- icon = miningOverlayCommisionItems.get("Forge");
+ icon = miningOverlayCommissionItems.get("Forge");
} else if (beforeColon.contains("Mithril")) {
- icon = miningOverlayCommisionItems.get("Mithril");
+ icon = miningOverlayCommissionItems.get("Mithril");
} else if (beforeColon.endsWith(" Gemstone Collector")) {
String gemName = "ROUGH_"
+ beforeColon.replace(" Gemstone Collector", "").toUpperCase() + "_GEM";
@@ -748,7 +756,11 @@ public class MiningOverlay extends TextTabOverlay {
miningOverlayPerfectGems.put(gemName, icon);
}
} else if (beforeColon.contains("Titanium")) {
- icon = miningOverlayCommisionItems.get("Titanium");
+ icon = miningOverlayCommissionItems.get("Titanium");
+ } else if (beforeColon.contains("Sky Mall")) {
+ if (Objects.equals(SBInfo.getInstance().getLocation(), "mining_3")) {
+ icon = SkyMallDisplay.Companion.getDisplayItem();
+ }
}
}
@@ -768,10 +780,10 @@ public class MiningOverlay extends TextTabOverlay {
private static final HashMap<String, ItemStack> miningOverlayRoughGems = new HashMap<String, ItemStack>() {};
private static final HashMap<String, ItemStack> miningOverlayPerfectGems = new HashMap<String, ItemStack>() {};
- private static HashMap<String, ItemStack> miningOverlayCommisionItems;
+ private static HashMap<String, ItemStack> miningOverlayCommissionItems;
- private static void setupMiningOverlayCommisionItems() {
- miningOverlayCommisionItems = new HashMap<String, ItemStack>() {{
+ private static void setupMiningOverlayCommissionItems() {
+ miningOverlayCommissionItems = new HashMap<String, ItemStack>() {{
put(
"Mithril Powder",
NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
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 a8b7112f..99e8b1e4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
@@ -63,7 +63,8 @@ public class OverlayManager {
"\u00a73Experiments: \u00a7e3h38m",
"\u00a73Mithril Powder: \u00a7e3h38m",
"\u00a73Gemstone Powder: \u00a7e3h38m",
- "\u00a73Crimson Isle Quests: \u00a7e3h38m"
+ "\u00a73Crimson Isle Quests: \u00a7e3h38m",
+ "\u00a73NPC Buy Daily Limit: \u00a7e3h38m"
);
textOverlays.add(
timersOverlay = new TimersOverlay(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoPosition, () -> {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java
index ad8755e3..68a0e1f0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/PowderGrindingOverlay.java
@@ -19,12 +19,13 @@
package io.github.moulberry.notenoughupdates.overlays;
-import com.google.gson.JsonParser;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.entity.boss.BossStatus;
import java.text.NumberFormat;
import java.util.ArrayList;
@@ -35,10 +36,9 @@ import java.util.regex.Pattern;
public class PowderGrindingOverlay extends TextTabOverlay {
- private final static JsonParser PARSER = new JsonParser();
-
- private final static Pattern pattern =
+ private final static Pattern POWDER_PATTERN =
Pattern.compile("You received \\+([0-9]+(?:,\\d+)*) (Mithril|Gemstone) Powder\\.");
+ private final static Pattern EVENT_PATTERN = Pattern.compile("PASSIVE EVENT (.+) RUNNING FOR \\d{2}:\\d{2}");
public int chestCount = 0;
public int openedChestCount = 0;
@@ -48,6 +48,7 @@ public class PowderGrindingOverlay extends TextTabOverlay {
public int gemstonePowderFound = 0;
public float lastGemstonePowderFound = 0;
public float lastGemstonePowderAverage = 0;
+ public MiningEvent miningEvent = MiningEvent.UNKNOWN;
private long lastUpdate = -1;
public PowderGrindingOverlay(
@@ -58,6 +59,13 @@ public class PowderGrindingOverlay extends TextTabOverlay {
super(position, dummyStrings, styleSupplier);
}
+ public enum MiningEvent {
+ UNKNOWN,
+ DOUBLE_POWDER,
+ BETTER_TOGETHER,
+ GONE_WITH_THE_WIND;
+ }
+
private float interp(float now, float last) {
float interp = now;
if (last >= 0 && last != now) {
@@ -80,6 +88,23 @@ public class PowderGrindingOverlay extends TextTabOverlay {
lastGemstonePowderAverage = this.openedChestCount > 0 ?
1f * this.gemstonePowderFound / this.openedChestCount :
0;
+
+ Matcher matcher = EVENT_PATTERN.matcher(BossStatus.bossName == null ? "" : Utils.cleanColour(BossStatus.bossName));
+ if (matcher.matches()) {
+ switch (matcher.group(1)) {
+ case "2X POWDER":
+ miningEvent = MiningEvent.DOUBLE_POWDER;
+ break;
+ case "BETTER TOGETHER":
+ miningEvent = MiningEvent.BETTER_TOGETHER;
+ break;
+ case "GONE WITH THE WIND":
+ miningEvent = MiningEvent.GONE_WITH_THE_WIND;
+ break;
+ default:
+ miningEvent = MiningEvent.UNKNOWN;
+ }
+ }
} else overlayStrings = null;
}
@@ -139,16 +164,16 @@ public class PowderGrindingOverlay extends TextTabOverlay {
} else if (message.equals("You have successfully picked the lock on this chest!")) {
this.openedChestCount++;
} else {
- Matcher matcher = pattern.matcher(message);
+ Matcher matcher = POWDER_PATTERN.matcher(message);
if (matcher.matches()) {
String rawNumber = matcher.group(1).replace(",", "");
try {
int amount = Integer.parseInt(rawNumber);
String type = matcher.group(2);
if (type.equals("Mithril")) {
- this.mithrilPowderFound += amount;
+ this.mithrilPowderFound += miningEvent == MiningEvent.DOUBLE_POWDER ? amount * 2 : amount;
} else if (type.equals("Gemstone")) {
- this.gemstonePowderFound += amount;
+ this.gemstonePowderFound += miningEvent == MiningEvent.DOUBLE_POWDER ? amount * 2 : amount;
}
} catch (NumberFormatException e) {
e.printStackTrace();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
index 2a30f6f1..22f6eb96 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
@@ -92,14 +92,7 @@ public class RancherBootOverlay {
selectedIndex == i ? 0xff0000ff : 0xff808080
);
Utils.drawItemStack(new ItemStack(Items.carrot), iconsLeft + i * 25 + 2, topY + 25 + 2);
- Utils.drawStringCentered(
- "" + currentSpeeds.get(i),
- Minecraft.getMinecraft().fontRendererObj,
- iconsLeft + i * 25 + 10,
- topY + 52,
- true,
- 0xffffffff
- );
+ Utils.drawStringCentered("" + currentSpeeds.get(i), iconsLeft + i * 25 + 10, topY + 52, true, 0xffffffff);
//Minecraft.getMinecraft().fontRendererObj.drawString("\u2710", iconsLeft+i*25+15, topY+40, 0xffffff, false);
}
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 90aa2984..1d7126a2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
@@ -42,6 +42,7 @@ import org.lwjgl.util.vector.Vector2f;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.function.Supplier;
@@ -51,9 +52,6 @@ import java.util.regex.Pattern;
import static net.minecraft.util.EnumChatFormatting.DARK_AQUA;
public class TimersOverlay extends TextTabOverlay {
- private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile(
- "\u00a7r\u00a7r\u00a77You have a \u00a7r\u00a7cGod Potion \u00a7r\u00a77active! \u00a7r\u00a7d([1-5][0-9]|[0-9])[\\s|^\\S]?(Seconds|Second|Minutes|Minute|Hours|Hour|Day|Days|h|m|s) ?([1-5][0-9]|[0-9])?(m|s)?\u00a7r");
-
public TimersOverlay(
Position position,
Supplier<List<String>> dummyStrings,
@@ -62,6 +60,8 @@ public class TimersOverlay extends TextTabOverlay {
super(position, dummyStrings, styleSupplier);
}
+ private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile(
+ "\u00a7r\u00a7r\u00a77You have a \u00a7r\u00a7cGod Potion \u00a7r\u00a77active! \u00a7r\u00a7d([1-5][0-9]|[0-9])[\\s|^\\S]?(Seconds|Second|Minutes|Minute|Hours|Hour|Day|Days|h|m|s) ?([1-5][0-9]|[0-9])?([ms])?\u00a7r");
private static final Pattern CAKE_PATTERN = Pattern.compile(
"\u00a7r\u00a7d\u00a7lYum! \u00a7r\u00a7eYou gain .+ \u00a7r\u00a7efor \u00a7r\u00a7a48 \u00a7r\u00a7ehours!\u00a7r");
private static final Pattern PUZZLER_PATTERN =
@@ -74,6 +74,8 @@ public class TimersOverlay extends TextTabOverlay {
"\u00a7r\u00a79\u1805 \u00a7r\u00a7fYou've earned \u00a7r\u00a72.+ Mithril Powder \u00a7r\u00a7ffrom mining your first Mithril Ore of the day!\u00a7r");
private static final Pattern DAILY_GEMSTONE_POWDER = Pattern.compile(
"\u00a7r\u00a79\u1805 \u00a7r\u00a7fYou've earned \u00a7r\u00a7d.+ Gemstone Powder \u00a7r\u00a7ffrom mining your first Gemstone of the day!\u00a7r");
+ private static final Pattern DAILY_SHOP_LIMIT = Pattern.compile(
+ "\u00a7r\u00a7cYou may only buy up to (640|6400) of this item each day!\u00a7r");
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onChatMessageReceived(ClientChatReceivedEvent event) {
@@ -112,6 +114,11 @@ public class TimersOverlay extends TextTabOverlay {
Matcher dailyMithrilPowder = DAILY_MITHRIL_POWDER.matcher(event.message.getFormattedText());
if (dailyMithrilPowder.matches()) {
hidden.dailyMithrilPowerCompleted = currentTime;
+ return;
+ }
+ Matcher dailyShopLimit = DAILY_SHOP_LIMIT.matcher(event.message.getFormattedText());
+ if (dailyShopLimit.matches()) {
+ hidden.dailyShopLimitCompleted = currentTime;
}
}
}
@@ -130,6 +137,7 @@ public class TimersOverlay extends TextTabOverlay {
private static final ItemStack EXPERIMENTS_ICON = new ItemStack(Items.enchanted_book);
private static final ItemStack COOKIE_ICON = new ItemStack(Items.cookie);
private static final ItemStack QUEST_ICON = new ItemStack(Items.sign);
+ private static final ItemStack SHOP_ICON = new ItemStack(Blocks.hopper);
@Override
protected void renderLine(String line, Vector2f position, boolean dummy) {
@@ -215,6 +223,9 @@ public class TimersOverlay extends TextTabOverlay {
case "Crimson Isle Quests":
icon = QUEST_ICON;
break;
+ case "NPC Buy Daily Limit":
+ icon = SHOP_ICON;
+ break;
}
if (icon != null) {
@@ -251,55 +262,141 @@ public class TimersOverlay extends TextTabOverlay {
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) {
- hidden.commissionsCompleted = currentTime;
- }
- for (int i = 9; i < 18; i++) {
- ItemStack stack = lower.getStackInSlot(i);
- if (stack != null && stack.hasTagCompound()) {
- String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound());
- for (String line : lore) {
- if (line.contains("(Daily")) {
- hidden.commissionsCompleted = 0;
- break;
+ ItemStack stack = lower.getStackInSlot(0);
+ switch (containerName.intern()) {
+ case "Commissions":
+ if (lower.getSizeInventory() < 18) {
+ break;
+ }
+ if (hidden.commissionsCompleted == 0) {
+ hidden.commissionsCompleted = currentTime + TimeEnums.DAY.time;
+ }
+ for (int i = 9; i < 18; i++) {
+ stack = lower.getStackInSlot(i);
+ if (stack != null && stack.hasTagCompound()) {
+ String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound());
+ for (String line : lore) {
+ if (line.contains("(Daily")) {
+ hidden.commissionsCompleted = 0;
+ break;
+ }
}
}
}
- }
- } 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) {
+ break;
+ case "Experimentation Table":
+ if (lower.getSizeInventory() < 36) {
+ break;
+ }
+ stack = lower.getStackInSlot(31);
+ if (stack != null) {
+ if (stack.getItem() == Items.blaze_powder) {
+ if (hidden.experimentsCompleted == 0) {
+ hidden.experimentsCompleted = currentTime;
+ return;
+ }
+ }
+ }
+ ItemStack stackSuperPairs = lower.getStackInSlot(22);
+ if (stackSuperPairs != null && stackSuperPairs.getItem() == Items.skull &&
+ stackSuperPairs.getTagCompound() != null) {
+ String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stackSuperPairs.getTagCompound());
+ String text = lore[lore.length - 1];
+ String cleanText = Utils.cleanColour(text);
+ if (cleanText.equals("Experiments on cooldown!")) {
hidden.experimentsCompleted = currentTime;
return;
}
}
- }
- ItemStack stackSuperPairs = lower.getStackInSlot(22);
- if (stackSuperPairs != null && stackSuperPairs.getItem() == Items.skull &&
- stackSuperPairs.getTagCompound() != null) {
- String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stackSuperPairs.getTagCompound());
- String text = lore[lore.length - 1];
- String cleanText = Utils.cleanColour(text);
- if (cleanText.equals("Experiments on cooldown!")) {
+ hidden.experimentsCompleted = 0;
+ break;
+ case "Superpairs Rewards":
+ if (lower.getSizeInventory() < 27) {
+ break;
+ }
+ stack = lower.getStackInSlot(13);
+ if (stack != null && Utils.cleanColour(stack.getDisplayName()).equals("Superpairs")) {
hidden.experimentsCompleted = currentTime;
- return;
}
- }
- hidden.experimentsCompleted = 0;
- return;
- } else if (containerName.equals("Superpairs Rewards") && lower.getSizeInventory() >= 27) {
- ItemStack stack = lower.getStackInSlot(13);
- if (stack != null && Utils.cleanColour(stack.getDisplayName()).equals("Superpairs")) {
- hidden.experimentsCompleted = currentTime;
- }
+ case "SkyBlock Menu":
+ if (lower.getSizeInventory() < 54) {
+ break;
+ }
+ stack = lower.getStackInSlot(51);
+ case "Booster Cookie":
+ if (lower.getSizeInventory() < 54) {
+ break;
+ }
+ if (stack != lower.getStackInSlot(51)) {//if we didn't go into this case from the skyblock menu
+ stack = lower.getStackInSlot(13);
+ }
+
+ if (stack != null && Utils.cleanColour(stack.getDisplayName()).equals("Booster Cookie") &&
+ stack.getTagCompound() != null) {
+ String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound());
+ for (String line : lore) {
+ if (line.contains("Duration: ")) {
+ String clean = line.replaceAll("(\u00a7.)", "");
+ clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
+ String[] cleanSplit = clean.split(" ");
+ String[] removeDuration = Arrays.copyOfRange(cleanSplit, 1, cleanSplit.length);
+ hidden.cookieBuffRemaining = currentTime;
+ for (int i = 0; i + 1 < removeDuration.length; i++) {
+ if (i % 2 == 1) continue;
+
+ String number = removeDuration[i];
+ String unit = removeDuration[i + 1];
+ try {
+ long val = Integer.parseInt(number);
+ switch (unit) {
+ case "Years":
+ case "Year":
+ hidden.cookieBuffRemaining += val * 365 * 24 * 60 * 60 * 1000;
+ break;
+ case "Months":
+ case "Month":
+ hidden.cookieBuffRemaining += val * 30 * 24 * 60 * 60 * 1000;
+ break;
+ case "Days":
+ case "Day":
+ case "d":
+ hidden.cookieBuffRemaining += val * 24 * 60 * 60 * 1000;
+ break;
+ case "Hours":
+ case "Hour":
+ case "h":
+ hidden.cookieBuffRemaining += val * 60 * 60 * 1000;
+ break;
+ case "Minutes":
+ case "Minute":
+ case "m":
+ hidden.cookieBuffRemaining += val * 60 * 1000;
+ break;
+ case "Seconds":
+ case "Second":
+ case "s":
+ hidden.cookieBuffRemaining += val * 1000;
+ break;
+ }
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ hidden.cookieBuffRemaining = 0;
+ if (!hasErrorMessage) {
+ Utils.addChatMessage(
+ EnumChatFormatting.YELLOW + "[NEU] Unable to work out your cookie buff timer");
+ hasErrorMessage = true;
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+ break;
}
}
- boolean foundCookieBuffText = false;
boolean foundGodPotText = false;
boolean foundEffectsText = false;
if (SBInfo.getInstance().getLocation() != null && !SBInfo.getInstance().getLocation().equals("dungeon") &&
@@ -354,63 +451,6 @@ public class TimersOverlay extends TextTabOverlay {
hidden.godPotionDuration = godPotDuration;
- } else if (line.contains("\u00a7d\u00a7lCookie Buff")) {
- foundCookieBuffText = true;
- } else if (foundCookieBuffText) {
- String clean = line.replaceAll("(\u00a7.)", "");
- clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
- String[] cleanSplit = clean.split(" ");
- hidden.cookieBuffRemaining = 0;
- if (line.contains("Not")) break;
-
- for (int i = 0; i + 1 < cleanSplit.length; i++) {
- if (i % 2 == 1) continue;
-
- String number = cleanSplit[i];
- String unit = cleanSplit[i + 1];
- try {
- long val = Integer.parseInt(number);
- switch (unit) {
- case "Years":
- case "Year":
- hidden.cookieBuffRemaining += val * 365 * 24 * 60 * 60 * 1000;
- break;
- case "Months":
- case "Month":
- hidden.cookieBuffRemaining += val * 30 * 24 * 60 * 60 * 1000;
- break;
- case "Days":
- case "Day":
- hidden.cookieBuffRemaining += val * 24 * 60 * 60 * 1000;
- break;
- case "Hours":
- case "Hour":
- case "h":
- hidden.cookieBuffRemaining += val * 60 * 60 * 1000;
- break;
- case "Minutes":
- case "Minute":
- case "m":
- hidden.cookieBuffRemaining += val * 60 * 1000;
- break;
- case "Seconds":
- case "Second":
- case "s":
- hidden.cookieBuffRemaining += val * 1000;
- break;
- }
- } catch (NumberFormatException e) {
- e.printStackTrace();
- hidden.cookieBuffRemaining = 0;
- if (!hasErrorMessage) {
- Utils.addChatMessage(EnumChatFormatting.YELLOW + "[NEU] Unable to work out your cookie buff timer");
- hasErrorMessage = true;
- }
- break;
- }
- }
-
- break;
}
}
}
@@ -484,7 +524,7 @@ public class TimersOverlay extends TextTabOverlay {
1,
DARK_AQUA + "Cookie Buff: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] +
- Utils.prettyTime(hidden.cookieBuffRemaining)
+ Utils.prettyTime(hidden.cookieBuffRemaining - currentTime)
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.SOON.ordinal() &&
hidden.cookieBuffRemaining < TimeEnums.HALFDAY.time) {
@@ -492,7 +532,7 @@ public class TimersOverlay extends TextTabOverlay {
1,
DARK_AQUA + "Cookie Buff: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] +
- Utils.prettyTime(hidden.cookieBuffRemaining)
+ Utils.prettyTime(hidden.cookieBuffRemaining - currentTime)
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.KINDASOON.ordinal() &&
hidden.cookieBuffRemaining < TimeEnums.DAY.time) {
@@ -500,14 +540,14 @@ public class TimersOverlay extends TextTabOverlay {
1,
DARK_AQUA + "Cookie Buff: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] +
- Utils.prettyTime(hidden.cookieBuffRemaining)
+ Utils.prettyTime(hidden.cookieBuffRemaining - currentTime)
);
} 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)
+ Utils.prettyTime(hidden.cookieBuffRemaining - currentTime)
);
}
@@ -595,11 +635,11 @@ public class TimersOverlay extends TextTabOverlay {
);
}
- long midnightReset = (currentTime - 18000000) / 86400000 * 86400000 + 18000000; // 12am est
+ long midnightReset = (currentTime - 18000000) / TimeEnums.DAY.time * TimeEnums.DAY.time + 18000000; // 12am est
long pearlsReset = midnightReset - 18000000; //8pm est
- long catacombsReset = currentTime / 86400000 * 86400000; // 7pm est
- long timeDiffMidnightNow = midnightReset + 86400000 - currentTime;
- long catacombsDiffNow = catacombsReset + 86400000 - currentTime;
+ long catacombsReset = currentTime / TimeEnums.DAY.time * TimeEnums.DAY.time; // 7pm est
+ long timeDiffMidnightNow = midnightReset + TimeEnums.DAY.time - currentTime;
+ long catacombsDiffNow = catacombsReset + TimeEnums.DAY.time - currentTime;
long fetchurComplete = hidden.fetchurCompleted;
//Fetchur Display
@@ -647,7 +687,7 @@ public class TimersOverlay extends TextTabOverlay {
map.put(
5,
DARK_AQUA + "Commissions: " +
- EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour] + "Ready!"
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour] + "Ready! "
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.VERYSOON.ordinal() &&
(hidden.commissionsCompleted < (midnightReset - TimeEnums.HALFANHOUR.time))) {
@@ -683,49 +723,47 @@ public class TimersOverlay extends TextTabOverlay {
}
//Experiment Display
- if (hidden.experimentsCompleted < midnightReset) {
+ if (hidden.experimentsCompleted < catacombsReset) {
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))) {
+ (hidden.experimentsCompleted < (catacombsReset - TimeEnums.HALFANHOUR.time))) {
map.put(
6,
DARK_AQUA + "Experiments: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] +
- Utils.prettyTime(catacombsReset + 86400000 - currentTime)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.SOON.ordinal() &&
- (hidden.experimentsCompleted < (midnightReset - TimeEnums.HOUR.time))) {
+ (hidden.experimentsCompleted < (catacombsReset - TimeEnums.HOUR.time))) {
map.put(
6,
DARK_AQUA + "Experiments: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] +
- Utils.prettyTime(catacombsReset + 86400000 - currentTime)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (
NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.KINDASOON.ordinal() &&
- (hidden.experimentsCompleted < (midnightReset - (TimeEnums.HOUR.time * 3)))) {
+ (hidden.experimentsCompleted < (catacombsReset - (TimeEnums.HOUR.time * 3)))) {
map.put(
6,
DARK_AQUA + "Experiments: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] +
- Utils.prettyTime(catacombsReset + 86400000 - currentTime)
+ Utils.prettyTime(catacombsDiffNow)
);
} 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(catacombsReset + 86400000 - currentTime)
+ Utils.prettyTime(catacombsDiffNow)
);
}
// Daily Mithril Powder display
- long mithrilPowderCompleted = hidden.dailyMithrilPowerCompleted + 1000 * 60 * 60 * 24 - currentTime;
-
if (hidden.dailyMithrilPowerCompleted < catacombsReset) {
map.put(
7,
@@ -853,12 +891,13 @@ public class TimersOverlay extends TextTabOverlay {
Utils.prettyTime(pearlsReset + 86400000 - currentTime)
);
}
-
+ //Daily Crimson Isle Quests
if (hidden.questBoardCompleted < midnightReset) {
map.put(
10,
DARK_AQUA + "Crimson Isle Quests: " +
- EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour] + "Ready!"
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour] +
+ (5 - SBInfo.getInstance().completedQuests.size()) + " left!"
);
} else if (
NotEnoughUpdates.INSTANCE.config.miscOverlays.questBoardDisplay >= DISPLAYTYPE.VERYSOON.ordinal() &&
@@ -895,6 +934,48 @@ public class TimersOverlay extends TextTabOverlay {
);
}
+ //Daily Shop Limit
+ if (hidden.dailyShopLimitCompleted < catacombsReset) {
+ map.put(
+ 11,
+ DARK_AQUA + "NPC Buy Daily Limit: " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour] + "Ready!"
+ );
+ } else if (
+ NotEnoughUpdates.INSTANCE.config.miscOverlays.shopLimitDisplay >= DISPLAYTYPE.VERYSOON.ordinal() &&
+ (hidden.dailyShopLimitCompleted < (catacombsReset - TimeEnums.HALFANHOUR.time))) {
+ map.put(
+ 11,
+ DARK_AQUA + "NPC Buy Daily Limit: " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] +
+ Utils.prettyTime(catacombsDiffNow)
+ );
+ } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.shopLimitDisplay >= DISPLAYTYPE.SOON.ordinal() &&
+ (hidden.dailyShopLimitCompleted < (catacombsReset - TimeEnums.HOUR.time))) {
+ map.put(
+ 11,
+ DARK_AQUA + "NPC Buy Daily Limit: " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] +
+ Utils.prettyTime(catacombsDiffNow)
+ );
+ } else if (
+ NotEnoughUpdates.INSTANCE.config.miscOverlays.shopLimitDisplay >= DISPLAYTYPE.KINDASOON.ordinal() &&
+ (hidden.dailyShopLimitCompleted < (catacombsReset - (TimeEnums.HOUR.time * 3)))) {
+ map.put(
+ 11,
+ DARK_AQUA + "NPC Buy Daily Limit: " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] +
+ Utils.prettyTime(catacombsDiffNow)
+ );
+ } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.shopLimitDisplay >= DISPLAYTYPE.ALWAYS.ordinal()) {
+ map.put(
+ 11,
+ DARK_AQUA + "NPC Buy Daily Limit: " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] +
+ Utils.prettyTime(catacombsDiffNow)
+ );
+ }
+
overlayStrings = new ArrayList<>();
for (int index : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) {
if (map.containsKey(index)) {
@@ -944,7 +1025,7 @@ public class TimersOverlay extends TextTabOverlay {
}
public static void processActionBar(String msg) {
- if (SBInfo.getInstance().location.equals("Belly of the Beast")) {
+ if (SBInfo.getInstance().location.equals("Belly of the Beast") && msg.contains("Pearls Collected")) {
try {
msg = Utils.cleanColour(msg);
msg = msg.substring(msg.indexOf("Pearls Collected: ") + 18);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
index 265177fc..266722e5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
@@ -313,17 +313,19 @@ public class BasicPage extends GuiProfileViewerPage {
} else if (networth == -1) {
networth = profile.getNetWorth(profileId);
}
-
+ int fontWidth = fr.getStringWidth("Net Worth: " + GuiProfileViewer.numberFormat.format(networth));
+ int offset = (fontWidth >= 117 ? 63 + (fontWidth - 117) : 63);
if (networth > 0) {
- Utils.drawStringCentered(
- EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD +
- GuiProfileViewer.numberFormat.format(networth),
- fr,
- guiLeft + 165,
- guiTop + 38,
- true,
- 0
- );
+ if (fontWidth >= 117) {
+ fr.drawString(EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD +
+ GuiProfileViewer.numberFormat.format(networth), guiLeft + 8, guiTop + 38 - fr.FONT_HEIGHT / 2f, 0, true);
+ } else {
+ Utils.drawStringCentered(
+ EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD +
+ GuiProfileViewer.numberFormat.format(networth),
+ guiLeft + 68, guiTop + 38, true, 0
+ );
+ }
if (NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE") != null &&
NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE").has("avg_buy")) {
double networthInCookies =
@@ -337,8 +339,8 @@ public class BasicPage extends GuiProfileViewerPage {
String networthIRLMoney = GuiProfileViewer.numberFormat.format(Math.round(
((networthInCookies * 325) / 675) * 4.99));
- int fontWidth = fr.getStringWidth("Net Worth: " + GuiProfileViewer.numberFormat.format(networth));
- if (mouseX > guiLeft + 165 - fontWidth / 2 && mouseX < guiLeft + 165 + fontWidth / 2) {
+
+ if (mouseX > guiLeft + offset - fontWidth / 2 && mouseX < guiLeft + offset + fontWidth / 2) {
if (mouseY > guiTop + 32 && mouseY < guiTop + 38 + fr.FONT_HEIGHT) {
getInstance().tooltipToDisplay = new ArrayList<>();
getInstance()
@@ -384,14 +386,17 @@ public class BasicPage extends GuiProfileViewerPage {
}
}
} else {
- Utils.drawStringCentered(
- EnumChatFormatting.GREEN + "Net Worth: " + stateStr,
- fr,
- guiLeft + 165,
- guiTop + 38,
- true,
- 0
- );
+ int errFontWidth = fr.getStringWidth("Net Worth: " + stateStr);
+ if (errFontWidth >= 117) {
+ fr.drawString(EnumChatFormatting.GREEN + "Net Worth: " + stateStr,
+ guiLeft + 8, guiTop + 38 - fr.FONT_HEIGHT / 2f, 0, true
+ );
+ } else {
+ Utils.drawStringCentered(
+ EnumChatFormatting.GREEN + "Net Worth: " + stateStr,
+ guiLeft + 63, guiTop + 38, true, 0
+ );
+ }
}
if (status != null) {
@@ -425,7 +430,7 @@ public class BasicPage extends GuiProfileViewerPage {
statusStr += EnumChatFormatting.GRAY + " - " + EnumChatFormatting.GREEN + locationStr;
}
- Utils.drawStringCentered(statusStr, fr, guiLeft + 63, guiTop + 160, true, 0);
+ Utils.drawStringCentered(statusStr, guiLeft + 63, guiTop + 160, true, 0);
}
if (entityPlayer == null) {
@@ -585,14 +590,14 @@ public class BasicPage extends GuiProfileViewerPage {
GlStateManager.scale(1.5f, 1.5f, 1);
Utils.drawItemStack(skull, 0, 0);
GlStateManager.popMatrix();
- Utils.drawStringCenteredScaled(skyblockLevelColour.toString() + (int) skyblockLevel, fr,
+ Utils.drawStringCenteredScaled(skyblockLevelColour.toString() + (int) skyblockLevel,
sbLevelX + 9, sbLevelY - 12, true, 1.5f
);
float progress = (float) (skyblockLevel - (long) skyblockLevel);
getInstance().renderBar(sbLevelX - 30, sbLevelY + 30, 80, progress);
- Utils.drawStringScaled(EnumChatFormatting.YELLOW.toString() + (int) (progress * 100) + "/100", fr,
+ Utils.drawStringScaled(EnumChatFormatting.YELLOW.toString() + (int) (progress * 100) + "/100",
sbLevelX - 30, sbLevelY + 20, true, 0, 0.9f
);
@@ -708,11 +713,7 @@ public class BasicPage extends GuiProfileViewerPage {
} else {
Utils.drawStringCentered(
EnumChatFormatting.RED + "Skills API not enabled!",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 322,
- guiTop + 101,
- true,
- 0
+ guiLeft + 322, guiTop + 101, true, 0
);
}
@@ -793,18 +794,14 @@ public class BasicPage extends GuiProfileViewerPage {
"Senither Weight: " +
EnumChatFormatting.GOLD +
GuiProfileViewer.numberFormat.format(roundToNearestInt(senitherWeight.getTotalWeight().getRaw())),
- fr,
- guiLeft + 165,
- guiTop + 18,
- true,
- 0
+ guiLeft + 63, guiTop + 18, true, 0
);
int textWidth = fr.getStringWidth(
"Senither Weight: " +
GuiProfileViewer.numberFormat.format(roundToNearestInt(senitherWeight.getTotalWeight().getRaw()))
);
- if (mouseX > guiLeft + 165 - textWidth / 2 && mouseX < guiLeft + 165 + textWidth / 2) {
+ if (mouseX > guiLeft + 63 - textWidth / 2 && mouseX < guiLeft + 63 + textWidth / 2) {
if (mouseY > guiTop + 12 && mouseY < guiTop + 12 + fr.FONT_HEIGHT) {
getInstance().tooltipToDisplay = new ArrayList<>();
getInstance()
@@ -858,20 +855,15 @@ public class BasicPage extends GuiProfileViewerPage {
Utils.drawStringCentered(
EnumChatFormatting.GREEN +
- "Lily Weight: " +
- EnumChatFormatting.GOLD +
+ "Lily Weight: " + EnumChatFormatting.GOLD +
GuiProfileViewer.numberFormat.format(roundToNearestInt(lilyWeight.getTotalWeight().getRaw())),
- fr,
- guiLeft + 165,
- guiTop + 28,
- true,
- 0
+ guiLeft + 63, guiTop + 28, true, 0
);
int fontWidth = fr.getStringWidth(
"Lily Weight: " + GuiProfileViewer.numberFormat.format(roundToNearestInt(lilyWeight.getTotalWeight().getRaw()))
);
- if (mouseX > guiLeft + 165 - fontWidth / 2 && mouseX < guiLeft + 165 + fontWidth / 2) {
+ if (mouseX > guiLeft + 63 - fontWidth / 2 && mouseX < guiLeft + 63 + fontWidth / 2) {
if (mouseY > guiTop + 22 && mouseY < guiTop + 22 + fr.FONT_HEIGHT) {
getInstance().tooltipToDisplay = new ArrayList<>();
getInstance()
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java
index ab80afab..cc5fc92f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BingoPage.java
@@ -126,15 +126,7 @@ public class BingoPage extends GuiProfileViewerPage {
y = communityGoal ? y - 1 : y;
if (mouseX >= x && mouseX < x + 24) {
if (mouseY >= y && mouseY <= y + 24) {
- Utils.drawHoveringText(
- getTooltip(bingoGoal, completed, communityGoal),
- mouseX,
- mouseY,
- width,
- height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(getTooltip(bingoGoal, completed, communityGoal), mouseX, mouseY, width, height, -1);
}
}
col++;
@@ -161,15 +153,8 @@ public class BingoPage extends GuiProfileViewerPage {
EnumChatFormatting.WHITE +
20;
}
- Utils.drawStringF(totalPointsString, Minecraft.getMinecraft().fontRendererObj, guiLeft + 22, guiTop + 19, true, 0);
- Utils.drawStringF(
- personalGoalsString,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 22,
- guiTop + 31,
- true,
- 0
- );
+ Utils.drawStringF(totalPointsString, guiLeft + 22, guiTop + 19, true, 0);
+ Utils.drawStringF(personalGoalsString, guiLeft + 22, guiTop + 31, true, 0);
GlStateManager.enableLighting();
}
@@ -299,14 +284,7 @@ public class BingoPage extends GuiProfileViewerPage {
private void showMissingDataMessage(int guiLeft, int guiTop) {
String message = EnumChatFormatting.RED + "No Bingo data for current event!";
- Utils.drawStringCentered(
- message,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 431 / 2f,
- guiTop + 101,
- true,
- 0
- );
+ Utils.drawStringCentered(message, guiLeft + 431 / 2f, guiTop + 101, true, 0);
}
private List<String> jsonArrayToStringList(JsonArray completedGoals) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java
index 45d9370b..03be7cf1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CollectionsPage.java
@@ -36,9 +36,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
-import java.math.BigDecimal;
import java.math.BigInteger;
-import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Iterator;
@@ -96,11 +94,7 @@ public class CollectionsPage extends GuiProfileViewerPage {
if (collectionInfo == null) {
Utils.drawStringCentered(
EnumChatFormatting.RED + "Collection API not enabled!",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 134,
- guiTop + 101,
- true,
- 0
+ guiLeft + 134, guiTop + 101, true, 0
);
return;
}
@@ -195,11 +189,7 @@ public class CollectionsPage extends GuiProfileViewerPage {
Utils.drawStringCentered(
selectedCollectionCategory.getDisplayName() + " Collections",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 134,
- guiTop + 14,
- true,
- 4210752
+ guiLeft + 134, guiTop + 14, true, 4210752
);
if (collections != null) {
@@ -292,35 +282,16 @@ public class CollectionsPage extends GuiProfileViewerPage {
GlStateManager.color(1, 1, 1, 1);
if (tier >= 0) {
- Utils.drawStringCentered(
- tierString,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + x + 10,
- guiTop + y - 4,
- true,
- tierStringColour
- );
+ Utils.drawStringCentered(tierString, guiLeft + x + 10, guiTop + y - 4, true, tierStringColour);
}
Utils.drawStringCentered(
- StringUtils.shortNumberFormat(amount) + "",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + x + 10,
- guiTop + y + 26,
- true,
- color.getRGB()
- );
+ StringUtils.shortNumberFormat(amount) + "", guiLeft + x + 10, guiTop + y + 26, true, color.getRGB());
}
}
Utils.drawStringCentered(
- selectedCollectionCategory.getDisplayName() + " Minions",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 326,
- guiTop + 14,
- true,
- 4210752
- );
+ selectedCollectionCategory.getDisplayName() + " Minions", guiLeft + 326, guiTop + 14, true, 4210752);
if (minions != null) {
for (int i = page * 20, j = 0; i < Math.min((page + 1) * 20, minions.size()); i++, j++) {
@@ -409,14 +380,7 @@ public class CollectionsPage extends GuiProfileViewerPage {
GlStateManager.color(1, 1, 1, 1);
if (tier >= 0) {
- Utils.drawStringCentered(
- tierString,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + x + 10,
- guiTop + y - 4,
- true,
- tierStringColour
- );
+ Utils.drawStringCentered(tierString, guiLeft + x + 10, guiTop + y - 4, true, tierStringColour);
}
}
}
@@ -426,15 +390,7 @@ public class CollectionsPage extends GuiProfileViewerPage {
for (String line : tooltipToDisplay) {
grayTooltip.add(EnumChatFormatting.GRAY + line);
}
- Utils.drawHoveringText(
- grayTooltip,
- mouseX,
- mouseY,
- getInstance().width,
- getInstance().height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(grayTooltip, mouseX, mouseY, getInstance().width, getInstance().height, -1);
tooltipToDisplay = null;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java
index 6460003a..454ad989 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java
@@ -109,11 +109,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
if (profileInfo == null || !profileInfo.has("nether_island_player_data")) {
Utils.drawStringCentered(
EnumChatFormatting.RED + "No data found for the Crimson Isles",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 431 / 2f,
- guiTop + 101,
- true,
- 0
+ guiLeft + 431 / 2f, guiTop + 101, true, 0
);
return;
}
@@ -137,14 +133,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
}
public void drawKuudraStats(JsonObject data, int guiLeft, int guiTop, int mouseX, int mouseY) {
- Utils.drawStringCentered(
- EnumChatFormatting.RED + "Kuudra Stats",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + (431 * 0.18f),
- guiTop + 14,
- true,
- 0
- );
+ Utils.drawStringCentered(EnumChatFormatting.RED + "Kuudra Stats", guiLeft + (431 * 0.18f), guiTop + 14, true, 0);
JsonObject kuudraCompletedTiers = data.getAsJsonObject("kuudra_completed_tiers");
@@ -213,14 +202,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
}
public void drawDojoStats(JsonObject data, int guiLeft, int guiTop) {
- Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Dojo Stats",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + (431 * 0.49f),
- guiTop + 14,
- true,
- 0
- );
+ Utils.drawStringCentered(EnumChatFormatting.YELLOW + "Dojo Stats", guiLeft + (431 * 0.49f), guiTop + 14, true, 0);
JsonObject dojoStats = data.getAsJsonObject("dojo");
int[] dojoScores = {0, 0, 0, 0, 0, 0, 0};
@@ -298,11 +280,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
public void drawLastMatriarchAttempt(JsonObject data, int guiLeft, int guiTop) {
Utils.drawStringCentered(
EnumChatFormatting.GOLD + "Last Matriarch Attempt",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + (431 * 0.82f),
- guiTop + 104,
- true,
- 0
+ guiLeft + (431 * 0.82f), guiTop + 104, true, 0
);
JsonObject lastMatriarchAttempt = data.getAsJsonObject("matriarch");
@@ -351,11 +329,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
public void drawFactionReputation(JsonObject data, int guiLeft, int guiTop) {
Utils.drawStringCentered(
EnumChatFormatting.DARK_PURPLE + "Faction Reputation",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + (431 * 0.82f),
- guiTop + 14,
- true,
- 0
+ guiLeft + (431 * 0.82f), guiTop + 14, true, 0
);
String selectedFaction = data.has("selected_faction") ? data.get("selected_faction").getAsString() : "N/A";
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 c379c7eb..a5229acb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -329,7 +329,6 @@ public class GuiProfileViewer extends GuiScreen {
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,
@@ -394,7 +393,6 @@ public class GuiProfileViewer extends GuiScreen {
);
Utils.drawStringCenteredScaledMaxWidth(
"Open in SkyCrypt",
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 50 + 100 + 6,
guiTop + sizeY + 3 + 10,
true,
@@ -437,7 +435,6 @@ public class GuiProfileViewer extends GuiScreen {
String otherProfileId = profile.getProfileNames().get(yIndex);
Utils.drawStringCenteredScaledMaxWidth(
otherProfileId,
- Minecraft.getMinecraft().fontRendererObj,
guiLeft + 50,
guiTop + sizeY + 23 + dropdownOptionSize / 2f + dropdownOptionSize * yIndex,
true,
@@ -529,14 +526,7 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- Utils.drawStringCentered(
- str,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 101,
- true,
- 0
- );
+ Utils.drawStringCentered(str, guiLeft + sizeX / 2f, guiTop + 101, true, 0);
//This is just here to inform the player what to do
//like typing /api new or telling them to go find a psychotherapist
@@ -545,37 +535,21 @@ public class GuiProfileViewer extends GuiScreen {
if (timeDiff > 20000) {
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "Its taking a while...",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 111,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 111, true, 0
);
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "Try \"/api new\".",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 121,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 121, true, 0
);
if (timeDiff > 60000) {
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "Might be hypixel's fault.",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 131,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 131, true, 0
);
if (timeDiff > 180000) {
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "Wow you're still here?",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 141,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 141, true, 0
);
if (timeDiff > 360000) {
long second = (timeDiff / 1000) % 60;
@@ -585,58 +559,32 @@ public class GuiProfileViewer extends GuiScreen {
String time = String.format("%02d:%02d:%02d", hour, minute, second);
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "You've wasted your time here for: " + time,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 151,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 151, true, 0
);
Utils.drawStringCentered(
EnumChatFormatting.YELLOW + "" + EnumChatFormatting.BOLD + "What are you doing with your life?",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 161,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 161, true, 0
);
if (timeDiff > 600000) {
Utils.drawStringCentered(
EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "Maniac",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 171,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 171, true, 0
);
if (timeDiff > 1200000) {
Utils.drawStringCentered(
EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You're a menace to society",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 181,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 181, true, 0
);
if (timeDiff > 1800000) {
Utils.drawStringCentered(
- EnumChatFormatting.RED +
- "" +
- EnumChatFormatting.BOLD +
+ EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD +
"You don't know what's gonna happen to you",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 191,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 191, true, 0
);
if (timeDiff > 3000000) {
Utils.drawStringCentered(
EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You really want this?",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 91,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 91, true, 0
);
if (timeDiff > 3300000) {
Utils.drawStringCentered(
@@ -644,11 +592,7 @@ public class GuiProfileViewer extends GuiScreen {
"" +
EnumChatFormatting.BOLD +
"OW LORD FORGIVE ME FOR THIS",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 71,
- true,
- 0
+ guiLeft + sizeX / 2f, guiTop + 71, true, 0
);
if (timeDiff > 3600000) {
throw new Error("Go do something productive") {
@@ -672,21 +616,13 @@ public class GuiProfileViewer extends GuiScreen {
case INVALID_NAME:
Utils.drawStringCentered(
EnumChatFormatting.RED + "Invalid name or API is down!",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 101,
- true,
- 0
+ 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
+ guiLeft + sizeX / 2f, guiTop + 101, true, 0
);
break;
}
@@ -727,7 +663,7 @@ public class GuiProfileViewer extends GuiScreen {
for (String line : tooltipToDisplay) {
grayTooltip.add(EnumChatFormatting.GRAY + line);
}
- Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
+ Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1);
tooltipToDisplay = null;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java
index 164f5d78..29f84a5b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java
@@ -350,21 +350,10 @@ public class InventoriesPage extends GuiProfileViewerPage {
strToRender = "Inventory API not enabled";
Utils.drawStringCentered(
EnumChatFormatting.RED + "Or has no backpacks!",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 317,
- guiTop + 112,
- true,
- 0
+ guiLeft + 317, guiTop + 112, true, 0
);
}
- Utils.drawStringCentered(
- EnumChatFormatting.RED + strToRender,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 317,
- guiTop + 101,
- true,
- 0
- );
+ Utils.drawStringCentered(EnumChatFormatting.RED + strToRender, guiLeft + 317, guiTop + 101, true, 0);
return;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java
index c8ec09d3..a9dade6a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MiningPage.java
@@ -1453,15 +1453,7 @@ public class MiningPage extends GuiProfileViewerPage {
GlStateManager.enableLighting();
if (mouseX >= xPosition && mouseX < xPosition + 16) {
if (mouseY >= yPosition && mouseY <= yPosition + 16) {
- Utils.drawHoveringText(
- tooltip,
- mouseX,
- mouseY,
- getInstance().width,
- getInstance().height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltip, mouseX, mouseY, getInstance().width, getInstance().height, -1);
}
}
}
@@ -1519,15 +1511,7 @@ public class MiningPage extends GuiProfileViewerPage {
GlStateManager.enableLighting();
if (mouseX >= xPosition && mouseX < xPosition + 16) {
if (mouseY >= yPosition && mouseY <= yPosition + 16) {
- Utils.drawHoveringText(
- tooltip,
- mouseX,
- mouseY,
- getInstance().width,
- getInstance().height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(tooltip, mouseX,mouseY, getInstance().width, getInstance().height, -1);
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java
index 098c252e..a56662e7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PetsPage.java
@@ -148,14 +148,7 @@ public class PetsPage extends GuiProfileViewerPage {
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_pets);
Utils.drawTexturedRect(guiLeft, guiTop, getInstance().sizeX, getInstance().sizeY, GL11.GL_NEAREST);
- Utils.drawStringCentered(
- EnumChatFormatting.DARK_PURPLE + "Pets",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 100,
- guiTop + 14,
- true,
- 4210752
- );
+ Utils.drawStringCentered(EnumChatFormatting.DARK_PURPLE + "Pets", guiLeft + 100, guiTop + 14, true, 4210752);
GlStateManager.color(1, 1, 1, 1);
JsonElement activePetElement = petsInfo.get("active_pet");
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 17a14d1f..62f55fd7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -42,6 +42,7 @@ import net.minecraft.util.EnumChatFormatting;
import javax.annotation.Nullable;
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
@@ -537,6 +538,7 @@ public class ProfileViewer {
manager.apiUtils
.newHypixelApiRequest("player")
.queryArgument("name", nameF)
+ .maxCacheAge(Duration.ofSeconds(30))
.requestJson()
.thenAccept(jsonObject -> {
if (
@@ -961,30 +963,29 @@ public class ProfileViewer {
}
double skyblockLevel = getSkyblockLevel(profileName);
+ EnumChatFormatting levelColour = EnumChatFormatting.WHITE;
- EnumChatFormatting previousColor = EnumChatFormatting.WHITE;
if (Constants.SBLEVELS == null || !Constants.SBLEVELS.has("sblevel_colours")) {
Utils.showOutdatedRepoNotification();
return EnumChatFormatting.WHITE;
}
+
JsonObject sblevelColours = Constants.SBLEVELS.getAsJsonObject("sblevel_colours");
try {
for (Map.Entry<String, JsonElement> stringJsonElementEntry : sblevelColours.entrySet()) {
- int key = Integer.parseInt(stringJsonElementEntry.getKey());
+ int nextLevelBracket = Integer.parseInt(stringJsonElementEntry.getKey());
EnumChatFormatting valueByName = EnumChatFormatting.getValueByName(stringJsonElementEntry
.getValue()
.getAsString());
- if (skyblockLevel <= key) {
- skyBlockExperienceColour.put(profileName, previousColor);
- return previousColor;
+ if (skyblockLevel >= nextLevelBracket) {
+ levelColour = valueByName;
}
- previousColor = valueByName;
}
} catch (RuntimeException ignored) {
// catch both numberformat and getValueByName being wrong
}
- skyBlockExperienceColour.put(profileName, EnumChatFormatting.WHITE);
- return EnumChatFormatting.WHITE;
+ skyBlockExperienceColour.put(profileName, levelColour);
+ return levelColour;
}
public double getSkyblockLevel(String profileName) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java
index 7da6c627..81b99948 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java
@@ -219,18 +219,14 @@ public class BestiaryPage extends GuiProfileViewerPage {
GlStateManager.color(1, 1, 1, 1);
// if (tier >= 0) {
- // Utils.drawStringCentered(tierString, Minecraft.getMinecraft().fontRendererObj,
+ // Utils.drawStringCentered(tierString,
// guiLeft + x + 10, guiTop + y - 4, true,
// tierStringColour
// );
// }
Utils.drawStringCentered(
(int) Math.floor(levelNum) + "",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + x + 10,
- guiTop + y + 26,
- true,
- color.getRGB()
+ guiLeft + x + 10, guiTop + y + 26, true, color.getRGB()
);
}
}
@@ -241,7 +237,7 @@ public class BestiaryPage extends GuiProfileViewerPage {
for (String line : tooltipToDisplay) {
grayTooltip.add(EnumChatFormatting.GRAY + line);
}
- Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
+ Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1);
tooltipToDisplay = null;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java
index 16abf251..770b295a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java
@@ -26,6 +26,7 @@ import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.CoreTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.DungeonTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.EssenceTaskLevel;
+import io.github.moulberry.notenoughupdates.profileviewer.level.task.EventTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.MiscTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.SkillRelatedTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.SlayingTaskLevel;
@@ -61,6 +62,8 @@ public class LevelPage {
private final SlayingTaskLevel slayingTaskLevel;
private final StoryTaskLevel storyTaskLevel;
+ private final EventTaskLevel eventTaskLevel;
+
private static final ResourceLocation pv_levels = new ResourceLocation("notenoughupdates:pv_levels.png");
public LevelPage(GuiProfileViewer instance, BasicPage basicPage) {
@@ -75,6 +78,7 @@ public class LevelPage {
skillRelatedTaskLevel = new SkillRelatedTaskLevel(this);
slayingTaskLevel = new SlayingTaskLevel(this);
storyTaskLevel = new StoryTaskLevel(this);
+ eventTaskLevel = new EventTaskLevel(this);
}
public void drawPage(int mouseX, int mouseY) {
@@ -97,13 +101,14 @@ public class LevelPage {
JsonObject profileInfo = profile.getProfileInformation(profileId);
drawMainBar(skyblockLevel, mouseX, mouseY, guiLeft, guiTop);
- coreTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
dungeonTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
essenceTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
miscTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
skillRelatedTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
slayingTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
storyTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
+ eventTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
+ coreTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
}
public void renderLevelBar(
@@ -175,14 +180,12 @@ public class LevelPage {
renderLevelBar(
"Level",
BasicPage.skull,
- guiLeft + 163,
- guiTop + 30,
+ guiLeft + 163, guiTop + 30,
110,
skyblockLevel,
- (skyblockLevel - (long) skyblockLevel) * 100,
+ Math.round((skyblockLevel - (long) skyblockLevel) * 100),
100,
- mouseX,
- mouseY,
+ mouseX, mouseY,
false,
Collections.emptyList()
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
index be333359..8eb577d2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
@@ -19,8 +19,9 @@
package io.github.moulberry.notenoughupdates.profileviewer.level.task;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -80,11 +81,20 @@ public class CoreTaskLevel {
}
// mp acc
- int sbXpGainedMp = levelPage.getProfile().getMagicalPower(levelPage.getProfileId());
+ int sbXpGainedMp = 0;
+ if (object.has("accessory_bag_storage") &&
+ object.getAsJsonObject("accessory_bag_storage").has("highest_magical_power")) {
+ sbXpGainedMp = object.getAsJsonObject("accessory_bag_storage").get("highest_magical_power").getAsInt();
+ }
// pets
- int petScore = PlayerStats.getPetScore(object);
+ int petScore = 0;
+ if (object.has("leveling") &&
+ object.getAsJsonObject("leveling").has("highest_pet_score")) {
+ petScore = object.getAsJsonObject("leveling").get("highest_pet_score").getAsInt();
+
+ }
int sbXpPetScore = petScore * coreTask.get("pet_score_xp").getAsInt();
// museum is not possible
@@ -116,13 +126,33 @@ public class CoreTaskLevel {
}
}
}
+
+ int sbXpBankUpgrades = 0;
+ if (object.has("leveling") && object.getAsJsonObject("leveling").has("completed_tasks")) {
+ JsonArray completedTasks = object.getAsJsonObject("leveling").get("completed_tasks").getAsJsonArray();
+ JsonObject bankUpgradesXp = coreTask.getAsJsonObject("bank_upgrades_xp");
+ for (JsonElement completedTask : completedTasks) {
+ String name = completedTask.getAsString();
+ if (bankUpgradesXp.has(name)) {
+ sbXpBankUpgrades += bankUpgradesXp.get(name).getAsInt();
+ }
+ }
+ }
+
List<String> lore = new ArrayList<>();
lore.add(levelPage.buildLore("Skill Level Up",
sbXpGainedSkillLVL, coreTask.get("skill_level_up").getAsInt(), false
));
- lore.add(levelPage.buildLore("Museum Progression",
- 0, 0, false
+
+ int totalXp = sbXpGainedSkillLVL + sbXpGainedFairy +
+ sbXpCollection + sbXpMinionTier + sbXpBankUpgrades;
+
+ lore.add(levelPage.buildLore(
+ "Museum Progression",
+ 0,
+ 0,
+ false
));
lore.add(levelPage.buildLore(
"Fairy Soul",
@@ -141,21 +171,18 @@ public class CoreTaskLevel {
sbXpMinionTier, coreTask.get("craft_minions").getAsInt(), false
));
lore.add(levelPage.buildLore("Bank Upgrade",
- 0, 0, false
+ sbXpBankUpgrades, coreTask.get("bank_upgrades").getAsInt(), false
));
levelPage.renderLevelBar(
"Core Task",
new ItemStack(Items.nether_star),
- guiLeft + 23,
- guiTop + 25,
+ guiLeft + 23, guiTop + 25,
110,
0,
- sbXpGainedSkillLVL + sbXpGainedFairy +
- sbXpCollection + sbXpMinionTier,
+ totalXp,
levelPage.getConstant().getAsJsonObject("category_xp").get("core_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java
index 6f0a029f..6900cdf3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java
@@ -44,9 +44,9 @@ public class DungeonTaskLevel {
Map<String, ProfileViewer.Level> skyblockInfo =
levelPage.getProfile().getSkyblockInfo(levelPage.getProfileId());
- double sbLevelGainedFloor = 0;
- double sbXpGainedClass = 0;
- double sbXpGainedLvl = 0;
+ int sbLevelGainedFloor = 0;
+ int sbXpGainedClass = 0;
+ int sbXpGainedLvl = 0;
int catacombsLvl = 0;
if (skyblockInfo != null && skyblockInfo.containsKey("catacombs")) {
ProfileViewer.Level catacombs = skyblockInfo.get("catacombs");
@@ -105,20 +105,20 @@ public class DungeonTaskLevel {
lore.add(levelPage.buildLore("Class Level Up", sbXpGainedClass, classLevelUp, false));
lore.add(levelPage.buildLore("Complete Dungeons", sbLevelGainedFloor, completeDungeon, false));
+ int totalSbXpGain = sbXpGainedLvl + sbXpGainedClass + sbLevelGainedFloor;
+
levelPage.renderLevelBar(
"Dungeon Task",
NotEnoughUpdates.INSTANCE.manager
.createItemResolutionQuery()
.withKnownInternalName("WITHER_RELIC")
.resolveToItemStack(),
- guiLeft + 23,
- guiTop + 55,
+ guiLeft + 23, guiTop + 55,
110,
catacombsLvl,
totalXp,
totalGainful,
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
index 11e291b0..c6df6fc1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
@@ -25,6 +25,7 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
@@ -88,10 +89,15 @@ public class EssenceTaskLevel {
for (Map.Entry<String, EssenceShop> stringEssenceShopEntry : loreMap.entrySet()) {
String key = stringEssenceShopEntry.getKey();
EssenceShop value = stringEssenceShopEntry.getValue();
- value.name = NotEnoughUpdates.INSTANCE.manager
+ JsonObject jsonObject = NotEnoughUpdates.INSTANCE.manager
.createItemResolutionQuery()
.withKnownInternalName(key)
- .resolveToItemListJson()
+ .resolveToItemListJson();
+ if (jsonObject == null){
+ Utils.showOutdatedRepoNotification();
+ continue;
+ }
+ value.name = jsonObject
.get("displayname")
.getAsString();
String name = key.toLowerCase() + "_shop";
@@ -111,14 +117,12 @@ public class EssenceTaskLevel {
NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery()
.withKnownInternalName("ESSENCE_WITHER")
.resolveToItemStack(),
- guiLeft + 299,
- guiTop + 25,
+ guiLeft + 299, guiTop + 25,
110,
total,
total,
categoryXp.get("essence_shop_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
new file mode 100644
index 00000000..a5dc994a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.profileviewer.level.task;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class EventTaskLevel {
+
+ private final LevelPage levelPage;
+
+ public EventTaskLevel(LevelPage levelPage) {this.levelPage = levelPage;}
+
+ public void drawTask(JsonObject object, int mouseX, int mouseY, int guiLeft, int guiTop) {
+ List<String> lore = new ArrayList<>();
+
+ int sbXpMiningFiesta = 0;
+ int sbXpFishingFestival = 0;
+ int sbXpSpookyFestival = 0;
+ JsonObject constant = levelPage.getConstant();
+ JsonObject eventTask = constant.getAsJsonObject("event_task");
+
+ if (object.has("leveling")) {
+ JsonObject leveling = object.getAsJsonObject("leveling");
+ int miningFiestaOresMined = 0;
+ int fishingFestivalSharksKilled = 0;
+ if (leveling.has("mining_fiesta_ores_mined"))
+ miningFiestaOresMined = leveling.get("mining_fiesta_ores_mined").getAsInt();
+ if (leveling.has("fishing_festival_sharks_killed")) fishingFestivalSharksKilled = leveling.get(
+ "fishing_festival_sharks_killed").getAsInt();
+
+ sbXpMiningFiesta = getCapOrAmount(miningFiestaOresMined, 1_000_000, 5_000);
+ sbXpFishingFestival = getCapOrAmount(fishingFestivalSharksKilled, 5_000, 50);
+
+ if (leveling.has("completed_tasks")) {
+ JsonArray completedTasks = leveling.get("completed_tasks").getAsJsonArray();
+ JsonObject spookyFestivalXp = eventTask.getAsJsonObject("spooky_festival_xp");
+ for (JsonElement completedTask : completedTasks) {
+ String name = completedTask.getAsString();
+ if (spookyFestivalXp.has(name)) {
+ sbXpSpookyFestival += spookyFestivalXp.get(name).getAsInt();
+ }
+ }
+ }
+ }
+
+ lore.add(levelPage.buildLore("Mining Fiesta", sbXpMiningFiesta, eventTask.get("mining_fiesta").getAsInt(), false));
+ lore.add(levelPage.buildLore(
+ "Fishing Festival",
+ sbXpFishingFestival,
+ eventTask.get("fishing_festival").getAsInt(),
+ false
+ ));
+ lore.add(levelPage.buildLore(
+ "Spooky Festival",
+ sbXpSpookyFestival,
+ eventTask.get("spooky_festival").getAsInt(),
+ false
+ ));
+
+ int totalXp = sbXpMiningFiesta + sbXpSpookyFestival +
+ sbXpFishingFestival;
+ levelPage.renderLevelBar(
+ "Event Task",
+ new ItemStack(Items.clock),
+ guiLeft + 299, guiTop + 115,
+ 110,
+ 0,
+ totalXp,
+ levelPage.getConstant().getAsJsonObject("category_xp").get("event_task").getAsInt(),
+ mouseX, mouseY,
+ true,
+ lore
+ );
+ }
+
+ private int getCapOrAmount(int miningFiestaOresMined, int cap, int per) {
+ if (miningFiestaOresMined == 0) return 0;
+ if (miningFiestaOresMined > cap) {
+ return cap / per;
+ }
+ return miningFiestaOresMined / per;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
index e0ea89b3..f78052f5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
@@ -27,12 +27,13 @@ import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
public class MiscTaskLevel {
@@ -86,24 +87,29 @@ public class MiscTaskLevel {
}
// abiphone
- if (netherIslandPlayerData.has("abiphone")) {
+ JsonObject leveling = object.getAsJsonObject("leveling");
+ if (leveling != null && leveling.has("completed_tasks")) {
+ JsonArray completedTask = leveling.get("completed_tasks").getAsJsonArray();
+ Stream<JsonElement> stream = StreamSupport.stream(completedTask.spliterator(), true);
+ long activeContacts = stream.map(JsonElement::getAsString).filter(s -> s.startsWith("ABIPHONE_")).count();
JsonObject abiphone = netherIslandPlayerData.getAsJsonObject("abiphone");
- if (abiphone.has("active_contacts")) sbXpAbiphone =
- abiphone.getAsJsonArray("active_contacts").size() * miscellaneousTask.get("abiphone_contacts_xp").getAsInt();
+ if (abiphone.has("active_contacts")) {
+ sbXpAbiphone = (int) activeContacts * miscellaneousTask.get("abiphone_contacts_xp").getAsInt();
+ }
}
}
// harp
int sbXpGainedHarp = 0;
JsonObject harpSongsNames = miscellaneousTask.get("harp_songs_names").getAsJsonObject();
- if (object.has("harp_quest")) {
- JsonObject harpQuest = object.get("harp_quest").getAsJsonObject();
- for (Map.Entry<String, JsonElement> stringJsonElementEntry : harpSongsNames.entrySet()) {
- String key = stringJsonElementEntry.getKey();
- int value = stringJsonElementEntry.getValue().getAsInt();
- if (harpQuest.has(key)) {
- sbXpGainedHarp += value;
- }
+
+ JsonObject leveling = object.getAsJsonObject("leveling");
+ if (leveling != null && leveling.has("completed_tasks")) {
+ JsonArray completedTasks = leveling.get("completed_tasks").getAsJsonArray();
+ for (JsonElement completedTask : completedTasks) {
+ String name = completedTask.getAsString();
+ String harpName = name.substring(0, name.lastIndexOf("_"));
+ if(harpSongsNames.has(harpName))sbXpGainedHarp += harpSongsNames.get(harpName).getAsInt() / 4;
}
}
@@ -158,10 +164,10 @@ public class MiscTaskLevel {
sbXpDojo, miscellaneousTask.get("the_dojo").getAsInt(), false
));
lore.add(levelPage.buildLore(
- EnumChatFormatting.ITALIC + "Harp Songs",
+ "Harp Songs",
sbXpGainedHarp, miscellaneousTask.get("harp_songs").getAsInt(), false
));
- lore.add(levelPage.buildLore(EnumChatFormatting.ITALIC + "Abiphone Contacts",
+ lore.add(levelPage.buildLore("Abiphone Contacts",
sbXpAbiphone, miscellaneousTask.get("abiphone_contacts").getAsInt(), false
));
lore.add(levelPage.buildLore("Community Shop Upgrades",
@@ -171,22 +177,22 @@ public class MiscTaskLevel {
sbXpPersonalBank, miscellaneousTask.get("personal_bank_upgrades").getAsInt(), false
));
+ int totalXp = sbXpReaperPeppers + sbXpDojo + sbXpGainedHarp + sbXpAbiphone +
+ sbXpCommunityUpgrade + sbXpPersonalBank;
levelPage.renderLevelBar(
"Misc. Task",
new ItemStack(Items.map),
- guiLeft + 299,
- guiTop + 55,
+ guiLeft + 299, guiTop + 55,
110,
0,
- sbXpReaperPeppers + sbXpDojo + sbXpGainedHarp + sbXpAbiphone +
- sbXpCommunityUpgrade + sbXpPersonalBank,
+ totalXp,
levelPage.getConstant().getAsJsonObject("category_xp").get("miscellaneous_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
+ totalXp += sbXpAccessoryUpgrade + sbXpUnlockedPowers;
}
private int getRankIndex(int pointsTotal) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
index 4ba7951c..176fc899 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
@@ -43,13 +43,6 @@ public class SkillRelatedTaskLevel {
JsonObject skillRelatedTask = levelPage.getConstant().get("skill_related_task").getAsJsonObject();
JsonObject miningObj = skillRelatedTask.get("mining").getAsJsonObject();
- float mithrilPowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_mithril"), 0);
- float gemstonePowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_gemstone"), 0);
- float mithril = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_mithril"), 0) +
- mithrilPowder;
- float gemstone = (Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_gemstone"), 0)) +
- gemstonePowder;
-
float hotmXp = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.experience"), 0);
ProfileViewer.Level levelObjHotm =
ProfileViewer.getLevel(
@@ -66,29 +59,31 @@ public class SkillRelatedTaskLevel {
hotmXP += hotmXpArray.get(i - 1).getAsInt();
}
- int gainByFirstMithrilThing;
- if (mithril >= 350_000) {
- gainByFirstMithrilThing = (int) (350000 / 2400d);
- mithril -= 350_000;
- } else {
- gainByFirstMithrilThing = (int) (mithril / 2400d);
- mithril = 0;
- }
+ float mithrilPowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_mithril"), 0);
+ float gemstonePowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_gemstone"), 0);
+ float mithril = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_mithril"), 0) +
+ mithrilPowder;
+ float gemstone = (Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_gemstone"), 0)) +
+ gemstonePowder;
- int gainByFirstGemstoneThing;
- if (gemstone >= 350_000) {
- gainByFirstGemstoneThing = (int) (350_000 / 2500d);
- gemstone -= 350_000;
- } else {
- gainByFirstGemstoneThing = (int) (gemstone / 2500d);
- gemstone = 0;
- }
+ // PUNKT NULL
+
+ double totalMithril = mithril + mithrilPowder;
+ double totalGemstone = gemstone + gemstonePowder;
+ double mithrilUnder = Math.min(350000.0, totalMithril);
+ double mithrilOver = Math.max(0, Math.min(totalMithril, 12_500_000.0) - 350000.0);
+ double gemstoneUnder = Math.min(350000.0, totalGemstone);
+ double gemstoneOver = Math.max(0, Math.min(totalGemstone, 20_000_000.0) - 350000.0);
- int sbXpMithrilPowder = (int) powder(3.75, mithril, 12_500_000);
- int sbXpGemstonePowder = (int) powder(4.25, gemstone, 20_000_000);
+ double mithrilXP = Math.floor(mithrilUnder / 2400.0);
+ double gemstoneXP = Math.floor(gemstoneUnder / 2500.0);
+ double mithrilExcess = Math.floor(
+ 3.75 * (Math.sqrt(1 + 8 * Math.sqrt((1758267.0 / 12_500_000.0) * mithrilOver + 9)) - 3));
+ double gemstoneExcess = Math.floor(
+ 4.25 * (Math.sqrt(1 + 8 * Math.sqrt((1758267.0 / 20_000_000.0) * gemstoneOver + 9)) - 3));
double sbXpHotmTier =
- (sbXpMithrilPowder + gainByFirstMithrilThing) + (sbXpGemstonePowder + gainByFirstGemstoneThing)
+ (mithrilXP + mithrilExcess) + (gemstoneXP + gemstoneExcess)
+ hotmXP;
int sbXpPotmTier = 0;
@@ -171,6 +166,18 @@ public class SkillRelatedTaskLevel {
}
}
+ int sbXpNucleus = 0;
+ JsonObject leveling = object.getAsJsonObject("leveling");
+ if (leveling != null && leveling.has("completions") && leveling.getAsJsonObject("completions").has("NUCLEUS_RUNS")) {
+ int nucleusRuns = leveling.getAsJsonObject("completions").get("NUCLEUS_RUNS").getAsInt();
+ JsonElement nucleusXp = miningObj.get("crystal_nucleus_xp");
+ if (nucleusXp == null) {
+ Utils.showOutdatedRepoNotification();
+ } else {
+ sbXpNucleus += nucleusRuns * nucleusXp.getAsInt();
+ }
+ }
+
List<String> lore = new ArrayList<>();
lore.add(levelPage.buildLore("Heart of the Mountain", sbXpHotmTier, miningObj.get("hotm").getAsInt(), false));
lore.add(levelPage.buildLore(
@@ -179,7 +186,7 @@ public class SkillRelatedTaskLevel {
miningObj.get("commission_milestone").getAsInt(),
false
));
- lore.add(levelPage.buildLore("Crystal Nucleus", 0, 0, false));
+ lore.add(levelPage.buildLore("Crystal Nucleus", sbXpNucleus, miningObj.get("crystal_nucleus").getAsInt(), false));
lore.add(levelPage.buildLore(
"Anita's Shop Upgrade",
sbXpGainedByAnita,
@@ -189,37 +196,22 @@ public class SkillRelatedTaskLevel {
lore.add(levelPage.buildLore("Peak of the Mountain", sbXpPotmTier, miningObj.get("potm").getAsInt(), false));
lore.add(levelPage.buildLore("Trophy Fish", sbXpTrophyFish, fishingObj.get("trophy_fish").getAsInt(), false));
lore.add(levelPage.buildLore("Rock Milestone", sbXpRockPet, miningObj.get("rock_milestone").getAsInt(), false));
- lore.add(levelPage.buildLore(
- "Dolphin Milestone",
- sbXpDolphinPet,
- fishingObj.get("dolphin_milestone").getAsInt(),
- false
- ));
+ lore.add(levelPage.buildLore("Dolphin Milestone", sbXpDolphinPet, fishingObj.get("dolphin_milestone").getAsInt(), false));
+ int totalXp =
+ (int) (sbXpHotmTier + sbXpCommissionMilestone + sbXpGainedByAnita + sbXpPotmTier + sbXpTrophyFish + sbXpRockPet +
+ sbXpDolphinPet + sbXpNucleus);
levelPage.renderLevelBar(
"Skill Related Task",
new ItemStack(Items.diamond_sword),
- guiLeft + 23,
- guiTop + 115,
+ guiLeft + 23, guiTop + 115,
110,
0,
- sbXpHotmTier + sbXpCommissionMilestone + sbXpGainedByAnita + sbXpPotmTier + sbXpTrophyFish + sbXpRockPet +
- sbXpDolphinPet,
+ totalXp,
levelPage.getConstant().getAsJsonObject("category_xp").get("skill_related_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
}
-
- private static double powder(double multiplier, float left, int CAP) {
- double cons = 1758267;
- if (left <= 0) return 0;
-
- left = Math.min(CAP, left);
-
- return multiplier * (Math.sqrt(1 + 8 * (Math.sqrt((cons / CAP) * left + 9))) - 3);
- }
-
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
index 3aded435..6b624a52 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
@@ -233,20 +233,21 @@ public class SlayingTaskLevel {
int slayingTaskMax = levelPage.getConstant().getAsJsonObject("category_xp").get("slaying_task").getAsInt();
+ int totalXp = sbXpGainedSlayer + bossCollectionXp + mythologicalKillsXp +
+ sbXpFromDragonKills + sbXpFromSlayerDefeat + sbXpDefeatKuudra + sbXpGainedArachne;
levelPage.renderLevelBar(
"Slaying Task",
new ItemStack(Items.golden_sword),
- guiLeft + 23,
- guiTop + 85,
+ guiLeft + 23, guiTop + 85,
110,
- 0, sbXpGainedSlayer + bossCollectionXp + mythologicalKillsXp +
- sbXpFromDragonKills + sbXpFromSlayerDefeat + sbXpDefeatKuudra + sbXpGainedArachne,
+ 0,
+ totalXp,
slayingTaskMax,
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
+ totalXp += sbXpBestiary;
}
private int loopThroughCollection(int[] array, double value, JsonArray jsonArray) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java
index 2b1b59cb..3846db5f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java
@@ -61,14 +61,12 @@ public class StoryTaskLevel {
levelPage.renderLevelBar(
"Story Task",
new ItemStack(Items.map),
- guiLeft + 299,
- guiTop + 85,
+ guiLeft + 299, guiTop + 85,
110,
0,
sbXpStory,
levelPage.getConstant().getAsJsonObject("category_xp").get("story_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
index e885e04f..f4378926 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
@@ -143,14 +143,7 @@ public class TrophyFishPage extends GuiProfileViewerPage {
JsonObject profileInformation = GuiProfileViewer.getProfile().getProfileInformation(GuiProfileViewer.getProfileId());
if (profileInformation == null || !profileInformation.has("trophy_fish")) {
- Utils.drawStringCentered(
- EnumChatFormatting.RED + "No data found",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 431 / 2f,
- guiTop + 101,
- true,
- 0
- );
+ Utils.drawStringCentered(EnumChatFormatting.RED + "No data found", guiLeft + 431 / 2f, guiTop + 101, true, 0);
return;
}
JsonObject trophyObject = profileInformation.get("trophy_fish").getAsJsonObject();
@@ -181,11 +174,7 @@ public class TrophyFishPage extends GuiProfileViewerPage {
Utils.drawStringF(
EnumChatFormatting.AQUA + "Thunder Kills: §f" + thunderKills,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 36,
- guiTop + 112,
- true,
- 0
+ guiLeft + 36, guiTop + 112, true, 0
);
ItemStack lord_jawbus_sc = NotEnoughUpdates.INSTANCE.manager.jsonToStack(
@@ -199,11 +188,7 @@ public class TrophyFishPage extends GuiProfileViewerPage {
Utils.drawStringF(
EnumChatFormatting.AQUA + "Lord Jawbus Kills: §f" + jawbusKills,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 36,
- guiTop + 124,
- true,
- 0
+ guiLeft + 36, guiTop + 124, true, 0
);
ItemStack fishing_rod = NotEnoughUpdates.INSTANCE.manager.jsonToStack(
@@ -211,14 +196,7 @@ public class TrophyFishPage extends GuiProfileViewerPage {
);
Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(fishing_rod, guiLeft + 20, guiTop + 21);
- Utils.drawStringF(
- EnumChatFormatting.AQUA + "Total Caught: §f" + totalCount,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + 38,
- guiTop + 25,
- true,
- 0
- );
+ Utils.drawStringF(EnumChatFormatting.AQUA + "Total Caught: §f" + totalCount, guiLeft + 38, guiTop + 25, true, 0);
ArrayList<TrophyFish> arrayList = new ArrayList<>(trophyFishList.values());
arrayList.sort((c1, c2) -> Integer.compare(c2.getTotal(), c1.getTotal()));
@@ -289,7 +267,7 @@ public class TrophyFishPage extends GuiProfileViewerPage {
y = guiTop + 50 + i;
Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(itemStack, x, y);
- Utils.drawStringF(armorHelmets.get(itemStack).getLeft(), Minecraft.getMinecraft().fontRendererObj, x + 20, y + 4, true, 0);
+ Utils.drawStringF(armorHelmets.get(itemStack).getLeft(), x + 20, y + 4, true, 0);
int hasValue = trophiesPerTier[integer - 1];
int neededValue = integer == 1 ? 15 : 18;
@@ -298,12 +276,12 @@ public class TrophyFishPage extends GuiProfileViewerPage {
try {
JsonElement jsonElement = rewards.get(integer - 1);
if (!jsonElement.isJsonNull()) {
- Utils.drawStringF(check, Minecraft.getMinecraft().fontRendererObj, x + 100, y + 2, true, 0);
+ Utils.drawStringF(check, x + 100, y + 2, true, 0);
} else {
- Utils.drawStringF(neededText, Minecraft.getMinecraft().fontRendererObj, x + 100, y + 4, true, 0);
+ Utils.drawStringF(neededText, x + 100, y + 4, true, 0);
}
} catch (IndexOutOfBoundsException exception) {
- Utils.drawStringF(neededText, Minecraft.getMinecraft().fontRendererObj, x + 100, y + 4, true, 0);
+ Utils.drawStringF(neededText, x + 100, y + 4, true, 0);
}
i += 10;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java
index bd45f3e1..4be3b051 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingOverlay.java
@@ -141,8 +141,7 @@ public class CraftingOverlay {
Utils.drawHoveringText(
recipeIngredient.getItemStack().getTooltip(Minecraft.getMinecraft().thePlayer, false),
mouseX, mouseY,
- Utils.peekGuiScale().getScaledWidth(), Utils.peekGuiScale().getScaledHeight(), -1,
- Minecraft.getMinecraft().fontRendererObj
+ Utils.peekGuiScale().getScaledWidth(), Utils.peekGuiScale().getScaledHeight(), -1
);
}
});
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java
index a642187b..8e4623e3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/CraftingRecipe.java
@@ -24,8 +24,6 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -115,11 +113,9 @@ public class CraftingRecipe implements NeuRecipe {
@Override
public void drawExtraInfo(GuiItemRecipe gui, int mouseX, int mouseY) {
- FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
-
String craftingText = getCraftText();
if (craftingText != null)
- Utils.drawStringCenteredScaledMaxWidth(craftingText, fontRenderer,
+ Utils.drawStringCenteredScaledMaxWidth(craftingText,
gui.guiLeft + EXTRA_STRING_X, gui.guiTop + EXTRA_STRING_Y, false, 75, 0x404040
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java
index 439ac56b..15b3c832 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/EssenceUpgrades.java
@@ -350,14 +350,7 @@ public class EssenceUpgrades implements NeuRecipe {
Minecraft.getMinecraft().getTextureManager().bindTexture(BACKGROUND);
GlStateManager.color(1, 1, 1, 1);
drawButton(x, y, i + 1 == selectedTier);
- Utils.drawStringCentered(
- String.valueOf(i + 1),
- Minecraft.getMinecraft().fontRendererObj,
- x + 8,
- y + 9,
- false,
- 0x2d4ffc
- );
+ Utils.drawStringCentered(String.valueOf(i + 1), x + 8, y + 9, false, 0x2d4ffc);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java
index 47eb0d11..ff6a175d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java
@@ -25,17 +25,17 @@ 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.miscgui.GuiItemRecipe;
+import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.HotmInformation;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -88,10 +88,6 @@ public class ForgeRecipe implements NeuRecipe {
return output;
}
- public int getHotmLevel() {
- return hotmLevel;
- }
-
public int getTimeInSeconds() {
return timeInSeconds;
}
@@ -151,11 +147,9 @@ public class ForgeRecipe implements NeuRecipe {
@Override
public void drawExtraInfo(GuiItemRecipe gui, int mouseX, int mouseY) {
- FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
if (timeInSeconds > 0)
Utils.drawStringCenteredScaledMaxWidth(
formatDuration(timeInSeconds),
- fontRenderer,
gui.guiLeft + EXTRA_INFO_X,
gui.guiTop + EXTRA_INFO_Y,
false,
@@ -166,30 +160,24 @@ public class ForgeRecipe implements NeuRecipe {
@Override
public void drawHoverInformation(GuiItemRecipe gui, int mouseX, int mouseY) {
- manager.hotm.getInformationOnCurrentProfile().ifPresent(hotmTree -> {
- if (timeInSeconds > 0 && gui.isWithinRect(
- mouseX, mouseY,
- gui.guiLeft + EXTRA_INFO_X - EXTRA_INFO_MAX_WIDTH / 2,
- gui.guiTop + EXTRA_INFO_Y - 8,
- EXTRA_INFO_MAX_WIDTH, 16
- )) {
- int qf = hotmTree.getLevel("forge_time");
- int reducedTime = getReducedTime(qf);
- if (qf > 0) {
+ NEUConfig.HiddenProfileSpecific profileSpecific = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
+ if (profileSpecific == null) return;
+
+ if (timeInSeconds <= 0 || !gui.isWithinRect(
+ mouseX, mouseY,
+ gui.guiLeft + EXTRA_INFO_X - EXTRA_INFO_MAX_WIDTH / 2,
+ gui.guiTop + EXTRA_INFO_Y - 8,
+ EXTRA_INFO_MAX_WIDTH, 16
+ )) return;
+
+ int level = profileSpecific.hotmTree.getOrDefault("Quick Forge", 0);
+ if (level == 0) return;
+ int reducedTime = getReducedTime(level);
- Utils.drawHoveringText(
- Arrays.asList(
- EnumChatFormatting.YELLOW + formatDuration(reducedTime) + " with Quick Forge (Level " + qf + ")"),
- mouseX,
- mouseY,
- gui.width,
- gui.height,
- 500,
- Minecraft.getMinecraft().fontRendererObj
- );
- }
- }
- });
+ Utils.drawHoveringText(
+ Collections.singletonList(
+ EnumChatFormatting.YELLOW + formatDuration(reducedTime) + " with Quick Forge (Level " + level + ")"),
+ mouseX, mouseY, gui.width, gui.height, 500);
}
public int getReducedTime(int quickForgeUpgradeLevel) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
index 61749593..0e580cb8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
@@ -31,7 +31,6 @@ import io.github.moulberry.notenoughupdates.profileviewer.Panorama;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.JsonUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -276,15 +275,7 @@ public class MobLootRecipe implements NeuRecipe {
if (combatXp > 0)
stuff.add("§r§bCombat Experience: " + combatXp);
stuff.addAll(extra);
- Utils.drawHoveringText(
- stuff,
- mouseX,
- mouseY,
- gui.width,
- gui.height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ Utils.drawHoveringText(stuff, mouseX, mouseY, gui.width, gui.height, -1);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
index 9bb79604..4938c383 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
@@ -27,9 +27,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.entity.EntityLivingBase;
@@ -135,10 +133,8 @@ public class VillagerTradeRecipe implements NeuRecipe {
@Override
public void drawExtraInfo(GuiItemRecipe gui, int mouseX, int mouseY) {
if (hasVariableCost()) {
- FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
Utils.drawStringCenteredScaledMaxWidth(
- minCost + " - " + maxCost, fontRenderer,
- gui.guiLeft + 50, gui.guiTop + 90, false, 75, 0xff00ff
+ minCost + " - " + maxCost, gui.guiLeft + 50, gui.guiTop + 90, false, 75, 0xff00ff
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
index 023be060..28298fe0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
@@ -48,18 +48,26 @@ import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.zip.GZIPInputStream;
public class ApiUtil {
private static final Gson gson = new Gson();
+
+ private static final Comparator<NameValuePair> nameValuePairComparator = Comparator
+ .comparing(NameValuePair::getName)
+ .thenComparing(NameValuePair::getValue);
+
private static final ExecutorService executorService = Executors.newFixedThreadPool(3);
private static String getUserAgent() {
if (NotEnoughUpdates.INSTANCE.config.hidden.customUserAgent != null) {
@@ -110,6 +118,7 @@ public class ApiUtil {
private final List<NameValuePair> queryArguments = new ArrayList<>();
private String baseUrl = null;
private boolean shouldGunzip = false;
+ private Duration maxCacheAge = Duration.ofSeconds(500);
private String method = "GET";
private String postData = null;
private String postContentType = null;
@@ -119,6 +128,15 @@ public class ApiUtil {
return this;
}
+ /**
+ * Specify a cache timeout of {@code null} to signify an uncacheable request.
+ * Non {@code GET} requests are always uncacheable.
+ */
+ public Request maxCacheAge(Duration maxCacheAge) {
+ this.maxCacheAge = maxCacheAge;
+ return this;
+ }
+
public Request url(String baseUrl) {
this.baseUrl = baseUrl;
return this;
@@ -160,7 +178,17 @@ public class ApiUtil {
return fut;
}
- public CompletableFuture<String> requestString() {
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ private ApiCache.CacheKey getCacheKey() {
+ if (!"GET".equals(method)) return null;
+ queryArguments.sort(nameValuePairComparator);
+ return new ApiCache.CacheKey(baseUrl, queryArguments, shouldGunzip);
+ }
+
+ private CompletableFuture<String> requestString0() {
return buildUrl().thenApplyAsync(url -> {
try {
InputStream inputStream = null;
@@ -183,7 +211,7 @@ public class ApiUtil {
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
try {
- os.write(this.postData.getBytes("utf-8"));
+ os.write(this.postData.getBytes(StandardCharsets.UTF_8));
} finally {
os.close();
}
@@ -213,7 +241,16 @@ public class ApiUtil {
} catch (IOException e) {
throw new RuntimeException(e); // We can rethrow, since supplyAsync catches exceptions.
}
- }, executorService);
+ }, executorService).handle((obj, t) -> {
+ if (t != null) {
+ System.err.println(ErrorUtil.printStackTraceWithoutApiKey(t));
+ }
+ return obj;
+ });
+ }
+
+ public CompletableFuture<String> requestString() {
+ return ApiCache.INSTANCE.cacheRequest(this, getCacheKey(), this::requestString0, maxCacheAge);
}
public CompletableFuture<JsonObject> requestJson() {
@@ -221,7 +258,7 @@ public class ApiUtil {
}
public <T> CompletableFuture<T> requestJson(Class<? extends T> clazz) {
- return requestString().thenApply(str -> gson.fromJson(str, clazz));
+ return requestString().thenApplyAsync(str -> gson.fromJson(str, clazz));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java
deleted file mode 100644
index 57c4ae3b..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.util;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.events.ProfileDataLoadedEvent;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.inventory.GuiChest;
-import net.minecraft.inventory.ContainerChest;
-import net.minecraftforge.client.event.ClientChatReceivedEvent;
-import net.minecraftforge.client.event.GuiOpenEvent;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.world.WorldEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class HotmInformation {
- private final NotEnoughUpdates neu;
- public static final int[] EXPERIENCE_FOR_HOTM_LEVEL = {
- // Taken from the wiki: https://hypixel-skyblock.fandom.com/wiki/Heart_of_the_Mountain#Experience_for_Each_Tier
- 0,
- 3000,
- 12000,
- 37000,
- 97000,
- 197000,
- 347000
- };
- public static final int[] QUICK_FORGE_MULTIPLIERS = {
- 985,
- 970,
- 955,
- 940,
- 925,
- 910,
- 895,
- 880,
- 865,
- 850,
- 845,
- 840,
- 835,
- 830,
- 825,
- 820,
- 815,
- 810,
- 805,
- 700
- };
- private final Map<String, Tree> profiles = new ConcurrentHashMap<>();
-
- public static class Tree {
- private final Map<String, Integer> levels = new HashMap<>();
- private int totalMithrilPowder;
- private int totalGemstonePowder;
- private int hotmExp;
-
- public int getHotmExp() {
- return hotmExp;
- }
-
- public int getTotalGemstonePowder() {
- return totalGemstonePowder;
- }
-
- public int getTotalMithrilPowder() {
- return totalMithrilPowder;
- }
-
- public Set<String> getAllUnlockedNodes() {
- return levels.keySet();
- }
-
- public int getHotmLevel() {
- for (int i = EXPERIENCE_FOR_HOTM_LEVEL.length - 1; i >= 0; i--) {
- if (EXPERIENCE_FOR_HOTM_LEVEL[i] >= this.hotmExp)
- return i;
- }
- return 0;
- }
-
- public int getLevel(String node) {
- return levels.getOrDefault(node, 0);
- }
-
- }
-
- private CompletableFuture<Void> updateTask = CompletableFuture.completedFuture(null);
-
- private boolean shouldReloadSoon = false;
-
- public HotmInformation(NotEnoughUpdates neu) {
- this.neu = neu;
- MinecraftForge.EVENT_BUS.register(this);
- }
-
- public Optional<Tree> getInformationOn(String profile) {
- if (profile == null) {
- return Optional.empty();
- }
- return Optional.ofNullable(this.profiles.get(profile));
- }
-
- public Optional<Tree> getInformationOnCurrentProfile() {
- return getInformationOn(neu.manager.getCurrentProfile());
- }
-
- @SubscribeEvent
- public synchronized void onLobbyJoin(WorldEvent.Load event) {
- if (shouldReloadSoon) {
- shouldReloadSoon = false;
- neu.manager.apiUtils.updateProfileData();
- }
- }
-
- @SubscribeEvent
- public synchronized void onGuiOpen(GuiOpenEvent event) {
- if (event.gui instanceof GuiChest) {
- String containerName = ((ContainerChest) ((GuiChest) event.gui).inventorySlots)
- .getLowerChestInventory()
- .getDisplayName()
- .getUnformattedText();
- if (containerName.equals("Heart of the Mountain"))
- shouldReloadSoon = true;
- }
- }
-
- @SubscribeEvent
- public synchronized void onChat(ClientChatReceivedEvent event) {
- if (event.message.getUnformattedText().equals("Welcome to Hypixel SkyBlock!"))
- neu.manager.apiUtils.updateProfileData();
- }
-
- /*
- * 1000 = 100% of the time left
- * 700 = 70% of the time left
- * */
- public static int getQuickForgeMultiplier(int level) {
- if (level <= 0) return 1000;
- if (level > 20) return -1;
- return QUICK_FORGE_MULTIPLIERS[level - 1];
- }
- @SubscribeEvent
- public void onApiDataLoaded(ProfileDataLoadedEvent event) {
- JsonObject data = event.getData();
- if (data == null) return;
-
- if (!data.has("success") || !data.get("success").getAsBoolean()) return;
- JsonArray profiles = data.getAsJsonArray("profiles");
- for (JsonElement element : profiles) {
- JsonObject profile = element.getAsJsonObject();
- String profileName = profile.get("cute_name").getAsString();
- JsonObject player = profile.getAsJsonObject("members").getAsJsonObject(Minecraft.getMinecraft().thePlayer
- .getUniqueID()
- .toString()
- .replace("-", ""));
- if (!player.has("mining_core"))
- continue;
- JsonObject miningCore = player.getAsJsonObject("mining_core");
- Tree tree = new Tree();
- JsonObject nodes = miningCore.getAsJsonObject("nodes");
- for (Map.Entry<String, JsonElement> node : nodes.entrySet()) {
- String key = node.getKey();
- if (!key.startsWith("toggle_")) {
- tree.levels.put(key, node.getValue().getAsInt());
- }
- }
- if (miningCore.has("powder_mithril_total")) {
- tree.totalMithrilPowder = miningCore.get("powder_mithril_total").getAsInt();
- }
- if (miningCore.has("powder_gemstone_total")) {
- tree.totalGemstonePowder = miningCore.get("powder_gemstone_total").getAsInt();
- }
- if (miningCore.has("experience")) {
- tree.hotmExp = miningCore.get("experience").getAsInt();
- }
- this.profiles.put(profileName, tree);
- }
- }
-
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
index ea5e13ab..280a0d3d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
@@ -24,6 +24,7 @@ import com.google.gson.JsonParseException;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import lombok.var;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.inventory.GuiChest;
@@ -36,9 +37,10 @@ import net.minecraft.nbt.NBTTagCompound;
import javax.annotation.Nullable;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
-import java.util.Map;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -188,31 +190,63 @@ public class ItemResolutionQuery {
return null;
}
+ /**
+ * Search for an item by the display name
+ *
+ * @param displayName The display name of the item we are searching
+ * @param mayBeMangled Whether the item name may be mangled (for example: reforges, stars)
+ * @return the internal neu item id of that item, or null
+ */
+ public static String findInternalNameByDisplayName(String displayName, boolean mayBeMangled) {
+ var cleanDisplayName = StringUtils.cleanColour(displayName);
+ var manager = NotEnoughUpdates.INSTANCE.manager;
+ String bestMatch = null;
+ int bestMatchLength = -1;
+ for (String internalName : findInternalNameCandidatesForDisplayName(cleanDisplayName)) {
+ var item = manager.createItem(internalName);
+ if (item.getDisplayName() == null) continue;
+ var cleanItemDisplayName = StringUtils.cleanColour(item.getDisplayName());
+ if (cleanItemDisplayName.length() == 0) continue;
+ if (mayBeMangled
+ ? !cleanDisplayName.contains(cleanItemDisplayName)
+ : !cleanItemDisplayName.equals(cleanDisplayName)) {
+ continue;
+ }
+ if (cleanItemDisplayName.length() > bestMatchLength) {
+ bestMatchLength = cleanItemDisplayName.length();
+ bestMatch = internalName;
+ }
+ }
+ return bestMatch;
+ }
+
+ /**
+ * Find potential item ids for a given display name. This function is over eager to give results,
+ * and may give invalid results, but if there is a matching item in the repository it will return <em>at least</em>
+ * that item. This should be used as a first filtering pass. Use {@link #findInternalNameByDisplayName} for a more
+ * user-friendly API.
+ *
+ * @param displayName The display name of the item we are searching
+ * @return a list of internal neu item ids some of which may have a matching display name
+ */
+ public static Set<String> findInternalNameCandidatesForDisplayName(String displayName) {
+ var cleanDisplayName = NEUManager.cleanForTitleMapSearch(displayName);
+ var titleWordMap = NotEnoughUpdates.INSTANCE.manager.titleWordMap;
+ var candidates = new HashSet<String>();
+ for (var partialDisplayName : cleanDisplayName.split(" ")) {
+ if (!titleWordMap.containsKey(partialDisplayName)) continue;
+ candidates.addAll(titleWordMap.get(partialDisplayName).keySet());
+ }
+ return candidates;
+ }
+
private String resolveItemInCatacombsRngMeter() {
List<String> lore = ItemUtils.getLore(compound);
if (lore.size() > 16) {
String s = lore.get(15);
if (s.equals("§7Selected Drop")) {
String displayName = lore.get(16);
- return getInternalNameByDisplayName(displayName);
- }
- }
-
- return null;
- }
-
- private String getInternalNameByDisplayName(String displayName) {
- String cleanDisplayName = StringUtils.cleanColour(displayName);
- for (Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .entrySet()) {
-
- JsonObject object = entry.getValue();
- if (object.has("displayname")) {
- String name = object.get("displayname").getAsString();
- if (StringUtils.cleanColour(name).equals(cleanDisplayName)) {
- return entry.getKey();
- }
+ return findInternalNameByDisplayName(displayName, false);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/LRUCache.java b/src/main/java/io/github/moulberry/notenoughupdates/util/LRUCache.java
index f107d522..6adbc30d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/LRUCache.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/LRUCache.java
@@ -32,13 +32,15 @@ public interface LRUCache<K, V> extends Function<K, V> {
}
static <K, V> LRUCache<K, V> memoize(Function<K, V> mapper, IntSupplier maxCacheSize) {
- Map<K, V> cache = new LinkedHashMap<K, V>(10, 0.75F, true) {
+ Map<K, Object> cache = new LinkedHashMap<K, Object>(10, 0.75F, true) {
@Override
- protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
+ protected boolean removeEldestEntry(Map.Entry<K, Object> eldest) {
return this.size() > maxCacheSize.getAsInt();
}
};
- Map<K, V> synchronizedCache = Collections.synchronizedMap(cache);
+ Object SENTINEL_CACHE_RESULT_NULL = new Object();
+ Function<K, Object> sentinelAwareMapper = mapper.andThen(it -> it == null ? SENTINEL_CACHE_RESULT_NULL : it);
+ Map<K, Object> synchronizedCache = Collections.synchronizedMap(cache);
return new LRUCache<K, V>() {
@Override
public void clearCache() {
@@ -52,7 +54,8 @@ public interface LRUCache<K, V> extends Function<K, V> {
@Override
public V apply(K k) {
- return synchronizedCache.computeIfAbsent(k, mapper);
+ Object value = synchronizedCache.computeIfAbsent(k, sentinelAwareMapper);
+ return value == SENTINEL_CACHE_RESULT_NULL ? null : (V) value;
}
};
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java b/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java
index d373ef2c..99a39d0a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/NotificationHandler.java
@@ -83,10 +83,7 @@ public class NotificationHandler {
int xLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth("[X] Close");
Minecraft.getMinecraft().fontRendererObj.drawString(
"[X] Close",
- midX + width / 2f - 3 - xLen,
- topY + 3,
- 0xFFFF5555,
- false
+ midX + width / 2f - 3 - xLen, topY + 3, 0xFFFF5555, false
);
if (notificationDisplayMillis > 0) {
@@ -99,24 +96,10 @@ public class NotificationHandler {
);
}
- Utils.drawStringCentered(
- notificationLines.get(0),
- Minecraft.getMinecraft().fontRendererObj,
- midX,
- topY + 4 + 5,
- false,
- -1
- );
+ Utils.drawStringCentered(notificationLines.get(0), midX, topY + 4 + 5, false, -1);
for (int i = 1; i < notificationLines.size(); i++) {
String line = notificationLines.get(i);
- Utils.drawStringCentered(
- line,
- Minecraft.getMinecraft().fontRendererObj,
- midX,
- topY + 4 + 5 + 2 + i * 10,
- false,
- -1
- );
+ Utils.drawStringCentered(line, midX, topY + 4 + 5 + 2 + i * 10, false, -1);
}
Utils.pushGuiScale(-1);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index d0af9091..9d2d1056 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -24,6 +24,7 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.listener.ScoreboardLocationChangeListener;
+import io.github.moulberry.notenoughupdates.miscfeatures.CookieWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
@@ -307,7 +308,8 @@ public class SBInfo {
private static final String profilePrefix = "\u00a7r\u00a7e\u00a7lProfile: \u00a7r\u00a7a";
private static final String skillsPrefix = "\u00a7r\u00a7e\u00a7lSkills: \u00a7r\u00a7a";
- private static final String completedFactionQuests = "\u00a7r \u00a7r\u00a7a";
+ private static final String completedFactionQuests =
+ "\u00a7r \u00a7r\u00a7a(?!(Paul|Finnegan|Aatrox|Cole|Diana|Diaz|Foxy|Marina)).*";
public ArrayList<String> completedQuests = new ArrayList<>();
private static final Pattern SKILL_LEVEL_PATTERN = Pattern.compile("([^0-9:]+) (\\d{1,2})");
@@ -352,7 +354,7 @@ public class SBInfo {
} catch (Exception ignored) {
}
}
- } else if (name.startsWith(completedFactionQuests)) {
+ } else if (name.matches(completedFactionQuests) && "crimson_isle".equals(mode)) {
if (completedQuests.isEmpty()) {
completedQuests.add(name);
} else if (!completedQuests.contains(name)) {
@@ -477,7 +479,6 @@ public class SBInfo {
.thenAccept(newJson -> mayorJson = newJson);
}
-
public JsonObject getMayorJson() {
return mayorJson;
}
@@ -486,6 +487,7 @@ public class SBInfo {
if (!newProfile.equals(currentProfile)) {
currentProfile = newProfile;
MinionHelperManager.getInstance().onProfileSwitch();
+ CookieWarning.onProfileSwitch();
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index 90e53097..fed05473 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -294,9 +294,9 @@ public class Utils {
while (matcher.find()) {
matcher.appendReplacement(
sb,
- Utils.chromaString(matcher.group(1))
- .replace("\\", "\\\\")
- .replace("$", "\\$")
+ chromaString(matcher.group(1))
+ .replace("\\", "\\\\")
+ .replace("$", "\\$")
);
}
matcher.appendTail(sb);
@@ -629,10 +629,10 @@ public class Utils {
Minecraft.getMinecraft().getTextureManager().bindTexture(GuiProfileViewer.pv_elements);
- Utils.drawTexturedRect(x, y, pressed ? 32 : 28, 28, uMin, uMax, vMin, vMax, GL11.GL_NEAREST);
+ drawTexturedRect(x, y, pressed ? 32 : 28, 28, uMin, uMax, vMin, vMax, GL11.GL_NEAREST);
GlStateManager.enableDepth();
- Utils.drawItemStack(itemStack, x + 8, y + 7);
+ drawItemStack(itemStack, x + 8, y + 7);
}
public static void drawTexturedRect(float x, float y, float width, float height, int filter) {
@@ -677,7 +677,7 @@ public class Utils {
public static int checkItemTypePet(List<String> lore) {
for (int i = lore.size() - 1; i >= 0; i--) {
- String line = Utils.cleanColour(lore.get(i));
+ String line = cleanColour(lore.get(i));
for (int i1 = 0; i1 < rarityArr.length; i1++) {
if (line.equals(rarityArr[i1])) {
return i1;
@@ -926,6 +926,10 @@ public class Utils {
return createItemStack(item, displayName, 0, lore);
}
+ public static ItemStack createItemStackArray(Item item, String displayName, String[] lore) {
+ return createItemStack(item, displayName, 0, lore);
+ }
+
public static ItemStack createItemStack(Block item, String displayName, String... lore) {
return createItemStack(Item.getItemFromBlock(item), displayName, lore);
}
@@ -933,17 +937,7 @@ public class Utils {
public static ItemStack createItemStack(Item item, String displayName, int damage, String... lore) {
ItemStack stack = new ItemStack(item, 1, damage);
NBTTagCompound tag = new NBTTagCompound();
- NBTTagCompound display = new NBTTagCompound();
- NBTTagList Lore = new NBTTagList();
-
- for (String line : lore) {
- Lore.appendTag(new NBTTagString(line));
- }
-
- display.setString("Name", displayName);
- display.setTag("Lore", Lore);
-
- tag.setTag("display", display);
+ addNameAndLore(tag, displayName, lore);
tag.setInteger("HideFlags", 254);
stack.setTagCompound(tag);
@@ -951,6 +945,22 @@ public class Utils {
return stack;
}
+ private static void addNameAndLore(NBTTagCompound tag, String displayName, String[] lore) {
+ NBTTagCompound display = new NBTTagCompound();
+
+ display.setString("Name", displayName);
+
+ if (lore != null) {
+ NBTTagList tagLore = new NBTTagList();
+ for (String line : lore) {
+ tagLore.appendTag(new NBTTagString(line));
+ }
+ display.setTag("Lore", tagLore);
+ }
+
+ tag.setTag("display", display);
+ }
+
public static ItemStack editItemStackInfo(
ItemStack itemStack,
String displayName,
@@ -980,15 +990,17 @@ public class Utils {
return itemStack;
}
-
public static ItemStack createSkull(String displayName, String uuid, String value) {
+ return createSkull(displayName, uuid, value, null);
+ }
+
+ public static ItemStack createSkull(String displayName, String uuid, String value, String[] lore) {
ItemStack render = new ItemStack(Items.skull, 1, 3);
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound skullOwner = new NBTTagCompound();
NBTTagCompound properties = new NBTTagCompound();
NBTTagList textures = new NBTTagList();
NBTTagCompound textures_0 = new NBTTagCompound();
- NBTTagCompound display = new NBTTagCompound();
skullOwner.setString("Id", uuid);
skullOwner.setString("Name", uuid);
@@ -996,8 +1008,7 @@ public class Utils {
textures_0.setString("Value", value);
textures.appendTag(textures_0);
- display.setString("Name", displayName);
- tag.setTag("display", display);
+ addNameAndLore(tag, displayName, lore);
properties.setTag("textures", textures);
skullOwner.setTag("Properties", properties);
@@ -1006,6 +1017,11 @@ public class Utils {
return render;
}
+ public static void drawStringF(String str, float x, float y, boolean shadow, int colour) {
+ drawStringF(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour);
+ }
+
+ @Deprecated
public static void drawStringF(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
fr.drawString(str, x, y, colour, shadow);
}
@@ -1029,6 +1045,11 @@ public class Utils {
return height;
}
+ public static void drawStringVertical(String str, float x, float y, boolean shadow, int colour) {
+ drawStringVertical(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour);
+ }
+
+ @Deprecated
public static void drawStringVertical(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
String format = FontRenderer.getFormatFromString(str);
str = cleanColour(str);
@@ -1056,9 +1077,8 @@ public class Utils {
for (int xOff = -2; xOff <= 2; xOff++) {
for (int yOff = -2; yOff <= 2; yOff++) {
if (Math.abs(xOff) != Math.abs(yOff)) {
- Utils.drawStringCenteredScaledMaxWidth(
- Utils.cleanColourNotModifiers(str),
- Minecraft.getMinecraft().fontRendererObj,
+ drawStringCenteredScaledMaxWidth(
+ cleanColourNotModifiers(str),
x + xOff / 2f * factor,
y + 4 + yOff / 2f * factor,
false,
@@ -1070,9 +1090,7 @@ public class Utils {
}
GlStateManager.color(1, 1, 1, 1);
- Utils.drawStringCenteredScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj,
- x, y + 4, false, maxLength, 4210752
- );
+ drawStringCenteredScaledMaxWidth(str, x, y + 4, false, maxLength, 421075);
}
public static void renderAlignedString(String first, String second, float x, float y, int length) {
@@ -1083,7 +1101,7 @@ public class Utils {
for (int xOff = -2; xOff <= 2; xOff++) {
for (int yOff = -2; yOff <= 2; yOff++) {
if (Math.abs(xOff) != Math.abs(yOff)) {
- fontRendererObj.drawString(Utils.cleanColourNotModifiers(first),
+ fontRendererObj.drawString(cleanColourNotModifiers(first),
x + xOff / 2f, y + yOff / 2f,
new Color(0, 0, 0, 200 / Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false
);
@@ -1097,7 +1115,7 @@ public class Utils {
for (int xOff = -2; xOff <= 2; xOff++) {
for (int yOff = -2; yOff <= 2; yOff++) {
if (Math.abs(xOff) != Math.abs(yOff)) {
- fontRendererObj.drawString(Utils.cleanColourNotModifiers(second),
+ fontRendererObj.drawString(cleanColourNotModifiers(second),
x + length - secondLen + xOff / 2f, y + yOff / 2f,
new Color(0, 0, 0, 200 / Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false
);
@@ -1112,6 +1130,18 @@ public class Utils {
public static void drawStringScaledMaxWidth(
String str,
+ float x,
+ float y,
+ boolean shadow,
+ int len,
+ int colour
+ ) {
+ drawStringScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour);
+ }
+
+ @Deprecated
+ public static void drawStringScaledMaxWidth(
+ String str,
FontRenderer fr,
float x,
float y,
@@ -1123,9 +1153,14 @@ public class Utils {
float factor = len / (float) strLen;
factor = Math.min(1, factor);
- drawStringScaled(str, fr, x, y, shadow, colour, factor);
+ drawStringScaled(str, x, y, shadow, colour, factor);
+ }
+
+ public static void drawStringCentered(String str, float x, float y, boolean shadow, int colour) {
+ drawStringCentered(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour);
}
+ @Deprecated
public static void drawStringCentered(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
int strLen = fr.getStringWidth(str);
@@ -1139,6 +1174,18 @@ public class Utils {
public static void drawStringScaled(
String str,
+ float x,
+ float y,
+ boolean shadow,
+ int colour,
+ float factor
+ ) {
+ drawStringScaled(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour, factor);
+ }
+
+ @Deprecated
+ public static void drawStringScaled(
+ String str,
FontRenderer fr,
float x,
float y,
@@ -1160,11 +1207,24 @@ public class Utils {
int colour,
float factor
) {
- drawStringScaled(str, fr, x - fr.getStringWidth(str) * factor, y, shadow, colour, factor);
+ drawStringScaled(str, x - fr.getStringWidth(str) * factor, y, shadow, colour, factor);
}
public static void drawStringScaledMax(
String str,
+ float x,
+ float y,
+ boolean shadow,
+ int colour,
+ float factor,
+ int len
+ ) {
+ drawStringScaledMax(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, colour, factor, len);
+ }
+
+ @Deprecated
+ public static void drawStringScaledMax(
+ String str,
FontRenderer fr,
float x,
float y,
@@ -1184,6 +1244,18 @@ public class Utils {
public static void drawStringCenteredScaledMaxWidth(
String str,
+ float x,
+ float y,
+ boolean shadow,
+ int len,
+ int colour
+ ) {
+ drawStringCenteredScaledMaxWidth(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, len, colour);
+ }
+
+ @Deprecated
+ public static void drawStringCenteredScaledMaxWidth(
+ String str,
FontRenderer fr,
float x,
float y,
@@ -1198,7 +1270,7 @@ public class Utils {
float fontHeight = 8 * factor;
- drawStringScaled(str, fr, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor);
+ drawStringScaled(str, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor);
}
public static Matrix4f createProjectionMatrix(int width, int height) {
@@ -1216,20 +1288,34 @@ public class Utils {
public static void drawStringCenteredScaled(
String str,
- FontRenderer fr,
- float x,
- float y,
+ float x, float y,
boolean shadow,
int len,
int colour
) {
- int strLen = fr.getStringWidth(str);
+ int strLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(str);
float factor = len / (float) strLen;
float fontHeight = 8 * factor;
- drawStringScaled(str, fr, x - len / 2, y - fontHeight / 2, shadow, colour, factor);
+ drawStringScaled(
+ str,
+ x - len / 2, y - fontHeight / 2,
+ shadow,
+ colour,
+ factor
+ );
+ }
+
+ public static void drawStringCenteredScaled(
+ String str,
+ float x, float y,
+ boolean shadow,
+ float factor
+ ) {
+ drawStringCenteredScaled(str, Minecraft.getMinecraft().fontRendererObj, x, y, shadow, factor);
}
+ @Deprecated
public static void drawStringCenteredScaled(
String str,
FontRenderer fr,
@@ -1243,7 +1329,7 @@ public class Utils {
float x2 = x - strLen / 2f;
float y2 = y - fr.FONT_HEIGHT / 2f;
- drawStringScaled(str, fr, x2, y2, shadow, 0, factor);
+ drawStringScaled(str, x2, y2, shadow, 0, factor);
}
public static void drawStringCenteredYScaled(
@@ -1259,7 +1345,7 @@ public class Utils {
float factor = len / (float) strLen;
float fontHeight = 8 * factor;
- drawStringScaled(str, fr, x, y - fontHeight / 2, shadow, colour, factor);
+ drawStringScaled(str, x, y - fontHeight / 2, shadow, colour, factor);
}
public static void drawStringCenteredYScaledMaxWidth(
@@ -1276,12 +1362,11 @@ public class Utils {
factor = Math.min(1, factor);
float fontHeight = 8 * factor;
- drawStringScaled(str, fr, x, y - fontHeight / 2, shadow, colour, factor);
+ drawStringScaled(str, x, y - fontHeight / 2, shadow, colour, factor);
}
public static int renderStringTrimWidth(
String str,
- FontRenderer fr,
boolean shadow,
int x,
int y,
@@ -1289,12 +1374,11 @@ public class Utils {
int colour,
int maxLines
) {
- return renderStringTrimWidth(str, fr, shadow, x, y, len, colour, maxLines, 1);
+ return renderStringTrimWidth(str, shadow, x, y, len, colour, maxLines, 1);
}
public static int renderStringTrimWidth(
String str,
- FontRenderer fr,
boolean shadow,
int x,
int y,
@@ -1321,20 +1405,20 @@ public class Utils {
int lines = 0;
while ((lines++ < maxLines) || maxLines < 0) {
if (trimmed.length() == str.length()) {
- drawStringScaled(trimmed, fr, x, y + yOff, shadow, colour, scale);
+ drawStringScaled(trimmed, x, y + yOff, shadow, colour, scale);
break;
} else if (trimmed.isEmpty()) {
yOff -= 12 * scale;
break;
} else {
if (firstLine) {
- drawStringScaled(trimmed, fr, x, y + yOff, shadow, colour, scale);
+ drawStringScaled(trimmed, x, y + yOff, shadow, colour, scale);
firstLine = false;
} else {
if (trimmed.startsWith(" ")) {
trimmed = trimmed.substring(1);
}
- drawStringScaled(colourCodes + trimmed, fr, x, y + yOff, shadow, colour, scale);
+ drawStringScaled(colourCodes + trimmed, x, y + yOff, shadow, colour, scale);
}
excess = str.substring(trimmedCharacters);
@@ -1420,6 +1504,38 @@ public class Utils {
GlStateManager.enableTexture2D();
}
+ public static void drawHoveringText(
+ List<String> textLines,
+ final int mouseX,
+ final int mouseY,
+ final int screenWidth,
+ final int screenHeight,
+ final int maxTextWidth
+ ) {
+ drawHoveringText(
+ textLines,
+ mouseX,
+ mouseY,
+ screenWidth,
+ screenHeight,
+ maxTextWidth,
+ Minecraft.getMinecraft().fontRendererObj
+ );
+ }
+
+ @Deprecated
+ public static void drawHoveringText(
+ List<String> textLines,
+ final int mouseX,
+ final int mouseY,
+ final int screenWidth,
+ final int screenHeight,
+ final int maxTextWidth,
+ FontRenderer font
+ ) {
+ drawHoveringText(textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font, true);
+ }
+
public static JsonObject getConstant(String constant, Gson gson) {
return getConstant(constant, gson, JsonObject.class);
}
@@ -1555,6 +1671,28 @@ public class Utils {
public static void drawHoveringText(
List<String> textLines,
+ final int mouseX,
+ final int mouseY,
+ final int screenWidth,
+ final int screenHeight,
+ final int maxTextWidth,
+ boolean coloured
+ ) {
+ drawHoveringText(
+ textLines,
+ mouseX,
+ mouseY,
+ screenWidth,
+ screenHeight,
+ maxTextWidth,
+ Minecraft.getMinecraft().fontRendererObj,
+ coloured
+ );
+ }
+
+ @Deprecated
+ public static void drawHoveringText(
+ List<String> textLines,
int mouseX,
int mouseY,
int screenWidth,
@@ -2136,7 +2274,7 @@ public class Utils {
runtime.exec("xdg-open " + url);
return true;
} catch (IOException e) {
- Utils.playSound(new ResourceLocation("game.player.hurt"), true);
+ playSound(new ResourceLocation("game.player.hurt"), true);
return false;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/brigadier/NEUBrigadierHook.kt b/src/main/java/io/github/moulberry/notenoughupdates/util/brigadier/NEUBrigadierHook.kt
new file mode 100644
index 00000000..668c412a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/brigadier/NEUBrigadierHook.kt
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2023 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util.brigadier
+
+import com.mojang.brigadier.ParseResults
+import com.mojang.brigadier.exceptions.CommandSyntaxException
+import com.mojang.brigadier.suggestion.Suggestions
+import com.mojang.brigadier.tree.CommandNode
+import net.minecraft.command.CommandBase
+import net.minecraft.command.ICommandSender
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.EnumChatFormatting.RED
+import net.minecraft.util.EnumChatFormatting.YELLOW
+import java.util.concurrent.CompletableFuture
+import java.util.function.Predicate
+
+/**
+ * Hook for converting brigadier commands to normal legacy Minecraft commands (string array style).
+ */
+class NEUBrigadierHook(
+ val brigadierRoot: BrigadierRoot,
+ val commandNode: CommandNode<DefaultSource>,
+ val aliases: List<String>
+) : CommandBase() {
+ /**
+ * Runs before the command gets executed. Return false to prevent execution.
+ */
+ var beforeCommand: Predicate<ParseResults<DefaultSource>>? = null
+
+ override fun getCommandName(): String {
+ return commandNode.name
+ }
+
+ override fun getCommandAliases(): List<String> {
+ return aliases
+ }
+
+ data class Usage(
+ val path: String,
+ val help: String?,
+ )
+
+
+ override fun getCommandUsage(sender: ICommandSender): String {
+ return brigadierRoot.getAllUsages("/$commandName", commandNode, mutableSetOf()).joinToString("\n") { "${it.path} - ${it.help ?: "Missing help"}"}
+ }
+
+ private fun getText(args: Array<out String>) = "${commandNode.name} ${args.joinToString(" ")}"
+
+ override fun processCommand(sender: ICommandSender, args: Array<out String>) {
+ val results = brigadierRoot.parseText.apply(sender to getText(args).trim())
+ if (beforeCommand?.test(results) == false)
+ return
+ try {
+ brigadierRoot.dispatcher.execute(results)
+ } catch (syntax: CommandSyntaxException) {
+ brigadierRoot.getAllUsages("/$commandName", commandNode, mutableSetOf()).forEach {
+ sender.addChatMessage(ChatComponentText("${YELLOW}[NEU] ${it.path} - ${it.help}"))
+ }
+ }
+ }
+
+ // We love async tab completion (may end up requiring pressing tab multiple times, but uhhhhh .get() bad)
+ private var lastCompletionText: String? = null
+ private var lastCompletion: CompletableFuture<Suggestions>? = null
+ override fun addTabCompletionOptions(
+ sender: ICommandSender,
+ args: Array<out String>,
+ pos: BlockPos
+ ): List<String> {
+ val originalText = getText(args)
+ var lc: CompletableFuture<Suggestions>? = null
+ if (lastCompletionText == originalText) {
+ lc = lastCompletion
+ }
+ if (lc == null) {
+ lastCompletion?.cancel(true)
+ val results = brigadierRoot.parseText.apply(sender to originalText)
+ lc = brigadierRoot.dispatcher.getCompletionSuggestions(results)
+ }
+ lastCompletion = lc
+ lastCompletionText = originalText
+ val suggestions = lastCompletion?.getNow(null) ?: return emptyList()
+ return suggestions.list.map { it.text }
+ }
+
+ override fun canCommandSenderUseCommand(sender: ICommandSender): Boolean {
+ return true // Permissions are checked by brigadier instead (or by the beforeCommand hook)
+ }
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
new file mode 100644
index 00000000..a5ff48d2
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
@@ -0,0 +1,256 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.dev
+
+import com.mojang.brigadier.arguments.StringArgumentType
+import io.github.moulberry.notenoughupdates.BuildFlags
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.core.config.GuiPositionEditor
+import io.github.moulberry.notenoughupdates.core.util.MiscUtils
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper
+import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes
+import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent
+import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph
+import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager
+import io.github.moulberry.notenoughupdates.util.PronounDB
+import io.github.moulberry.notenoughupdates.util.SBInfo
+import io.github.moulberry.notenoughupdates.util.TabListUtils
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.GuiScreen
+import net.minecraft.command.ICommandSender
+import net.minecraft.entity.player.EntityPlayer
+import net.minecraft.launchwrapper.Launch
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.EnumChatFormatting.*
+import net.minecraft.util.EnumParticleTypes
+import net.minecraftforge.common.MinecraftForge
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.function.Predicate
+import kotlin.math.floor
+
+@NEUAutoSubscribe
+class DevTestCommand {
+ companion object {
+ val DEV_TESTERS: List<String> = mutableListOf(
+ "d0e05de7-6067-454d-beae-c6d19d886191", // moulberry
+ "66502b40-6ac1-4d33-950d-3df110297aab", // lucycoconut
+ "a5761ff3-c710-4cab-b4f4-3e7f017a8dbf", // ironm00n
+ "5d5c548a-790c-4fc8-bd8f-d25b04857f44", // ariyio
+ "53924f1a-87e6-4709-8e53-f1c7d13dc239", // throwpo
+ "d3cb85e2-3075-48a1-b213-a9bfb62360c1", // lrg89
+ "0b4d470f-f2fb-4874-9334-1eaef8ba4804", // dediamondpro
+ "ebb28704-ed85-43a6-9e24-2fe9883df9c2", // lulonaut
+ "698e199d-6bd1-4b10-ab0c-52fedd1460dc", // craftyoldminer
+ "8a9f1841-48e9-48ed-b14f-76a124e6c9df", // eisengolem
+ "a7d6b3f1-8425-48e5-8acc-9a38ab9b86f7", // whalker
+ "0ce87d5a-fa5f-4619-ae78-872d9c5e07fe", // ascynx
+ "a049a538-4dd8-43f8-87d5-03f09d48b4dc", // egirlefe
+ "7a9dc802-d401-4d7d-93c0-8dd1bc98c70d", // efefury
+ "bb855349-dfd8-4125-a750-5fc2cf543ad5" // hannibal2
+ )
+ val SPECIAL_KICK = "SPECIAL_KICK"
+
+ val DEV_FAIL_STRINGS = arrayOf(
+ "No.",
+ "I said no.",
+ "You aren't allowed to use this.",
+ "Are you sure you want to use this? Type 'Yes' in chat.",
+ "Are you sure you want to use this? Type 'Yes' in chat.",
+ "Lmao you thought",
+ "Ok please stop",
+ "What do you want from me?",
+ "This command almost certainly does nothing useful for you",
+ "Ok, this is the last message, after this it will repeat",
+ "No.",
+ "I said no.",
+ "Dammit. I thought that would work. Uhh...",
+ "\u00a7dFrom \u00a7c[ADMIN] Minikloon\u00a77: If you use that command again, I'll have to ban you",
+ SPECIAL_KICK,
+ "Ok, this is actually the last message, use the command again and you'll crash I promise"
+ )
+
+ fun isDeveloper(commandSender: ICommandSender): Boolean {
+ return DEV_TESTERS.contains((commandSender as? EntityPlayer)?.uniqueID?.toString())
+ || Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean
+
+ }
+ }
+
+ var devFailIndex = 0
+ fun canPlayerExecute(commandSender: ICommandSender): Boolean {
+ return isDeveloper(commandSender)
+ }
+
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ val hook = event.command("neudevtest") {
+ requires {
+ canPlayerExecute(it)
+ }
+ thenLiteralExecute("profileinfo") {
+ val currentProfile = SBInfo.getInstance().currentProfile
+ val gamemode = SBInfo.getInstance().getGamemodeForProfile(currentProfile)
+ reply("${GOLD}You are on Profile $currentProfile with the mode $gamemode")
+ }.withHelp("Display information about your current profile")
+ thenLiteralExecute("buildflags") {
+ reply("BuildFlags: \n" +
+ BuildFlags.getAllFlags().entries
+ .joinToString(("\n")) { (key, value) -> " + $key - $value" })
+ }.withHelp("List the flags with which NEU was built")
+ thenLiteral("exteditor") {
+ thenArgument("editor", StringArgumentType.string()) { newEditor ->
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.config.hidden.externalEditor = this[newEditor]
+ reply("You changed your external editor to: §Z${this[newEditor]}")
+ }
+ }.withHelp("Change the editor used to edit repo files")
+ thenExecute {
+ reply("Your external editor is: §Z${NotEnoughUpdates.INSTANCE.config.hidden.externalEditor}")
+ }
+ }.withHelp("See your current external editor for repo files")
+ thenLiteral("pricetest") {
+ thenArgument("item", StringArgumentType.string()) { item ->
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiPriceGraph(this[item])
+ }
+ }.withHelp("Display the price graph for an item by id")
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.manager.auctionManager.updateBazaar()
+ }
+ }.withHelp("Update the price data from the bazaar")
+ thenLiteralExecute("zone") {
+ val target = Minecraft.getMinecraft().objectMouseOver.blockPos
+ ?: Minecraft.getMinecraft().thePlayer.position
+ val zone = CustomBiomes.INSTANCE.getSpecialZone(target)
+ listOf(
+ ChatComponentText("Showing Zone Info for: $target"),
+ ChatComponentText("Zone: " + (zone?.name ?: "null")),
+ ChatComponentText("Location: " + SBInfo.getInstance().getLocation()),
+ ChatComponentText("Biome: " + CustomBiomes.INSTANCE.getCustomBiome(target))
+ ).forEach { component ->
+ reply(component)
+ }
+ MinecraftForge.EVENT_BUS.post(
+ LocationChangeEvent(
+ SBInfo.getInstance().getLocation(), SBInfo
+ .getInstance()
+ .getLocation()
+ )
+ )
+ }.withHelp("Display information about the special block zone at your cursor (Custom Texture Regions)")
+ thenLiteralExecute("positiontest") {
+ NotEnoughUpdates.INSTANCE.openGui = GuiPositionEditor()
+ }.withHelp("Open the gui position editor")
+ thenLiteral("pt") {
+ thenArgument("particle", EnumArgumentType.enum<EnumParticleTypes>()) { particle ->
+ thenExecute {
+ FishingHelper.type = this[particle]
+ reply("Fishing particles set to ${FishingHelper.type}")
+ }
+ }
+ }
+ thenLiteralExecute("dev") {
+ NotEnoughUpdates.INSTANCE.config.hidden.dev = !NotEnoughUpdates.INSTANCE.config.hidden.dev
+ reply("Dev mode " + if (NotEnoughUpdates.INSTANCE.config.hidden.dev) "§aenabled" else "§cdisabled")
+ }.withHelp("Toggle developer mode")
+ thenLiteralExecute("saveconfig") {
+ NotEnoughUpdates.INSTANCE.saveConfig()
+ reply("Config saved")
+ }.withHelp("Force sync the config to disk")
+ thenLiteralExecute("searchmode") {
+ NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus = true
+ reply(AQUA.toString() + "I would never search")
+ }.withHelp("Reset your search data to redisplay the search tutorial")
+ thenLiteralExecute("bluehair") {
+ PronounDB.test()
+ }.withHelp("Test the pronoundb integration")
+ thenLiteral("opengui") {
+ thenArgumentExecute("class", StringArgumentType.string()) { className ->
+ try {
+ NotEnoughUpdates.INSTANCE.openGui =
+ Class.forName(this[className]).newInstance() as GuiScreen
+ reply("Opening gui: " + NotEnoughUpdates.INSTANCE.openGui)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ reply("Failed to open this GUI.")
+ }
+ }.withHelp("Open a gui by class name")
+ }
+ thenLiteralExecute("center") {
+ val x = floor(Minecraft.getMinecraft().thePlayer.posX) + 0.5f
+ val z = floor(Minecraft.getMinecraft().thePlayer.posZ) + 0.5f
+ Minecraft.getMinecraft().thePlayer.setPosition(x, Minecraft.getMinecraft().thePlayer.posY, z)
+ reply("Literal hacks")
+ }.withHelp("Center yourself on the block you are currently standing (like using AOTE)")
+ thenLiteral("minion") {
+ thenArgumentExecute("args", RestArgumentType) { arg ->
+ MinionHelperManager.getInstance().handleCommand(arrayOf("minion") + this[arg].split(" "))
+ }.withHelp("Minion related commands. Not yet integrated in brigadier")
+ }
+ thenLiteralExecute("copytablist") {
+ val tabList = TabListUtils.getTabList().joinToString("\n", postfix = "\n")
+ MiscUtils.copyToClipboard(tabList)
+ reply("Copied tablist to clipboard!")
+ }.withHelp("Copy the tab list")
+ thenLiteral("useragent") {
+ thenArgumentExecute("newuseragent", RestArgumentType) { userAgent ->
+ reply("Setting your user agent to ${this[userAgent]}")
+ NotEnoughUpdates.INSTANCE.config.hidden.customUserAgent = this[userAgent]
+ }.withHelp("Set a custom user agent for all HTTP requests")
+ thenExecute {
+ reply("Resetting your user agent.")
+ NotEnoughUpdates.INSTANCE.config.hidden.customUserAgent = null
+ }
+ }.withHelp("Reset the custom user agent")
+ }
+ hook.beforeCommand = Predicate {
+ if (!canPlayerExecute(it.context.source)) {
+ if (devFailIndex !in DEV_FAIL_STRINGS.indices) {
+ throw object : Error("L") {
+ @Override
+ fun printStackTrace() {
+ throw Error("L")
+ }
+ }
+ }
+ val text = DEV_FAIL_STRINGS[devFailIndex++]
+ if (text == SPECIAL_KICK) {
+ val component = ChatComponentText("\u00a7cYou are permanently banned from this server!")
+ component.appendText("\n")
+ component.appendText("\n\u00a77Reason: \u00a7rI told you not to run the command - Moulberry")
+ component.appendText("\n\u00a77Find out more: \u00a7b\u00a7nhttps://www.hypixel.net/appeal")
+ component.appendText("\n")
+ component.appendText("\n\u00a77Ban ID: \u00a7r#49871982")
+ component.appendText("\n\u00a77Sharing your Ban ID may affect the processing of your appeal!")
+ Minecraft.getMinecraft().netHandler.networkManager.closeChannel(component)
+ } else {
+ it.context.source.addChatMessage(ChatComponentText("$RED$text"))
+ }
+ false
+ } else {
+ true
+ }
+ }
+ }
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.kt
new file mode 100644
index 00000000..3e5e7b9b
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DiagCommand.kt
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.dev
+
+import com.mojang.brigadier.arguments.BoolArgumentType.bool
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver
+import io.github.moulberry.notenoughupdates.miscfeatures.CrystalWishingCompassSolver
+import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import io.github.moulberry.notenoughupdates.util.brigadier.EnumArgumentType.Companion.enum
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+// Why is this not merged into /neudevtest
+@NEUAutoSubscribe
+class DiagCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neudiag") {
+ thenLiteral("metal") {
+ thenLiteral("center") {
+ thenArgumentExecute("usecenter", bool()) { useCenter ->
+ CrystalMetalDetectorSolver.setDebugDoNotUseCenter(this[useCenter])
+ reply("Center coordinates-based solutions ${if (this[useCenter]) "enabled" else "disabled"}")
+ }.withHelp("Toggle coordinate based solutions")
+ }
+ thenExecute {
+ CrystalMetalDetectorSolver.logDiagnosticData(true)
+ reply("Enabled metal detector diagnostic logging.")
+ }
+ }.withHelp("Enable metal detector diagnostics")
+ thenLiteralExecute("wishing") {
+ CrystalWishingCompassSolver.getInstance().logDiagnosticData(true)
+ reply("Enabled wishing compass diagnostic logging")
+ }.withHelp("Enable wishing compass diagnostic logging")
+ thenLiteral("debug") {
+ thenLiteralExecute("list") {
+ reply("Here are all flags:\n${NEUDebugFlag.getFlagList()}")
+ }.withHelp("List all debug diagnostic logging flags")
+ thenLiteral("setflag") {
+ thenArgument("flag", enum<NEUDebugFlag>()) { flag ->
+ thenArgumentExecute("enable", bool()) { enable ->
+ val debugFlags = NotEnoughUpdates.INSTANCE.config.hidden.debugFlags
+ if (this[enable]) {
+ debugFlags.add(this[flag])
+ } else {
+ debugFlags.remove(this[flag])
+ }
+ reply("${if(this[enable]) "Enabled" else "Disabled"} the flag ${this[flag]}.")
+ }.withHelp("Enable or disable a diagnostic logging stream")
+ }
+ }
+ thenExecute {
+ reply("Effective debug flags: \n${NEUDebugFlag.getEnabledFlags()}")
+ }
+ }.withHelp("Log diagnostic data.")
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/NEUStatsCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/NEUStatsCommand.kt
new file mode 100644
index 00000000..7035aaa3
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/NEUStatsCommand.kt
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.dev
+
+import com.mojang.brigadier.context.CommandContext
+import com.sun.management.OperatingSystemMXBean
+import com.sun.management.UnixOperatingSystemMXBean
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.DiscordMarkdownBuilder
+import io.github.moulberry.notenoughupdates.util.HastebinUploader
+import io.github.moulberry.notenoughupdates.util.SBInfo
+import io.github.moulberry.notenoughupdates.util.brigadier.reply
+import io.github.moulberry.notenoughupdates.util.brigadier.thenExecute
+import io.github.moulberry.notenoughupdates.util.brigadier.thenLiteralExecute
+import io.github.moulberry.notenoughupdates.util.brigadier.withHelp
+import net.minecraft.client.Minecraft
+import net.minecraft.client.renderer.OpenGlHelper
+import net.minecraft.command.ICommandSender
+import net.minecraft.util.EnumChatFormatting.DARK_RED
+import net.minecraft.util.EnumChatFormatting.GREEN
+import net.minecraftforge.common.ForgeVersion
+import net.minecraftforge.fml.client.FMLClientHandler
+import net.minecraftforge.fml.common.Loader
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import org.lwjgl.opengl.Display
+import org.lwjgl.opengl.GL11
+import java.awt.Toolkit
+import java.awt.datatransfer.StringSelection
+import java.lang.management.ManagementFactory
+import java.util.concurrent.CompletableFuture
+import javax.management.JMX
+import javax.management.ObjectName
+
+@NEUAutoSubscribe
+class NEUStatsCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("stats", "neustats") {
+ thenLiteralExecute("modlist") {
+ clipboardAndSendMessage(
+ DiscordMarkdownBuilder()
+ .also(::appendModList)
+ .toString()
+ )
+ }.withHelp("Copy the mod list to your clipboard")
+ thenLiteralExecute("full") {
+ clipboardAndSendMessage(
+ DiscordMarkdownBuilder()
+ .also(::appendStats)
+ .also(::appendModList)
+ .toString()
+ )
+ }.withHelp("Copy the full list of all NEU stats and your mod list to your clipboard")
+ thenLiteralExecute("dump") {
+ reply("${GREEN}This will upload a dump of the java classes your game has loaded how big they are and how many there are. This can take a few seconds as it is uploading to HasteBin.")
+ uploadDataUsageDump().thenAccept {
+ clipboardAndSendMessage(it)
+ }
+ }.withHelp("Dump all loaded classes and their memory usage and copy that to your clipboard.")
+ thenExecute {
+ clipboardAndSendMessage(
+ DiscordMarkdownBuilder()
+ .also(::appendStats)
+ .also {
+ if (Loader.instance().activeModList.size <= 15) appendModList(it)
+ }
+ .toString()
+ )
+ }
+ }.withHelp("Copy a list of NEU relevant stats to your clipboard for debugging purposes")
+ }
+ interface DiagnosticCommandMXBean {
+ fun gcClassHistogram(array: Array<String>): String
+ }
+
+ private fun uploadDataUsageDump(): CompletableFuture<String?> {
+ return CompletableFuture.supplyAsync {
+ try {
+ val server =
+ ManagementFactory.getPlatformMBeanServer()
+ val objectName =
+ ObjectName.getInstance("com.sun.management:type=DiagnosticCommand")
+ val proxy = JMX.newMXBeanProxy(
+ server,
+ objectName,
+ DiagnosticCommandMXBean::class.java
+ )
+ HastebinUploader.upload(
+ proxy.gcClassHistogram(emptyArray()).replace("[", "[]"),
+ HastebinUploader.Mode.NORMAL
+ )
+ } catch (e: Exception) {
+ null
+ }
+ }
+
+ }
+
+
+ private fun getMemorySize(): Long {
+ try {
+ return (ManagementFactory.getOperatingSystemMXBean() as OperatingSystemMXBean).totalPhysicalMemorySize
+ } catch (e: java.lang.Exception) {
+ try {
+ return (ManagementFactory.getOperatingSystemMXBean() as UnixOperatingSystemMXBean).totalPhysicalMemorySize
+ } catch (ignored: java.lang.Exception) { /*IGNORE*/
+ }
+ }
+ return -1
+ }
+
+ val ONE_MB = 1024L * 1024L
+ private fun appendStats(builder: DiscordMarkdownBuilder) {
+ val maxMemory = Runtime.getRuntime().maxMemory()
+ val totalMemory = Runtime.getRuntime().totalMemory()
+ val freeMemory = Runtime.getRuntime().freeMemory()
+ val currentMemory = totalMemory - freeMemory
+ builder.category("System Stats")
+ builder.append("OS", System.getProperty("os.name"))
+ builder.append("CPU", OpenGlHelper.getCpu())
+ builder.append(
+ "Display",
+ String.format("%dx%d (%s)", Display.getWidth(), Display.getHeight(), GL11.glGetString(GL11.GL_VENDOR))
+ )
+ builder.append("GPU", GL11.glGetString(GL11.GL_RENDERER))
+ builder.append("GPU Driver", GL11.glGetString(GL11.GL_VERSION))
+ if (getMemorySize() > 0)
+ builder.append(
+ "Maximum Memory",
+ "${getMemorySize() / ONE_MB}MB"
+ )
+ builder.append("Shaders", ("" + OpenGlHelper.isFramebufferEnabled()).uppercase())
+ builder.category("Java Stats")
+ builder.append(
+ "Java",
+ "${System.getProperty("java.version")} ${if (Minecraft.getMinecraft().isJava64bit) 64 else 32}bit",
+ )
+ builder.append(
+ "Memory", String.format(
+ "% 2d%% %03d/%03dMB",
+ currentMemory * 100L / maxMemory,
+ currentMemory / ONE_MB,
+ maxMemory / ONE_MB
+ )
+ )
+ builder.append(
+ "Memory Allocated",
+ String.format("% 2d%% %03dMB", totalMemory * 100L / maxMemory, totalMemory / ONE_MB)
+ )
+ builder.category("Game Stats")
+ builder.append("FPS", Minecraft.getDebugFPS().toString())
+ builder.append("Loaded Mods", Loader.instance().activeModList.size)
+ builder.append("Forge", ForgeVersion.getVersion())
+ builder.append("Optifine", if (FMLClientHandler.instance().hasOptifine()) "TRUE" else "FALSE")
+ builder.category("Neu Settings")
+ builder.append("API Key", if (NotEnoughUpdates.INSTANCE.config.apiData.apiKey.isEmpty()) "FALSE" else "TRUE")
+ builder.append("On SkyBlock", if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) "TRUE" else "FALSE")
+ builder.append(
+ "Mod Version",
+ Loader.instance().indexedModList[NotEnoughUpdates.MODID]!!.displayVersion
+ )
+ builder.append("SB Profile", SBInfo.getInstance().currentProfile)
+ builder.append("Has Advanced Tab", if (SBInfo.getInstance().hasNewTab) "TRUE" else "FALSE")
+ builder.category("Repo Stats")
+ builder.append("Last Commit", NotEnoughUpdates.INSTANCE.manager.latestRepoCommit)
+ builder.append("Loaded Items", NotEnoughUpdates.INSTANCE.manager.itemInformation.size.toString())
+ }
+
+ private fun appendModList(builder: DiscordMarkdownBuilder): DiscordMarkdownBuilder {
+ builder.category("Mods Loaded")
+ Loader.instance().activeModList.forEach {
+ builder.append(it.name, "${it.source} (${it.displayVersion})")
+ }
+ return builder
+ }
+
+ fun CommandContext<ICommandSender>.clipboardAndSendMessage(data: String?) {
+ if (data == null) {
+ reply("${DARK_RED}Error occurred trying to perform command.")
+ return
+ }
+ try {
+ val clipboard = StringSelection(data)
+ Toolkit.getDefaultToolkit().systemClipboard.setContents(clipboard, null)
+ reply("${GREEN}Dev info copied to clipboard.")
+ } catch (ignored: Exception) {
+ reply("${DARK_RED}Could not copy to clipboard.")
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt
new file mode 100644
index 00000000..fceacfab
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.dev
+
+import com.mojang.brigadier.arguments.DoubleArgumentType.doubleArg
+import com.mojang.brigadier.builder.ArgumentBuilder
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.core.util.MiscUtils
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.client.Minecraft
+import net.minecraft.client.entity.AbstractClientPlayer
+import net.minecraft.command.ICommandSender
+import net.minecraft.entity.Entity
+import net.minecraft.entity.EntityLiving
+import net.minecraft.entity.EntityLivingBase
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.entity.player.EntityPlayer
+import net.minecraft.item.ItemStack
+import net.minecraft.util.EnumChatFormatting
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class PackDevCommand {
+
+ fun <T : EntityLivingBase, U : ArgumentBuilder<ICommandSender, U>> U.npcListCommand(
+ name: String,
+ singleCommand: String,
+ multipleCommand: String,
+ clazz: Class<T>,
+ provider: () -> List<Entity>
+ ) {
+ fun getEntities(distance: Double): List<T> {
+ val distanceSquared = distance * distance
+ val thePlayer = Minecraft.getMinecraft().thePlayer
+ return provider()
+ .asSequence()
+ .filterIsInstance(clazz)
+ .filter { it != thePlayer }
+ .filter { it.getDistanceSqToEntity(thePlayer) < distanceSquared }
+ .toList()
+ }
+
+ thenLiteral(singleCommand) {
+ thenArgumentExecute("distance", doubleArg(0.0)) { dist ->
+ val dist = this[dist]
+ val entity = getEntities(dist).minByOrNull { it.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) }
+ if (entity == null) {
+ reply("No $name found within $dist blocks")
+ return@thenArgumentExecute
+ }
+ MiscUtils.copyToClipboard(StringBuilder().appendEntityData(entity).toString().trim())
+ reply("Copied data to clipboard")
+ }.withHelp("Find the nearest $name and copy data about them to your clipboard")
+ }
+ thenLiteral(multipleCommand) {
+ thenArgumentExecute("distance", doubleArg(0.0)) { dist ->
+ val dist = this[dist]
+ val entity = getEntities(dist)
+ val sb = StringBuilder()
+ reply("Found ${entity.size} ${name}s")
+ if (entity.isNotEmpty()) {
+ entity.forEach {
+ sb.appendEntityData(it)
+ }
+ MiscUtils.copyToClipboard(sb.toString().trim())
+
+ reply("Copied data to clipboard")
+ }
+ }.withHelp("Find all $name within range and copy data about them to your clipboard")
+ }
+ }
+
+ fun StringBuilder.appendEntityData(entity: EntityLivingBase) {
+ if (entity is EntityPlayer) {
+ append("Player UUID: ")
+ appendLine(entity.uniqueID)
+ if (entity is AbstractClientPlayer) {
+ append("Entity Texture Id: ")
+ appendLine(entity.locationSkin.resourcePath?.replace("skins/", ""))
+ }
+ }
+ append("Custom Name Tag: ")
+ appendLine(entity.customNameTag ?: "null")
+ append("Mob: ")
+ appendLine(entity.name)
+ append("Entity Id: ")
+ appendLine(entity.entityId)
+
+ appendItemData("Item", entity.heldItem)
+
+ for ((slot, name) in listOf("Boots", "Leggings", "Chestplate", "Helmet").withIndex()) {
+ val armorPiece = entity.getCurrentArmor(slot)
+ appendItemData(name, armorPiece)
+ }
+ appendLine()
+ appendLine()
+ }
+
+ fun StringBuilder.appendItemData(name: String, item: ItemStack?) {
+ append("$name: ")
+ if (item != null) {
+ appendLine(item)
+ append("$name Display Name")
+ appendLine(item.displayName)
+ append("$name Tag Compound: ")
+ val compound = item.tagCompound
+ if (compound == null) {
+ appendLine("null")
+ } else {
+ appendLine(compound)
+ append("$name Tag Compound Extra Attributes")
+ appendLine(compound.getTag("ExtraAttributes"))
+ }
+ } else {
+ appendLine("null")
+ }
+
+ }
+
+
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neupackdev") {
+ npcListCommand("Player", "getplayer", "getplayers", AbstractClientPlayer::class.java) {
+ Minecraft.getMinecraft().theWorld.playerEntities
+ }
+ npcListCommand("NPC", "getnpc", "getnpcs", AbstractClientPlayer::class.java) {
+ Minecraft.getMinecraft().theWorld.playerEntities.filter { it.uniqueID?.version() != 4 }
+ }
+ npcListCommand("mob", "getmob", "getmobs", EntityLiving::class.java) {
+ Minecraft.getMinecraft().theWorld.loadedEntityList
+ }
+ npcListCommand("armor stand", "getarmorstand", "getarmorstands", EntityArmorStand::class.java) {
+ Minecraft.getMinecraft().theWorld.loadedEntityList
+ }
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.packDevEnabled = !NotEnoughUpdates.INSTANCE.packDevEnabled
+ if (NotEnoughUpdates.INSTANCE.packDevEnabled) {
+ reply("${EnumChatFormatting.GREEN}Enabled pack developer mode.")
+ } else {
+ reply("${EnumChatFormatting.RED}Disabled pack developer mode.")
+ }
+ }
+ }.withHelp("Toggle pack developer mode")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/SimpleDevCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/SimpleDevCommands.kt
new file mode 100644
index 00000000..95a6500e
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/SimpleDevCommands.kt
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.dev
+
+import com.mojang.brigadier.arguments.FloatArgumentType.floatArg
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.dungeons.DungeonWin
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.miscfeatures.NullzeeSphere
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.client.entity.EntityPlayerSP
+import net.minecraft.event.ClickEvent
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.ResourceLocation
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.function.Consumer
+
+@NEUAutoSubscribe
+class SimpleDevCommands {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neureloadrepo") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.manager.reloadRepository()
+ reply("Reloaded repository.")
+ }
+ }.withHelp("Reload the NEU data repository from disk (not from network)")
+ event.command("neudungeonwintest") {
+ thenArgumentExecute("file", string()) { file ->
+ DungeonWin.TEAM_SCORE = ResourceLocation("notenoughupdates:dungeon_win/${this[file].lowercase()}.png")
+ reply("Changed the dungeon win display")
+ }.withHelp("Change the dungeon win test to load from a file")
+ thenExecute {
+ DungeonWin.displayWin()
+ }
+ }.withHelp("Display the dungeon win pop up")
+ event.command("neuenablestorage") {
+ thenLiteralExecute("disable") {
+ NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 = true
+ NotEnoughUpdates.INSTANCE.saveConfig()
+ reply("Disabled the NEU storage overlay. Click here to enable again") {
+ chatStyle.chatClickEvent = ClickEvent(
+ ClickEvent.Action.SUGGEST_COMMAND,
+ "/neuenablestorage"
+ )
+ }
+ }.withHelp("Disable the neu storage overlay")
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 = true
+ NotEnoughUpdates.INSTANCE.saveConfig()
+ reply("Enabled the NEU storage overlay. Click here to disable again") {
+ chatStyle.chatClickEvent = ClickEvent(
+ ClickEvent.Action.SUGGEST_COMMAND,
+ "/neuenablestorage disable"
+ )
+ }
+ }
+ }.withHelp("Enable the neu storage overlay")
+ event.command("neuzeesphere") {
+ thenLiteralExecute("on") {
+ NullzeeSphere.enabled = true
+ reply("Enabled nullzee sphere")
+ }.withHelp("Enable nullzee sphere")
+ thenLiteralExecute("off") {
+ NullzeeSphere.enabled = false
+ reply("Disabled nullzee sphere")
+ }.withHelp("Disable nullzee sphere")
+ thenLiteralExecute("setcenter") {
+ val p = source as EntityPlayerSP
+ NullzeeSphere.centerPos = BlockPos(p.posX, p.posY, p.posZ)
+ NullzeeSphere.overlayVBO = null
+ reply("Set center to ${NullzeeSphere.centerPos}")
+ }.withHelp("Set the center of the nullzee sphere")
+ thenArgumentExecute("radius", floatArg(0F)) { size ->
+ NullzeeSphere.size = this[size]
+ NullzeeSphere.overlayVBO = null
+ reply("Set size to ${this[size]}")
+ }.withHelp("Set the radius of the nullzee sphere")
+ }
+ event.command("neuresetrepo") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.manager
+ .userFacingRepositoryReload()
+ .thenAccept { it
+ it.forEach(::reply)
+ }
+ }
+ }.withHelp("Reload the NEU data repository from network")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt
new file mode 100644
index 00000000..6cc4e255
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.kt
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.help
+
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.Constants
+import io.github.moulberry.notenoughupdates.util.Utils
+import io.github.moulberry.notenoughupdates.util.brigadier.reply
+import io.github.moulberry.notenoughupdates.util.brigadier.thenExecute
+import io.github.moulberry.notenoughupdates.util.brigadier.withHelp
+import net.minecraft.event.ClickEvent
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.EnumChatFormatting
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class FeaturesCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neufeatures") {
+ thenExecute {
+ reply("")
+ val url = Constants.MISC?.get("featureslist")?.asString
+ if (url == null) {
+ Utils.showOutdatedRepoNotification()
+ return@thenExecute
+ }
+
+ if (Utils.openUrl(url)) {
+ reply(
+ EnumChatFormatting.DARK_PURPLE.toString() + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET +
+ EnumChatFormatting.GOLD + "> Opening Feature List in browser."
+ )
+ } else {
+ val clickTextFeatures = ChatComponentText(
+ (EnumChatFormatting.DARK_PURPLE.toString() + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET +
+ EnumChatFormatting.GOLD + "> Click here to open the Feature List in your browser.")
+ )
+ clickTextFeatures.chatStyle =
+ Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)
+ reply(clickTextFeatures)
+ }
+ reply("")
+ }
+ }.withHelp("List all of NEUs features")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt
new file mode 100644
index 00000000..1b4f817e
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.help
+
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class HelpCommand {
+ val neuHelpMessages = listOf(
+ "§5§lNotEnoughUpdates commands",
+ "§6/neu §7- Opens the main NEU GUI.",
+ "§6/pv §b?{name} §2ⴵ §r§7- Opens the profile viewer",
+ "§6/neusouls {on/off/clear/unclear} §r§7- Shows waypoints to fairy souls.",
+ "§6/neubuttons §r§7- Opens a GUI which allows you to customize inventory buttons.",
+ "§6/neuec §r§7- Opens the enchant colour GUI.",
+ "§6/join {floor} §r§7- Short Command to join a Dungeon. §lNeed a Party of 5 People§r§7 {4/f7/m5}.",
+ "§6/neucosmetics §r§7- Opens the cosmetic GUI.",
+ "§6/neurename §r§7- Opens the NEU Item Customizer.",
+ "§6/cata §b?{name} §2ⴵ §r§7- Opens the profile viewer's Catacombs page.",
+ "§6/neulinks §r§7- Shows links to NEU/Moulberry.",
+ "§6/neuoverlay §r§7- Opens GUI Editor for quickcommands and searchbar.",
+ "§6/neuah §r§7- Opens NEU's custom auction house GUI.",
+ "§6/neucalendar §r§7- Opens NEU's custom calendar GUI.",
+ "§6/neucalc §r§7- Run calculations.",
+ "",
+ "§6§lOld commands:",
+ "§6/peek §b?{user} §2ⴵ §r§7- Shows quick stats for a user.",
+ "",
+ "§6§lDebug commands:",
+ "§6/neustats §r§7- Copies helpful info to the clipboard.",
+ "§6/neustats modlist §r§7- Copies mod list info to clipboard.",
+ "§6/neuresetrepo §r§7- Deletes all repo files.",
+ "§6/neureloadrepo §r§7- Debug command with repo.",
+ "",
+ "§6§lDev commands:",
+ "§6/neupackdev §r§7- pack creator command - getnpc, getmob(s), getarmorstand(s), getall. Optional radius argument for all."
+ )
+ val neuDevHelpMessages = listOf(
+ "§6/neudevtest §r§7- dev test command",
+ "§6/neuzeephere §r§7- sphere",
+ "§6/neudungeonwintest §r§7- displays the dungeon win screen"
+ )
+ val helpInfo = listOf(
+ "",
+ "§7Commands marked with a §2\"ⴵ\"§7 require an api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"",
+ "",
+ "§7Arguments marked with a §b\"?\"§7 are optional.",
+ "",
+ "§6§lScroll up to see everything"
+ )
+
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neuhelp") {
+ thenArgumentExecute("command", string()) { commandName ->
+ val commandNode = event.dispatcher.root.getChild(this[commandName])
+ if (commandNode == null) {
+ reply("Could not find NEU command with name ${this[commandName]}")
+ return@thenArgumentExecute
+ }
+ reply(event.brigadierRoot.getAllUsages("/${this[commandName]}", commandNode).joinToString("\n"){
+ "${it.path} - ${it.help}"
+ })
+ }.withHelp("Display help for a specific NEU command")
+ thenExecute {
+ neuHelpMessages.forEach(::reply)
+ if (NotEnoughUpdates.INSTANCE.config.hidden.dev)
+ neuDevHelpMessages.forEach(::reply)
+ helpInfo.forEach(::reply)
+ }
+ }.withHelp("Display a list of all NEU commands")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt
new file mode 100644
index 00000000..957948ae
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/LinksCommand.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.help
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.Utils
+import io.github.moulberry.notenoughupdates.util.brigadier.reply
+import io.github.moulberry.notenoughupdates.util.brigadier.thenExecute
+import io.github.moulberry.notenoughupdates.util.brigadier.withHelp
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class LinksCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neulinks") {
+ thenExecute {
+ val manager = NotEnoughUpdates.INSTANCE.manager
+ val updateJsonFile = manager.repoLocation.resolve("update.json")
+ if (!updateJsonFile.exists()) {
+ Utils.showOutdatedRepoNotification()
+ return@thenExecute
+ }
+ try {
+ val updateJson = manager.getJsonFromFile(updateJsonFile)
+ NotEnoughUpdates.INSTANCE.displayLinks(updateJson, 0)
+ } catch (_: Exception) {
+ Utils.showOutdatedRepoNotification()
+ }
+ }
+ }.withHelp("Display links for Moulberry and NEU")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.kt
new file mode 100644
index 00000000..fe58c807
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/SettingsCommand.kt
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.help
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.options.NEUConfigEditor
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class SettingsCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neu", "neusettings") {
+ thenArgument("search", RestArgumentType) { search ->
+ suggestsList(ConfigProcessor.create(NotEnoughUpdates.INSTANCE.config).keys.toList())
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiScreenElementWrapper(
+ NEUConfigEditor(
+ NotEnoughUpdates.INSTANCE.config,
+ this[search]
+ )
+ )
+ }
+ }.withHelp("Search the NEU settings")
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui =
+ GuiScreenElementWrapper(NEUConfigEditor(NotEnoughUpdates.INSTANCE.config))
+ }
+ }.withHelp("Open the NEU settings")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.kt
new file mode 100644
index 00000000..782eaf3d
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/StorageViewerWhyCommand.kt
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+package io.github.moulberry.notenoughupdates.commands.help
+
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.NotificationHandler
+import io.github.moulberry.notenoughupdates.util.brigadier.thenExecute
+import io.github.moulberry.notenoughupdates.util.brigadier.withHelp
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class StorageViewerWhyCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neustwhy") {
+ thenExecute {
+ NotificationHandler.displayNotification(
+ listOf(
+ "§eStorage Viewer",
+ "§7Currently, the storage viewer requires you to click twice",
+ "§7in order to switch between pages. This is because Hypixel",
+ "§7has not yet added a shortcut command to go to any enderchest/",
+ "§7storage page.",
+ "§7While it is possible to send the second click",
+ "§7automatically, doing so violates Hypixel's new mod rules."
+ ), true
+ )
+ }
+ }.withHelp("Display information about why you have to click twice in the NEU storage overlay")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt
new file mode 100644
index 00000000..c7d80487
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.kt
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.auction.CustomAHGui
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.Utils
+import io.github.moulberry.notenoughupdates.util.brigadier.RestArgumentType
+import io.github.moulberry.notenoughupdates.util.brigadier.get
+import io.github.moulberry.notenoughupdates.util.brigadier.reply
+import io.github.moulberry.notenoughupdates.util.brigadier.thenArgumentExecute
+import net.minecraft.util.EnumChatFormatting.RED
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.function.Predicate
+
+@NEUAutoSubscribe
+class AhCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ val hook = event.command("neuah") {
+
+ thenArgumentExecute("search", RestArgumentType) { search ->
+ if (NotEnoughUpdates.INSTANCE.config.apiData.apiKey == null ||
+ NotEnoughUpdates.INSTANCE.config.apiData.apiKey.isBlank()
+ ) {
+ reply("${RED}Can't open NEU AH: an api key is not set. Run /api new and put the result in settings.")
+ return@thenArgumentExecute
+ }
+ NotEnoughUpdates.INSTANCE.openGui = CustomAHGui()
+ NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.lastOpen = System.currentTimeMillis()
+ NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.clearSearch()
+ NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.updateSearch()
+
+ val search = this[search]
+
+ NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(
+ if (search.isBlank() && NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch)
+ null else search
+ )
+ }
+ }
+ hook.beforeCommand = Predicate {
+ if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard())
+ Utils.addChatMessage("${RED}You must be on SkyBlock to use this feature.")
+ NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt
new file mode 100644
index 00000000..3b721df5
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import com.google.gson.JsonObject
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.block.material.MapColor
+import net.minecraft.client.Minecraft
+import net.minecraft.item.ItemMap
+import net.minecraft.util.EnumChatFormatting.GREEN
+import net.minecraft.util.EnumChatFormatting.RED
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.awt.Color
+
+@NEUAutoSubscribe
+class DungeonCommands {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("dh") {
+ thenExecute {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub")
+ }
+ }.withHelp("Warps to the dungeon hub")
+ event.command("dn") {
+ thenExecute {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub")
+ reply("Warping to...")
+ reply("Deez nuts lmao")
+ }
+ }.withHelp("Warps to the dungeon nuts")
+ event.command("join") {
+ thenArgument("floor", string()) { floor ->
+ suggestsList((1..7).flatMap { listOf("f$it", "m$it") })
+ thenExecute {
+ val floor = this[floor]
+ val prefix = if (floor.startsWith("m")) "master_catacombs" else "catacombs"
+ val level = floor.lastOrNull()?.digitToIntOrNull()
+ val cmd = "/joindungeon $prefix ${floor.lastOrNull()}"
+ reply("Running command: $cmd")
+ Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd)
+ }
+ }.withHelp("Join a dungeon floor with a party of 5")
+ }
+ event.command("neumap") {
+ thenLiteral("reset") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.colourMap = null
+ reply("Reset color map")
+ }
+ requiresDev()
+ }.withHelp("Reset the colour map")
+ thenLiteral("save") {
+ thenArgument("filename", string()) { fileName ->
+ requiresDev()
+ thenExecute {
+ val stack = Minecraft.getMinecraft().thePlayer.heldItem
+ if (stack == null || stack.item !is ItemMap) {
+ reply("Please hold a map item")
+ return@thenExecute
+ }
+ val map = stack.item as ItemMap
+ val mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld)
+ if (mapData == null) {
+ reply("Could not grab map data (empty map)")
+ return@thenExecute
+ }
+ val json = JsonObject()
+ for (i in 0 until (128 * 128)) {
+ val x = i % 128
+ val y = i / 128
+ val j = mapData.colors[i].toInt() and 255
+ val c = if (j / 4 == 0) {
+ Color((i + i / 128 and 1) * 8 + 16 shl 24, true)
+ } else {
+ Color(MapColor.mapColorArray[j / 4].getMapColor(j and 3), true)
+ }
+ json.addProperty("$x:$y", c.rgb)
+ }
+ try {
+ NotEnoughUpdates.INSTANCE.manager.configLocation.resolve("maps").mkdirs()
+ NotEnoughUpdates.INSTANCE.manager.writeJson(
+ json,
+ NotEnoughUpdates.INSTANCE.manager.configLocation.resolve("maps/${this[fileName]}.json")
+ )
+ reply("${GREEN}Saved to file.")
+ } catch (e: Exception) {
+ e.printStackTrace()
+ reply("${RED}Failed to save.")
+ }
+ }
+ }.withHelp("Save a colour map from an item")
+ }
+ thenLiteral("load") {
+ thenArgument("filename", string()) { fileName ->
+ requiresDev()
+ thenExecute {
+ val json = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(
+ NotEnoughUpdates.INSTANCE.manager.configLocation.resolve(
+ "maps/${this[fileName]}.json"
+ )
+ )
+ NotEnoughUpdates.INSTANCE.colourMap = (0 until 128).map { x ->
+ (0 until 128).map { y ->
+ val key = "$x:$y"
+ json[key]?.asInt?.let { Color(it, true) } ?: Color(0, 0, 0, 0)
+ }.toTypedArray()
+ }.toTypedArray()
+ for (x in 0..127) {
+ for (y in 0..127) {
+ NotEnoughUpdates.INSTANCE.colourMap[x][y] = Color(0, 0, 0, 0)
+ }
+ }
+ reply("Loaded colour map from file")
+ }
+ }.withHelp("Load a colour map from a file")
+ }
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiDungeonMapEditor(null)
+ }
+ }.withHelp("Open the dungeon map editor")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/FairySoulsCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/FairySoulsCommand.kt
new file mode 100644
index 00000000..1d766646
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/FairySoulsCommand.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.util.EnumChatFormatting.DARK_PURPLE
+import net.minecraft.util.EnumChatFormatting.RED
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class FairySoulsCommand {
+
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neusouls", "fairysouls") {
+ val enable = thenLiteralExecute("enable") {
+ if (!FairySouls.getInstance().isTrackSouls) {
+ reply("${RED}Fairy soul tracking is off, enable it using /neu before using this command")
+ return@thenLiteralExecute
+ }
+ reply("${DARK_PURPLE}Enabled fairy soul waypoints")
+ FairySouls.getInstance().setShowFairySouls(true)
+ }.withHelp("Show fairy soul waypoints")
+ thenLiteral("on") { redirect(enable) }
+ val disable = thenLiteralExecute("disable") {
+ FairySouls.getInstance().setShowFairySouls(false)
+ reply("${DARK_PURPLE}Disabled fairy soul waypoints")
+ }.withHelp("Hide fairy soul waypoints")
+ thenLiteral("off") { redirect(disable) }
+ val clear = thenLiteralExecute("clear") {
+ FairySouls.getInstance().markAllAsFound()
+ // Reply handled by mark all as found
+ }.withHelp("Mark all fairy souls in your current world as found")
+ thenLiteral("markfound") { redirect(clear) }
+ val unclear = thenLiteralExecute("unclear") {
+ FairySouls.getInstance().markAllAsMissing()
+ // Reply handled by mark all as missing
+ }.withHelp("Mark all fairy souls in your current world as not found")
+ thenLiteral("marknotfound") { redirect(unclear) }
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/MiscCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/MiscCommands.kt
new file mode 100644
index 00000000..caa57909
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/MiscCommands.kt
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import io.github.moulberry.notenoughupdates.NEUManager
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.cosmetics.GuiCosmetics
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay
+import io.github.moulberry.notenoughupdates.miscgui.DynamicLightItemsEditor
+import io.github.moulberry.notenoughupdates.miscgui.GuiItemCustomize
+import io.github.moulberry.notenoughupdates.util.Calculator
+import io.github.moulberry.notenoughupdates.util.Calculator.CalculatorException
+import io.github.moulberry.notenoughupdates.util.MinecraftExecutor
+import io.github.moulberry.notenoughupdates.util.PronounDB
+import io.github.moulberry.notenoughupdates.util.Utils
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.client.Minecraft
+import net.minecraft.client.renderer.OpenGlHelper
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.EnumChatFormatting.*
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.text.DecimalFormat
+import java.util.*
+import java.util.concurrent.CompletableFuture
+
+@NEUAutoSubscribe
+class MiscCommands {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neucalc", "neucalculator") {
+ thenArgumentExecute("calculation", RestArgumentType) { calculation ->
+ val calculation = this[calculation]
+ try {
+ val calculate = Calculator.calculate(calculation)
+ val formatter = DecimalFormat("#,##0.##")
+ val formatted = formatter.format(calculate)
+ reply("$WHITE$calculation $YELLOW= $GREEN$formatted")
+ } catch (e: CalculatorException) {
+ reply(
+ "${RED}Error during calculation: ${e.message}\n${WHITE}${calculation.substring(0, e.offset)}" +
+ "${DARK_RED}${calculation.substring(e.offset, e.length + e.offset)}${GRAY}" +
+ calculation.substring(e.length + e.offset)
+ )
+ }
+ }.withHelp("Calculate an expression")
+ thenExecute {
+ reply(
+ "§5It's a calculator.\n" +
+ "§eFor Example §b/neucalc 3m*7k§e.\n" +
+ "§eYou can also use suffixes (k, m, b, t, s)§e.\n" +
+ "§eThe \"s\" suffix acts as 64.\n" +
+ "§eTurn on Sign Calculator in /neu misc to also support this in sign popups and the neu search bar."
+ )
+ }
+ }.withHelp("Display help for NEUs calculator")
+ event.command("neucalendar") {
+ thenExecute {
+ Minecraft.getMinecraft().thePlayer.closeScreen()
+ CalendarOverlay.setEnabled(true)
+ NotEnoughUpdates.INSTANCE.sendChatMessage("/calendar")
+ }
+ }.withHelp("Display NEUs custom calendar overlay")
+ event.command("neucosmetics") {
+ thenExecute {
+ if (!OpenGlHelper.isFramebufferEnabled() && NotEnoughUpdates.INSTANCE.config.notifications.doFastRenderNotif) {
+ reply(
+ "${RED}NEU Cosmetics do not work with OptiFine Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it."
+ )
+ }
+ NotEnoughUpdates.INSTANCE.openGui = GuiCosmetics()
+ }
+ }.withHelp("Equip NEU cosmetics")
+ event.command("neucustomize", "neurename") {
+ thenExecute {
+ val held = Minecraft.getMinecraft().thePlayer.heldItem
+ if (held == null) {
+ reply("${RED}You can't customize your hand...")
+ return@thenExecute
+ }
+ val heldUUID = NEUManager.getUUIDForItem(held)
+ if (heldUUID == null) {
+ reply("${RED}This item does not have an UUID, so it cannot be customized.")
+ return@thenExecute
+ }
+
+ NotEnoughUpdates.INSTANCE.openGui = GuiItemCustomize(held, heldUUID)
+ }
+ }.withHelp("Customize your items")
+ event.command("neupronouns", "neuliberals") {
+ thenArgument("user", string()) {user->
+ suggestsList { Minecraft.getMinecraft().theWorld.playerEntities.map { it.name } }
+ thenArgumentExecute("platform", string()) { platform ->
+ fetchPronouns(this[platform], this[user])
+ }.withHelp("Look up someones pronouns using their username on a platform")
+ thenExecute {
+ fetchPronouns("minecraft", this[user])
+ }
+ }.withHelp("Look up someones pronouns using their minecraft username")
+ }
+ event.command("neuupdate", "neuupdates", "enoughupdates") {
+ thenLiteralExecute("check") {
+ NotEnoughUpdates.INSTANCE.autoUpdater.displayUpdateMessageIfOutOfDate()
+ }.withHelp("Check for updates")
+ thenLiteralExecute("scheduledownload") {
+ NotEnoughUpdates.INSTANCE.autoUpdater.scheduleDownload()
+ }.withHelp("Queue a new version of NEU to be downloaded")
+ thenLiteralExecute("updatemodes") {
+ reply("§bTo ensure we do not accidentally corrupt your mod folder, we can only offer support for auto-updates on system with certain capabilities for file deletions (specifically unix systems). You can still manually update your files")
+ }.withHelp("Display an explanation why you cannot auto update")
+ }
+ event.command("neudynamiclights", "neudli", "neudynlights", "neudynamicitems") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = DynamicLightItemsEditor()
+ }
+ }.withHelp("Add items to dynamically emit light")
+ }
+
+ fun fetchPronouns(platform: String, user: String) {
+ val nc = Minecraft.getMinecraft().ingameGUI.chatGUI
+ val id = Random().nextInt()
+ nc.printChatMessageWithOptionalDeletion(ChatComponentText("§e[NEU] Fetching Pronouns..."), id)
+
+ val pronouns = if ("minecraft" == platform) {
+ val c = CompletableFuture<UUID>()
+ NotEnoughUpdates.profileViewer.getPlayerUUID(user) { uuidString ->
+ if (uuidString == null) {
+ c.completeExceptionally(NullPointerException())
+ } else {
+ c.complete(Utils.parseDashlessUUID(uuidString))
+ }
+ }
+ c.thenCompose { minecraftPlayer ->
+ PronounDB.getPronounsFor(minecraftPlayer)
+ }
+ } else {
+ PronounDB.getPronounsFor(platform, user)
+ }
+ pronouns.handleAsync({ pronounChoice, throwable ->
+ if (throwable != null || !pronounChoice.isPresent) {
+ nc.printChatMessageWithOptionalDeletion(ChatComponentText("§e[NEU] §4Failed to fetch pronouns."), id)
+ return@handleAsync null
+ }
+ val betterPronounChoice = pronounChoice.get()
+ nc.printChatMessageWithOptionalDeletion(
+ ChatComponentText("§e[NEU] Pronouns for §b$user §eon §b$platform§e:"), id
+ )
+ betterPronounChoice.render().forEach {
+ nc.printChatMessage(ChatComponentText("§e[NEU] §a$it"))
+ }
+ null
+ }, MinecraftExecutor.OffThread)
+
+ }
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/PeekCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/PeekCommand.kt
new file mode 100644
index 00000000..61fa6029
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/PeekCommand.kt
@@ -0,0 +1,318 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer
+import io.github.moulberry.notenoughupdates.util.Utils
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.client.Minecraft
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.EnumChatFormatting.*
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import org.apache.commons.lang3.text.WordUtils
+import java.util.*
+import java.util.concurrent.*
+
+@NEUAutoSubscribe
+class PeekCommand {
+
+ var future: Future<*>? = null
+ val executor = Executors.newScheduledThreadPool(1)
+
+ fun executePeek(name: String) {
+ val chatGui = Minecraft.getMinecraft().ingameGUI.chatGUI
+ val id = Random().nextInt(Int.MAX_VALUE / 2) + Int.MAX_VALUE / 2
+ fun deleteReply(text: String) {
+ chatGui.printChatMessageWithOptionalDeletion(ChatComponentText(text), id)
+ }
+
+ deleteReply("$YELLOW[PEEK] Getting player information...")
+
+
+ NotEnoughUpdates.profileViewer.getProfileByName(
+ name
+ ) { profile: ProfileViewer.Profile? ->
+ if (profile == null) {
+ deleteReply("$RED[PEEK] Unknown player or the Hypixel API is down.")
+ } else {
+ profile.resetCache()
+ if (future?.isDone != true) {
+ Utils.addChatMessage(
+ "$RED[PEEK] New peek command was run, cancelling old one."
+ )
+ future?.cancel(true)
+ }
+ deleteReply("$YELLOW[PEEK] Getting the player's SkyBlock profile(s)...")
+ val startTime = System.currentTimeMillis()
+ future = ForkJoinPool.commonPool().submit(object : Runnable {
+ override fun run() {
+ if (System.currentTimeMillis() - startTime > 10 * 1000) {
+ deleteReply("$RED[PEEK] Getting profile info took too long, aborting.")
+ return
+ }
+ val g = GRAY.toString()
+ val profileInfo = profile.getProfileInformation(null)
+ if (profileInfo == null) {
+ future = executor.schedule(this, 200, TimeUnit.MILLISECONDS)
+ return
+ }
+ var overallScore = 0f
+ val isMe = name.equals("moulberry", ignoreCase = true)
+ val stats = profile.getStats(null)
+ if (stats == null) {
+ future = executor.schedule(this, 200, TimeUnit.MILLISECONDS)
+ return
+ }
+ val skyblockInfo = profile.getSkyblockInfo(null)
+ if (NotEnoughUpdates.INSTANCE.config.profileViewer.useSoopyNetworth) {
+ deleteReply("$YELLOW[PEEK] Getting the player's Skyblock networth...")
+ val countDownLatch = CountDownLatch(1)
+ profile.getSoopyNetworth(null, Runnable { countDownLatch.countDown() })
+ try { //Wait for async network request
+ countDownLatch.await(10, TimeUnit.SECONDS)
+ } catch (e: InterruptedException) {
+ }
+
+ //Now it's waited for network request the data should be cached (accessed in nw section)
+ }
+ deleteReply(
+ "$GREEN $STRIKETHROUGH-=-$RESET$GREEN ${
+ Utils.getElementAsString(
+ profile.hypixelProfile!!["displayname"],
+ name
+ )
+ }'s Info $STRIKETHROUGH-=-"
+ )
+ if (skyblockInfo == null) {
+ Utils.addChatMessage(YELLOW.toString() + "Skills API disabled!")
+ } else {
+ var totalSkillLVL = 0f
+ var totalSkillCount = 0f
+ val skills: List<String> =
+ mutableListOf(
+ "taming",
+ "mining",
+ "foraging",
+ "enchanting",
+ "farming",
+ "combat",
+ "fishing",
+ "alchemy",
+ "carpentry"
+ )
+ for (skillName in skills) {
+ totalSkillLVL += skyblockInfo[skillName]!!.level
+ totalSkillCount++
+ }
+ var combat = skyblockInfo["combat"]!!.level
+ var zombie = skyblockInfo["zombie"]!!.level
+ var spider = skyblockInfo["spider"]!!.level
+ var wolf = skyblockInfo["wolf"]!!.level
+ var enderman = skyblockInfo["enderman"]!!.level
+ var blaze = skyblockInfo["blaze"]!!.level
+ var avgSkillLVL = totalSkillLVL / totalSkillCount
+ if (isMe) {
+ avgSkillLVL = 6f
+ combat = 4f
+ zombie = 2f
+ spider = 1f
+ wolf = 2f
+ enderman = 0f
+ blaze = 0f
+ }
+ val combatPrefix =
+ if (combat > 20) (if (combat > 35) GREEN else YELLOW) else RED
+ val zombiePrefix =
+ if (zombie > 3) (if (zombie > 6) GREEN else YELLOW) else RED
+ val spiderPrefix =
+ if (spider > 3) (if (spider > 6) GREEN else YELLOW) else RED
+ val wolfPrefix =
+ if (wolf > 3) (if (wolf > 6) GREEN else YELLOW) else RED
+ val endermanPrefix =
+ if (enderman > 3) (if (enderman > 6) GREEN else YELLOW) else RED
+ val blazePrefix =
+ if (blaze > 3) (if (blaze > 6) GREEN else YELLOW) else RED
+ val avgPrefix =
+ if (avgSkillLVL > 20) (if (avgSkillLVL > 35) GREEN else YELLOW) else RED
+ overallScore += zombie * zombie / 81f
+ overallScore += spider * spider / 81f
+ overallScore += wolf * wolf / 81f
+ overallScore += enderman * enderman / 81f
+ overallScore += blaze * blaze / 81f
+ overallScore += avgSkillLVL / 20f
+ val cata = skyblockInfo["catacombs"]!!.level.toInt()
+ val cataPrefix =
+ if (cata > 15) (if (cata > 25) GREEN else YELLOW) else RED
+ overallScore += cata * cata / 2000f
+ Utils.addChatMessage(
+ g + "Combat: " + combatPrefix + Math.floor(combat.toDouble())
+ .toInt() +
+ (if (cata > 0) "$g - Cata: $cataPrefix$cata" else "") +
+ g + " - AVG: " + avgPrefix + Math.floor(avgSkillLVL.toDouble())
+ .toInt()
+ )
+ Utils.addChatMessage(
+ g + "Slayer: " + zombiePrefix + Math.floor(zombie.toDouble())
+ .toInt() + g + "-" +
+ spiderPrefix + Math.floor(spider.toDouble())
+ .toInt() + g + "-" +
+ wolfPrefix + Math.floor(wolf.toDouble()).toInt() + g + "-" +
+ endermanPrefix + Math.floor(enderman.toDouble())
+ .toInt() + g + "-" +
+ blazePrefix + Math.floor(blaze.toDouble()).toInt()
+ )
+ }
+ val health = stats["health"].toInt()
+ val defence = stats["defence"].toInt()
+ val strength = stats["strength"].toInt()
+ val intelligence = stats["intelligence"].toInt()
+ val healthPrefix =
+ if (health > 800) (if (health > 1600) GREEN else YELLOW) else RED
+ val defencePrefix =
+ if (defence > 200) (if (defence > 600) GREEN else YELLOW) else RED
+ val strengthPrefix =
+ if (strength > 100) (if (strength > 300) GREEN else YELLOW) else RED
+ val intelligencePrefix =
+ if (intelligence > 300) (if (intelligence > 900) GREEN else YELLOW) else RED
+ Utils.addChatMessage(
+ g + "Stats : " + healthPrefix + health + RED + "\u2764 " +
+ defencePrefix + defence + GREEN + "\u2748 " +
+ strengthPrefix + strength + RED + "\u2741 " +
+ intelligencePrefix + intelligence + AQUA + "\u270e "
+ )
+ val bankBalance =
+ Utils.getElementAsFloat(
+ Utils.getElement(
+ profileInfo,
+ "banking.balance"
+ ), -1f
+ )
+ val purseBalance =
+ Utils.getElementAsFloat(
+ Utils.getElement(
+ profileInfo,
+ "coin_purse"
+ ), 0f
+ )
+ val networth = if (NotEnoughUpdates.INSTANCE.config.profileViewer.useSoopyNetworth) {
+ val nwData =
+ profile.getSoopyNetworth(null, Runnable {})
+ nwData?.total ?: -2L
+ } else {
+ profile.getNetWorth(null)
+ }
+ val money =
+ Math.max(bankBalance + purseBalance, networth.toFloat())
+ val moneyPrefix =
+ if (money > 50 * 1000 * 1000) (if (money > 200 * 1000 * 1000) GREEN else YELLOW) else RED
+ Utils.addChatMessage(
+ g + "Purse: " + moneyPrefix + Utils.shortNumberFormat(
+ purseBalance.toDouble(),
+ 0
+ ) + g + " - Bank: " +
+ (if (bankBalance == -1f) YELLOW.toString() + "N/A" else moneyPrefix.toString() +
+ if (isMe) "4.8b" else Utils.shortNumberFormat(
+ bankBalance.toDouble(),
+ 0
+ )) +
+ if (networth > 0) "$g - Net: $moneyPrefix" + Utils.shortNumberFormat(
+ networth.toDouble(),
+ 0
+ ) else ""
+ )
+ overallScore += Math.min(2f, money / (100f * 1000 * 1000))
+ val activePet =
+ Utils.getElementAsString(
+ Utils.getElement(
+ profile.getPetsInfo(
+ null
+ ), "active_pet.type"
+ ),
+ "None Active"
+ )
+ val activePetTier =
+ Utils.getElementAsString(
+ Utils.getElement(
+ profile.getPetsInfo(null),
+ "active_pet.tier"
+ ), "UNKNOWN"
+ )
+ var col = NotEnoughUpdates.petRarityToColourMap[activePetTier]
+ if (col == null) col = LIGHT_PURPLE.toString()
+ Utils.addChatMessage(
+ g + "Pet : " + col + WordUtils.capitalizeFully(
+ activePet.replace("_", " ")
+ )
+ )
+ var overall = "Skywars Main"
+ if (isMe) {
+ overall =
+ Utils.chromaString("Literally the best player to exist") // ego much
+ } else if (overallScore < 5 && bankBalance + purseBalance > 500 * 1000 * 1000) {
+ overall = GOLD.toString() + "Bill Gates"
+ } else if (overallScore > 9) {
+ overall =
+ Utils.chromaString("Didn't even think this score was possible")
+ } else if (overallScore > 8) {
+ overall =
+ Utils.chromaString("Mentally unstable")
+ } else if (overallScore > 7) {
+ overall = GOLD.toString() + "Why though 0.0"
+ } else if (overallScore > 5.5) {
+ overall = GOLD.toString() + "Bro stop playing"
+ } else if (overallScore > 4) {
+ overall = GREEN.toString() + "Kinda sweaty"
+ } else if (overallScore > 3) {
+ overall = YELLOW.toString() + "Alright I guess"
+ } else if (overallScore > 2) {
+ overall = YELLOW.toString() + "Ender Non"
+ } else if (overallScore > 1) {
+ overall = RED.toString() + "Played SkyBlock"
+ }
+ Utils.addChatMessage(
+ g + "Overall score: " + overall + g + " (" + Math.round(
+ overallScore * 10
+ ) / 10f + ")"
+ )
+ }
+ })
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onCommand(event: RegisterBrigadierCommandEvent) {
+ event.command("peek") {
+ thenArgument("player", string()) { player ->
+ suggestsList { Minecraft.getMinecraft().theWorld.playerEntities.map { it.name } }
+ thenExecute {
+ executePeek(this[player])
+ }
+ }.withHelp("Quickly glance at other peoples stats")
+ thenExecute {
+ executePeek(Minecraft.getMinecraft().thePlayer.name)
+ }
+ }.withHelp("Quickly glance at your own stats")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt
new file mode 100644
index 00000000..8a2763f7
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ProfileViewerCommands.kt
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import com.mojang.brigadier.context.CommandContext
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.client.Minecraft
+import net.minecraft.client.renderer.OpenGlHelper
+import net.minecraft.command.ICommandSender
+import net.minecraft.util.EnumChatFormatting.RED
+import net.minecraftforge.fml.common.Loader
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class ProfileViewerCommands {
+ companion object {
+ fun CommandContext<ICommandSender>.openPv(name: String) {
+ if (!OpenGlHelper.isFramebufferEnabled()) {
+ reply("${RED}Some parts of the profile viewer do not work with OptiFine Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")
+ }
+
+ if (NotEnoughUpdates.INSTANCE.config.apiData.apiKey.isNullOrBlank()) {
+ reply("${RED}Can't view profile, an API key is not set. Run /api new and put the result in settings.")
+ return
+ }
+
+ NotEnoughUpdates.profileViewer.getProfileByName(name) { profile ->
+ if (profile == null) {
+ reply("${RED}Invalid player name/API key. Maybe the API is down? Try /api new.")
+ } else {
+ profile.resetCache()
+ NotEnoughUpdates.INSTANCE.openGui = GuiProfileViewer(profile)
+ }
+ }
+ }
+ }
+
+
+ @SubscribeEvent
+ fun onCommand(event: RegisterBrigadierCommandEvent) {
+ fun pvCommand(name: String, before: () -> Unit) {
+ event.command(name) {
+ thenExecute {
+ before()
+ openPv(Minecraft.getMinecraft().thePlayer.name)
+ }
+ thenArgument("player", string()) { player ->
+ suggestsList { Minecraft.getMinecraft().theWorld.playerEntities.map { it.name } }
+ thenExecute {
+ before()
+ openPv(this[player])
+ }
+ }.withHelp("Open the profile viewer for a player")
+ }.withHelp("Open the profile viewer for yourself")
+ }
+ pvCommand("pv") {}
+ pvCommand("neuprofile") {}
+ if (!Loader.isModLoaded("skyblockextras"))
+ pvCommand("cata") {
+ GuiProfileViewer.currentPage = GuiProfileViewer.ProfileViewerPage.DUNGEON
+ }
+
+
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt
new file mode 100644
index 00000000..7a9b8d0e
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/ScreenOpenCommands.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+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.util.brigadier.thenExecute
+import io.github.moulberry.notenoughupdates.util.brigadier.withHelp
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class ScreenOpenCommands {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neubuttons") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiInvButtonEditor()
+ }
+ }.withHelp("Open the NEU inventory button editor")
+ event.command("neuec") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiEnchantColour()
+ }
+ }.withHelp("Open the NEU custom enchant colour editor")
+ event.command("neuoverlay") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = NEUOverlayPlacements()
+ }
+ }.withHelp("Open the NEU gui overlay editor")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/events/ButtonExclusionZoneEvent.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/events/ButtonExclusionZoneEvent.kt
new file mode 100644
index 00000000..3c8ce418
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/events/ButtonExclusionZoneEvent.kt
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2023 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.events
+
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent.PushDirection.*
+import io.github.moulberry.notenoughupdates.util.Rectangle
+import net.minecraft.client.gui.GuiScreen
+import java.util.*
+
+class ButtonExclusionZoneEvent(
+ val gui: GuiScreen,
+ val guiBaseRect: Rectangle,
+) : NEUEvent() {
+ enum class PushDirection {
+ TOWARDS_RIGHT,
+ TOWARDS_LEFT,
+ TOWARDS_TOP,
+ TOWARDS_BOTTOM,
+ }
+
+ data class ExclusionZone(
+ val area: Rectangle,
+ val pushDirection: PushDirection,
+ )
+
+ val occupiedRects = mutableListOf<ExclusionZone>()
+ fun blockArea(area: Rectangle, direction: PushDirection) {
+ occupiedRects.add(ExclusionZone(area, direction))
+ }
+
+ @JvmOverloads
+ fun findButtonPosition(button: Rectangle, margin: Int = 0): Rectangle {
+ val processedAreas = IdentityHashMap<ExclusionZone, Unit>()
+
+ var buttonPosition = button
+ while (true) {
+ val overlappingExclusionZone =
+ occupiedRects.find { it !in processedAreas && it.area.intersects(buttonPosition) } ?: break
+ buttonPosition = when (overlappingExclusionZone.pushDirection) {
+ TOWARDS_RIGHT -> buttonPosition.copy(x = overlappingExclusionZone.area.right + margin)
+ TOWARDS_LEFT -> buttonPosition.copy(x = overlappingExclusionZone.area.left - buttonPosition.width - margin)
+ TOWARDS_TOP -> buttonPosition.copy(y = overlappingExclusionZone.area.top - buttonPosition.height - margin)
+ TOWARDS_BOTTOM -> buttonPosition.copy(y = overlappingExclusionZone.area.bottom + margin)
+ }
+ processedAreas[overlappingExclusionZone] = Unit
+ }
+
+ return buttonPosition
+ }
+
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/events/RegisterBrigadierCommandEvent.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/events/RegisterBrigadierCommandEvent.kt
new file mode 100644
index 00000000..d3e0b69a
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/events/RegisterBrigadierCommandEvent.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2023 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.events
+
+import com.mojang.brigadier.builder.LiteralArgumentBuilder
+import io.github.moulberry.notenoughupdates.util.brigadier.BrigadierRoot
+import io.github.moulberry.notenoughupdates.util.brigadier.NEUBrigadierHook
+import io.github.moulberry.notenoughupdates.util.brigadier.literal
+import net.minecraft.command.ICommandSender
+import java.util.function.Consumer
+
+data class RegisterBrigadierCommandEvent(val brigadierRoot: BrigadierRoot) : NEUEvent() {
+ val dispatcher = brigadierRoot.dispatcher
+ val hooks = mutableListOf<NEUBrigadierHook>()
+ fun command(name: String, block: Consumer<LiteralArgumentBuilder<ICommandSender>>): NEUBrigadierHook {
+ return command(name) {
+ block.accept(this)
+ }
+ }
+
+ fun command(
+ name: String,
+ vararg aliases: String,
+ block: LiteralArgumentBuilder<ICommandSender>.() -> Unit
+ ): NEUBrigadierHook {
+ val node = dispatcher.register(literal(name, block))
+ for (alias in aliases) {
+ dispatcher.register(literal(alias) { redirect(node) })
+ }
+ val hook = NEUBrigadierHook(brigadierRoot, node, aliases.toList())
+ hooks.add(hook)
+ return hook
+ }
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/guifeatures/SkyMallDisplay.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/guifeatures/SkyMallDisplay.kt
new file mode 100644
index 00000000..2821473b
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/guifeatures/SkyMallDisplay.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.guifeatures
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.util.SBInfo
+import io.github.moulberry.notenoughupdates.util.SkyBlockTime
+import io.github.moulberry.notenoughupdates.util.Utils
+import net.minecraft.init.Items
+import net.minecraft.item.ItemStack
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.time.Duration
+import java.time.Instant
+import java.util.regex.Pattern
+
+@NEUAutoSubscribe
+class SkyMallDisplay {
+
+ private val pattern = Pattern.compile("§r§eNew buff§r§r§r: (.*)§r")
+
+ @SubscribeEvent(receiveCanceled = true)
+ fun onChatReceive(event: ClientChatReceivedEvent) {
+ if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return
+ if (SBInfo.getInstance().getLocation() != "mining_3") return
+
+ val matcher = pattern.matcher(event.message.formattedText)
+ if (!matcher.matches()) return
+
+ val message = matcher.group(1) ?: return
+ currentPerk = SkyMallPerk.values().find { it.chatMessage == message }
+
+ currentPerk?.let {
+ val manager = NotEnoughUpdates.INSTANCE.manager
+ displayItem = manager.jsonToStack(manager.itemInformation[it.displayItemId])
+ }
+ }
+
+ companion object {
+ private var displayText = ""
+ private var displayItem: ItemStack? = null
+ private var lastUpdated = 0L
+ private var currentPerk: SkyMallPerk? = null
+
+ fun getDisplayText(): String {
+ return if (lastUpdated + 1_000 > System.currentTimeMillis()) {
+ displayText
+ } else {
+ update()
+ displayText
+ }
+ }
+
+ fun getDisplayItem(): ItemStack {
+ return displayItem ?: ItemStack(Items.apple)
+ }
+
+ private fun update() {
+ val nextDayBeginning = SkyBlockTime.now()
+ .let { it.copy(day = it.day + 1, hour = 0, minute = 0, second = 0) }
+ .toInstant()
+ val untilNextDay = Duration.between(Instant.now(), nextDayBeginning)
+ displayText = (currentPerk?.displayName ?: "?") + " §a(${
+ Utils.prettyTime(untilNextDay.toMillis())
+ })"
+ lastUpdated = System.currentTimeMillis()
+ }
+ }
+
+ enum class SkyMallPerk(val displayName: String, val displayItemId: String, val chatMessage: String) {
+ PICKAXE_COOLDOWN(
+ "20% §6Pickaxe Ability cooldown", "DIAMOND_PICKAXE",
+ "§r§fReduce Pickaxe Ability cooldown by §r§a20%§r§f."
+ ),
+ MORE_POWDER("+15% more §6Powder", "MITHRIL_ORE", "§r§fGain §r§a+15% §r§fmore Powder while mining."),
+ MINING_FORTUNE("+50 §6☘ Mining Fortune", "ENCHANTED_RABBIT_FOOT", "§r§fGain §r§a+50 §r§6☘ Mining Fortune§r§f."),
+ MINING_SPEED("+100 §6⸕ Mining Speed", "ENCHANTED_FEATHER", "§r§fGain §r§a+100 §r§6⸕ Mining Speed§r§f."),
+ MORE_GOBLINS("10x §6Goblin chance", "GOBLIN_HELMET", "§r§f§r§a10x §r§fchance to find Goblins while mining."),
+ TITANIUM_DROPS("5x §9Titanium drops", "TITANIUM_ORE", "§r§fGain §r§a5x §r§9Titanium §r§fdrops"),
+
+ // In case hypixel finds some day the missing dot at the end.
+ TITANIUM_DROPS_WITH_DOT("5x §9Titanium drops", "TITANIUM_ORE", "§r§fGain §r§a5x §r§9Titanium §r§fdrops."),
+ ;
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt
new file mode 100644
index 00000000..4782ab0f
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/OldSkyBlockMenu.kt
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscfeatures
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent
+import io.github.moulberry.notenoughupdates.util.ItemUtils
+import io.github.moulberry.notenoughupdates.util.Utils
+import net.minecraft.client.player.inventory.ContainerLocalMenu
+import net.minecraft.init.Items
+import net.minecraft.item.Item
+import net.minecraft.item.ItemStack
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.text.DecimalFormat
+import java.text.DecimalFormatSymbols
+import java.util.*
+
+@NEUAutoSubscribe
+object OldSkyBlockMenu {
+ private val decimalFormat = DecimalFormat("##,##0", DecimalFormatSymbols(Locale.US))
+
+ val map: Map<Int, SkyBlockButton> by lazy {
+ val map = mutableMapOf<Int, SkyBlockButton>()
+ for (button in SkyBlockButton.values()) {
+ map[button.slot] = button
+ }
+ map
+ }
+
+ @SubscribeEvent
+ fun replaceItem(event: ReplaceItemEvent) {
+ if (!isRightInventory()) return
+ if (event.inventory !is ContainerLocalMenu) return
+
+ val skyBlockButton = map[event.slotNumber] ?: return
+ val showWarning = skyBlockButton.requiresBoosterCookie && !CookieWarning.hasActiveBoosterCookie()
+ val item = if (showWarning) skyBlockButton.itemWithCookieWarning else skyBlockButton.itemWithoutCookieWarning
+
+ if (skyBlockButton == SkyBlockButton.ACCESSORY) {
+ val magicalPower = NotEnoughUpdates.INSTANCE.config.profileSpecific?.magicalPower ?: 0
+
+ val lore = ItemUtils.getLore(item)
+ lore.add(4, "")
+ val format = decimalFormat.format(magicalPower)
+ lore.add(5, "§7Magical Power: §6$format")
+
+ val newItem = ItemStack.copyItemStack(item)
+ ItemUtils.setLore(newItem, lore)
+ event.replaceWith(newItem)
+ } else {
+ event.replaceWith(item)
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGH)
+ fun onStackClick(event: SlotClickEvent) {
+ if (!isRightInventory()) return
+
+ val skyBlockButton = map[event.slotId] ?: return
+ event.isCanceled = true
+
+ if (!skyBlockButton.requiresBoosterCookie || CookieWarning.hasActiveBoosterCookie()) {
+ NotEnoughUpdates.INSTANCE.sendChatMessage("/" + skyBlockButton.command)
+ }
+ }
+
+ private fun isRightInventory(): Boolean {
+ return NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() &&
+ NotEnoughUpdates.INSTANCE.config.misc.oldSkyBlockMenu &&
+ Utils.getOpenChestName() == "SkyBlock Menu"
+ }
+
+ enum class SkyBlockButton(
+ val command: String,
+ val slot: Int,
+ private val displayName: String,
+ private vararg val displayDescription: String,
+ private val itemData: ItemData,
+ val requiresBoosterCookie: Boolean = true,
+ ) {
+ TRADES(
+ "trades", 40,
+ "Trades",
+ "View your available trades.",
+ "These trades are always",
+ "available and accessible through",
+ "the SkyBlock Menu.",
+ itemData = NormalItemData(Items.emerald),
+ requiresBoosterCookie = false
+ ),
+ ACCESSORY(
+ "accessories", 53,
+ "Accessory Bag",
+ "A special bag which can hold",
+ "Talismans, Rings, Artifacts, Relics, and",
+ "Orbs within it. All will still",
+ "work while in this bag!",
+ itemData = SkullItemData(
+ "2b73dd76-5fc1-4ac3-8139-6a8992f8ce80",
+ "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTYxYTkxOGMw" +
+ "YzQ5YmE4ZDA1M2U1MjJjYjkxYWJjNzQ2ODkzNjdiNGQ4YWEwNmJmYzFiYTkxNTQ3MzA5ODVmZiJ9fX0="
+ )
+ ),
+ POTION(
+ "potionbag", 52,
+ "Potion Bag",
+ "A handy bag for holding your",
+ "Potions in.",
+ itemData = SkullItemData(
+ "991c4a18-3283-4629-b0fc-bbce23cd658c",
+ "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWY4Yjg" +
+ "yNDI3YjI2MGQwYTYxZTY0ODNmYzNiMmMzNWE1ODU4NTFlMDhhOWE5ZGYzNzI1NDhiNDE2OGNjODE3YyJ9fX0="
+ )
+ ),
+ QUIVER(
+ "quiver", 44,
+ "Quiver",
+ "A masterfully crafted Quiver",
+ "which holds any kind of",
+ "projectile you can think of!",
+ itemData = SkullItemData(
+ "41758912-e6b1-4700-9de5-04f2cfb9c422",
+ "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGNiM2FjZ" +
+ "GMxMWNhNzQ3YmY3MTBlNTlmNGM4ZTliM2Q5NDlmZGQzNjRjNjg2OTgzMWNhODc4ZjA3NjNkMTc4NyJ9fX0="
+ )
+ ),
+ FISHING(
+ "fishingbag", 43,
+ "Fishing Bag",
+ "A useful bag which can hold all",
+ "types of fish, baits, and fishing",
+ "loot!",
+ itemData = SkullItemData(
+ "508c01d6-eabe-430b-9811-874691ee7ee4",
+ "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWI4ZT" +
+ "I5N2RmNmI4ZGZmY2YxMzVkYmE4NGVjNzkyZDQyMGFkOGVjYjQ1OGQxNDQyODg1NzJhODQ2MDNiMTYzMSJ9fX0="
+ )
+ ),
+ SACK_OF_SACKS(
+ "sacks", 35,
+ "Sack of Sacks",
+ "A sack which contains other",
+ "sacks. Sackception!",
+ itemData = SkullItemData(
+ "a206a7eb-70fc-4f9f-8316-c3f69d6ba2ca",
+ "ewogICJ0aW1lc3RhbXAiIDogMTU5MTMxMDU4NTYwOSwKICAicHJvZmlsZUlkIiA6ICI0MWQzYWJjMmQ3NDk0MDBjOTA5MGQ1NDM0" +
+ "ZDAzODMxYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJNZWdha2xvb24iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVl" +
+ "LAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5l" +
+ "Y3JhZnQubmV0L3RleHR1cmUvODBhMDc3ZTI0OGQxNDI3NzJlYTgwMDg2NGY4YzU3OGI5ZDM2ODg1YjI5ZGFmODM2YjY0" +
+ "YTcwNjg4MmI2ZWMxMCIKICAgIH0KICB9Cn0="
+ ),
+ requiresBoosterCookie = false
+ ),
+ ;
+
+ val itemWithCookieWarning: ItemStack by lazy { createItem(true) }
+ val itemWithoutCookieWarning: ItemStack by lazy { createItem(false) }
+
+ private fun createItem(showCookieWarning: Boolean): ItemStack {
+ val lore = mutableListOf<String>()
+ for (line in displayDescription) {
+ lore.add("§7$line")
+ }
+ lore.add("")
+
+ if (showCookieWarning) {
+ lore.add("§cYou need a booster cookie active")
+ lore.add("§cto use this shortcut!")
+ } else {
+ lore.add("§eClick to execute /${command}")
+ }
+ val array = lore.toTypedArray()
+ val name = "§a${displayName}"
+ return when (itemData) {
+ is NormalItemData -> Utils.createItemStackArray(itemData.displayIcon, name, array)
+ is SkullItemData -> Utils.createSkull(
+ name,
+ itemData.uuid,
+ itemData.value,
+ array
+ )
+ }
+ }
+ }
+
+ sealed interface ItemData
+
+ class NormalItemData(val displayIcon: Item) : ItemData
+
+ class SkullItemData(val uuid: String, val value: String) : ItemData
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumCheapestItemOverlay.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumCheapestItemOverlay.kt
new file mode 100644
index 00000000..8a711230
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumCheapestItemOverlay.kt
@@ -0,0 +1,574 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscfeatures.inventory
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.core.util.ArrowPagesUtils
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils
+import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent
+import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer
+import io.github.moulberry.notenoughupdates.options.seperateSections.Museum
+import io.github.moulberry.notenoughupdates.util.*
+import io.github.moulberry.notenoughupdates.util.MuseumUtil.DonationState.MISSING
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.GuiScreen
+import net.minecraft.client.gui.ScaledResolution
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraft.client.renderer.RenderHelper
+import net.minecraft.init.Blocks
+import net.minecraft.init.Items
+import net.minecraft.inventory.Slot
+import net.minecraft.item.ItemStack
+import net.minecraft.util.EnumChatFormatting
+import net.minecraft.util.ResourceLocation
+import net.minecraftforge.client.event.GuiScreenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import org.lwjgl.input.Mouse
+import org.lwjgl.opengl.GL11
+import kotlin.math.ceil
+
+
+object MuseumCheapestItemOverlay {
+
+ enum class Category {
+ WEAPONS,
+ ARMOUR_SETS,
+ RARITIES,
+ NOT_APPLICABLE; // Either not a valid category or inside the "Special Items" category, which is not useful;
+
+ /**
+ * Convert to readable String to be displayed to the user
+ */
+ override fun toString(): String {
+ return when (this) {
+ WEAPONS -> "Weapons"
+ ARMOUR_SETS -> "Armour Sets"
+ RARITIES -> "Rarities"
+ NOT_APPLICABLE -> "Everything"
+ }
+ }
+ }
+
+ data class MuseumItem(
+ var name: String,
+ var internalNames: List<String>,
+ var value: Double,
+ var priceRefreshedAt: Long,
+ var category: Category
+ )
+
+ private const val ITEMS_PER_PAGE = 10
+
+ private val backgroundResource: ResourceLocation = ResourceLocation("notenoughupdates:minion_overlay.png")
+
+ val config: Museum get() = NotEnoughUpdates.INSTANCE.config.museum
+
+ /**
+ * The top left position of the arrows to be drawn, used by [ArrowPagesUtils]
+ */
+ private var topLeft = intArrayOf(237, 110)
+ private var currentPage: Int = 0
+ private var previousSlots: List<Slot> = emptyList()
+ private var itemsToDonate: MutableList<MuseumItem> = emptyList<MuseumItem>().toMutableList()
+ private var leftButtonRect = Rectangle(0, 0, 0, 0)
+ private var rightButtonRect = Rectangle(0, 0, 0, 0)
+ private var selectedCategory = Category.NOT_APPLICABLE
+ private var totalPages = 0
+
+ /**
+ *category -> was the highest page visited?
+ */
+ private var checkedPages: HashMap<Category, Boolean> = hashMapOf(
+ //this page only shows items when you have already donated them -> there is no useful information to gather
+ Category.WEAPONS to false,
+ Category.ARMOUR_SETS to false,
+ Category.RARITIES to false
+ )
+
+ /**
+ * Draw the overlay and parse items, if applicable
+ */
+ @SubscribeEvent
+ fun onDrawBackground(event: GuiScreenEvent.BackgroundDrawnEvent) {
+ if (!shouldRender(event.gui)) return
+ val chest = event.gui as GuiChest
+
+ val slots = chest.inventorySlots.inventorySlots
+ //check if there is any info to gather only when a category is currently open
+ if (!slots.equals(previousSlots) && Utils.getOpenChestName().startsWith("Museum ➜")) {
+ checkIfHighestPageWasVisited(slots)
+ parseItems(slots)
+ updateOutdatedValues()
+ }
+ previousSlots = slots
+
+ val xSize = (event.gui as AccessorGuiContainer).xSize
+ val guiLeft = (event.gui as AccessorGuiContainer).guiLeft
+ val guiTop = (event.gui as AccessorGuiContainer).guiTop
+
+ drawBackground(guiLeft, xSize, guiTop)
+ drawLines(guiLeft, guiTop)
+ drawButtons(guiLeft, xSize, guiTop)
+ }
+
+ /**
+ * Pass on mouse clicks to [ArrowPagesUtils], if applicable
+ */
+ @SubscribeEvent
+ fun onMouseClick(event: GuiScreenEvent.MouseInputEvent.Pre) {
+ if (!shouldRender(event.gui)) return
+ if (!Mouse.getEventButtonState()) return
+ val guiLeft = (event.gui as AccessorGuiContainer).guiLeft
+ val guiTop = (event.gui as AccessorGuiContainer).guiTop
+ ArrowPagesUtils.onPageSwitchMouse(
+ guiLeft, guiTop, topLeft, currentPage, totalPages
+ ) { pageChange: Int -> currentPage = pageChange }
+ }
+
+ @SubscribeEvent
+ fun onButtonExclusionZones(event: ButtonExclusionZoneEvent) {
+ if (shouldRender(event.gui)) {
+ event.blockArea(
+ Rectangle(
+ event.guiBaseRect.right,
+ event.guiBaseRect.top,
+ 175, 130
+ ), ButtonExclusionZoneEvent.PushDirection.TOWARDS_RIGHT
+ )
+ }
+ }
+
+ @SubscribeEvent
+ fun onMouseInput(event: GuiScreenEvent.MouseInputEvent.Pre) {
+ if (!shouldRender(event.gui)) return
+ val mouseX = Utils.getMouseX()
+ val mouseY = Utils.getMouseY()
+ if (Mouse.getEventButtonState() && leftButtonRect.contains(mouseX, mouseY)) {
+ config.museumCheapestItemOverlayValueSource = 1 - config.museumCheapestItemOverlayValueSource
+ updateAllValues()
+ } else if (Mouse.getEventButtonState() && rightButtonRect.contains(mouseX, mouseY)) {
+ advanceSelectedCategory()
+ }
+ }
+
+ /**
+ * Move the selected category one index forward, or back to the start when already at the end
+ */
+ private fun advanceSelectedCategory() {
+ val nextValueIndex = (selectedCategory.ordinal + 1) % 4
+ selectedCategory = enumValues<Category>()[nextValueIndex]
+ }
+
+ /**
+ * Draw the two clickable buttons on the bottom right and display a tooltip if needed
+ */
+ private fun drawButtons(guiLeft: Int, xSize: Int, guiTop: Int) {
+ RenderHelper.enableGUIStandardItemLighting()
+ val useBIN = config.museumCheapestItemOverlayValueSource == 0
+ val mouseX = Utils.getMouseX()
+ val mouseY = Utils.getMouseY()
+ val scaledResolution = ScaledResolution(Minecraft.getMinecraft())
+ val width = scaledResolution.scaledWidth
+ val height = scaledResolution.scaledHeight
+
+ // Left button
+ val leftItemStack = if (useBIN) {
+ ItemUtils.getCoinItemStack(100000.0)
+ } else {
+ ItemStack(Blocks.crafting_table)
+ }
+ leftButtonRect = Rectangle(
+ guiLeft + xSize + 131,
+ guiTop + 106,
+ 16,
+ 16
+ )
+ Minecraft.getMinecraft().renderItem.renderItemIntoGUI(
+ leftItemStack,
+ leftButtonRect.x,
+ leftButtonRect.y
+ )
+
+ if (leftButtonRect.contains(mouseX, mouseY)) {
+ val tooltip = if (useBIN) {
+ listOf(
+ "${EnumChatFormatting.GREEN}Using ${EnumChatFormatting.BLUE}lowest BIN ${EnumChatFormatting.GREEN}as price source!",
+ "",
+ "${EnumChatFormatting.YELLOW}Click to switch to craft cost!"
+ )
+ } else {
+ listOf(
+ "${EnumChatFormatting.GREEN}Using ${EnumChatFormatting.AQUA}craft cost ${EnumChatFormatting.GREEN}as price source!",
+ "",
+ "${EnumChatFormatting.YELLOW}Click to switch to lowest BIN!"
+ )
+ }
+ Utils.drawHoveringText(
+ tooltip,
+ mouseX,
+ mouseY,
+ width,
+ height,
+ -1,
+ Minecraft.getMinecraft().fontRendererObj
+ )
+ }
+
+ // Right button
+ val rightItemStack = when (selectedCategory) {
+ Category.WEAPONS -> ItemStack(Items.diamond_sword)
+ Category.ARMOUR_SETS -> ItemStack(Items.diamond_chestplate)
+ Category.RARITIES -> ItemStack(Items.emerald)
+ Category.NOT_APPLICABLE -> ItemStack(Items.filled_map)
+ }
+ rightButtonRect = Rectangle(
+ guiLeft + xSize + 150,
+ guiTop + 106,
+ 16,
+ 16
+ )
+ Minecraft.getMinecraft().renderItem.renderItemIntoGUI(
+ rightItemStack,
+ rightButtonRect.x,
+ rightButtonRect.y
+ )
+ if (rightButtonRect.contains(mouseX, mouseY)) {
+ val tooltip = mutableListOf(
+ "${EnumChatFormatting.GREEN}Category Filter",
+ "",
+ )
+ for (category in Category.values()) {
+ tooltip.add(
+ if (category == selectedCategory) {
+ "${EnumChatFormatting.BLUE}>$category"
+ } else {
+ category.toString()
+ }
+ )
+ }
+
+ tooltip.add("")
+ tooltip.add("${EnumChatFormatting.YELLOW}Click to advance!")
+ Utils.drawHoveringText(
+ tooltip,
+ mouseX,
+ mouseY,
+ width,
+ height,
+ -1,
+ Minecraft.getMinecraft().fontRendererObj
+ )
+ }
+ RenderHelper.disableStandardItemLighting()
+ }
+
+ /**
+ * Sort the collected items by their calculated value
+ */
+ private fun sortByValue() {
+ itemsToDonate.sortBy { it.value }
+ }
+
+ /**
+ * Update all values that have not been updated for the last minute
+ */
+ private fun updateOutdatedValues() {
+ val time = System.currentTimeMillis()
+ itemsToDonate.filter { time - it.priceRefreshedAt >= 60000 }
+ .forEach {
+ it.value = calculateValue(it.internalNames)
+ it.priceRefreshedAt = time
+ }
+ }
+
+ /**
+ * Update all values regardless of the time of the last update
+ */
+ private fun updateAllValues() {
+ val time = System.currentTimeMillis()
+ itemsToDonate.forEach {
+ it.value = calculateValue(it.internalNames)
+ it.priceRefreshedAt = time
+ }
+ sortByValue()
+ }
+
+ /**
+ * Calculate the value of an item as displayed in the museum, which may consist of multiple pieces
+ */
+ private fun calculateValue(internalNames: List<String>): Double {
+ var totalValue = 0.0
+ internalNames.forEach {
+ val itemValue: Double =
+ when (config.museumCheapestItemOverlayValueSource) {
+ 0 -> NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarOrBin(it, false)
+ 1 -> NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(it)?.craftCost ?: return@forEach
+ else -> -1.0 //unreachable
+ }
+ if (itemValue == -1.0 || itemValue == 0.0) {
+ totalValue = Double.MAX_VALUE
+ return@forEach
+ } else {
+ totalValue += itemValue
+ }
+ }
+ if (totalValue == 0.0) {
+ totalValue = Double.MAX_VALUE
+ }
+
+ return totalValue
+ }
+
+ /**
+ * Draw the lines containing the displayname and value over the background
+ */
+ private fun drawLines(guiLeft: Int, guiTop: Int) {
+ val mouseX = Utils.getMouseX()
+ val mouseY = Utils.getMouseY()
+ val scaledResolution = ScaledResolution(Minecraft.getMinecraft())
+ val width = scaledResolution.scaledWidth
+ val height = scaledResolution.scaledHeight
+
+ val applicableItems = if (selectedCategory == Category.NOT_APPLICABLE) {
+ itemsToDonate
+ } else {
+ itemsToDonate.toList().filter { it.category == selectedCategory }
+ }
+ val lines = buildLines(applicableItems)
+ totalPages = ceil(applicableItems.size.toFloat() / ITEMS_PER_PAGE.toFloat()).toInt()
+
+ lines.forEachIndexed { index, line ->
+ if (!visitedAllPages() && (index == ITEMS_PER_PAGE || index == lines.size - 1)) {
+ TextRenderUtils.drawStringScaledMaxWidth(
+ "${EnumChatFormatting.RED}Visit all pages for accurate info!",
+ Minecraft.getMinecraft().fontRendererObj,
+ (guiLeft + 185).toFloat(),
+ (guiTop + 95).toFloat(),
+ true,
+ 155,
+ 0
+ )
+ return@forEachIndexed
+ } else {
+ val x = (guiLeft + 187).toFloat()
+ val y = (guiTop + 5 + (index * 10)).toFloat()
+ Utils.renderAlignedString(
+ line.name,
+ if (line.value == Double.MAX_VALUE) "${EnumChatFormatting.RED}Unknown ${if (config.museumCheapestItemOverlayValueSource == 0) "BIN" else "Craft Cost"}" else "${EnumChatFormatting.AQUA}${
+ Utils.shortNumberFormat(
+ line.value,
+ 0
+ )
+ }",
+ x,
+ y,
+ 156
+ )
+
+ if (Utils.isWithinRect(mouseX, mouseY, x.toInt(), y.toInt(), 170, 10)) {
+ val tooltip = mutableListOf(line.name, "")
+ //armor set
+ if (line.internalNames.size > 1) {
+ tooltip.add("${EnumChatFormatting.AQUA}Consists of:")
+ line.internalNames.forEach {
+ val displayname =
+ NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withKnownInternalName(it)
+ .resolveToItemListJson()
+ ?.get("displayname")?.asString ?: "ERROR"
+ val value = calculateValue(listOf(it))
+
+ // Creates:" - displayname (price)" OR " - displayname (No BIN found!)"
+ tooltip.add(
+ " ${EnumChatFormatting.DARK_GRAY}-${EnumChatFormatting.RESET} $displayname${EnumChatFormatting.DARK_GRAY} (${EnumChatFormatting.GOLD}${
+ if (value == Double.MAX_VALUE) {
+ "${EnumChatFormatting.RED}No BIN found!"
+ } else {
+ Utils.shortNumberFormat(
+ value,
+ 0
+ )
+ }
+ }${EnumChatFormatting.DARK_GRAY})"
+ )
+ }
+ tooltip.add("")
+ }
+
+ if (NotEnoughUpdates.INSTANCE.manager.getRecipesFor(line.internalNames[0]).isNotEmpty()) {
+ tooltip.add("${EnumChatFormatting.YELLOW}${EnumChatFormatting.BOLD}Click to open recipe!")
+ } else {
+ tooltip.add("${EnumChatFormatting.RED}${EnumChatFormatting.BOLD}No recipe available!")
+ }
+
+ if (Mouse.getEventButtonState()) {
+ //TODO? this only opens the recipe for one of the armor pieces
+ NotEnoughUpdates.INSTANCE.manager.showRecipe(line.internalNames[0])
+ }
+
+ Utils.drawHoveringText(
+ tooltip,
+ mouseX,
+ mouseY,
+ width,
+ height,
+ -1,
+ Minecraft.getMinecraft().fontRendererObj
+ )
+ }
+ }
+ }
+
+ //no page has been visited yet
+ if (lines.isEmpty()) {
+ TextRenderUtils.drawStringScaledMaxWidth(
+ "${EnumChatFormatting.RED}No items matching filter!",
+ Minecraft.getMinecraft().fontRendererObj,
+ (guiLeft + 200).toFloat(),
+ (guiTop + 128 / 2).toFloat(),
+ true,
+ 155,
+ 0
+ )
+ }
+
+ ArrowPagesUtils.onDraw(guiLeft, guiTop, topLeft, currentPage, totalPages)
+ return
+ }
+
+ /**
+ * Create the list of [MuseumItem]s that should be displayed on the current page
+ */
+ private fun buildLines(applicableItems: List<MuseumItem>): List<MuseumItem> {
+ val list = emptyList<MuseumItem>().toMutableList()
+
+ for (i in (ITEMS_PER_PAGE * currentPage) until ((ITEMS_PER_PAGE * currentPage) + ITEMS_PER_PAGE)) {
+ if (i >= applicableItems.size) {
+ break
+ }
+
+ list.add(applicableItems[i])
+ }
+ return list
+ }
+
+ /**
+ * Parse the not already donated items present in the currently open Museum page
+ */
+ private fun parseItems(slots: List<Slot>) {
+ Thread {
+ val time = System.currentTimeMillis()
+ val category = getCategory()
+ if (category == Category.NOT_APPLICABLE) {
+ return@Thread
+ }
+ val armor = category == Category.ARMOUR_SETS
+ for (i in 0..53) {
+ val stack = slots[i].stack ?: continue
+ val parsedItems = MuseumUtil.findMuseumItem(stack, armor) ?: continue
+ when (parsedItems.state) {
+ MISSING -> {
+ val displayName = if (armor) {
+ // Use the provided displayname for armor sets but change the color to blue (from red)
+ "${EnumChatFormatting.BLUE}${stack.displayName.stripControlCodes()}"
+ } else {
+ // Find out the real displayname and use it for normal items, if possible
+ NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery()
+ .withKnownInternalName(parsedItems.skyblockItemIds.first())
+ .resolveToItemListJson()
+ ?.get("displayname")?.asString ?: "${EnumChatFormatting.RED}ERROR"
+ }
+
+ //if the list does not already contain it, insert this MuseumItem
+ if (itemsToDonate.none { it.internalNames == parsedItems.skyblockItemIds }) {
+ itemsToDonate.add(
+ MuseumItem(
+ displayName,
+ parsedItems.skyblockItemIds,
+ calculateValue(parsedItems.skyblockItemIds),
+ time,
+ category
+ )
+ )
+ }
+ }
+
+ else -> itemsToDonate.retainAll { it.internalNames != parsedItems.skyblockItemIds }
+ }
+ }
+ sortByValue()
+ }.start()
+ }
+
+ /**
+ * Check if the highest page for the current category is currently open and update [checkedPages] accordingly
+ */
+ private fun checkIfHighestPageWasVisited(slots: List<Slot>) {
+ val category = getCategory()
+ val nextPageSlot = slots[53]
+ // If the "Next Page" arrow is missing, we are at the highest page
+ if ((nextPageSlot.stack ?: return).item != Items.arrow) {
+ checkedPages[category] = true
+ }
+ }
+
+ /**
+ * Draw the background texture to the right side of the open Museum Page
+ */
+ private fun drawBackground(guiLeft: Int, xSize: Int, guiTop: Int) {
+ Minecraft.getMinecraft().textureManager.bindTexture(backgroundResource)
+ GL11.glColor4f(1F, 1F, 1F, 1F)
+ GlStateManager.disableLighting()
+ Utils.drawTexturedRect(
+ (guiLeft + xSize + 4).toFloat(),
+ guiTop.toFloat(),
+ 168f,
+ 128f,
+ 0f,
+ 1f,
+ 0f,
+ 1f,
+ GL11.GL_NEAREST
+ )
+ }
+
+ /**
+ * Determine if the overlay should be active based on the config option and the currently open GuiChest, if applicable
+ */
+ private fun shouldRender(gui: GuiScreen): Boolean =
+ config.museumCheapestItemOverlay && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && (gui is GuiChest && Utils.getOpenChestName()
+ .startsWith("Museum ➜") || Utils.getOpenChestName() == "Your Museum")
+
+ /**
+ * Determine the currently open Museum Category
+ */
+ private fun getCategory(): Category =
+ when (Utils.getOpenChestName().substring(9, Utils.getOpenChestName().length)) {
+ "Weapons" -> Category.WEAPONS
+ "Armor Sets" -> Category.ARMOUR_SETS
+ "Rarities" -> Category.RARITIES
+ else -> Category.NOT_APPLICABLE
+ }
+
+ /**
+ * Determine if all useful pages have been visited
+ */
+ private fun visitedAllPages(): Boolean = !checkedPages.containsValue(false)
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumItemHighlighter.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumItemHighlighter.kt
new file mode 100644
index 00000000..945449ba
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumItemHighlighter.kt
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2022 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscfeatures.inventory
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.core.ChromaColour
+import io.github.moulberry.notenoughupdates.core.util.StringUtils
+import io.github.moulberry.notenoughupdates.events.GuiContainerBackgroundDrawnEvent
+import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent
+import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent
+import io.github.moulberry.notenoughupdates.util.ItemResolutionQuery
+import io.github.moulberry.notenoughupdates.util.ItemUtils
+import io.github.moulberry.notenoughupdates.util.LRUCache
+import io.github.moulberry.notenoughupdates.util.MuseumUtil
+import net.minecraft.client.gui.Gui
+import net.minecraft.init.Items
+import net.minecraft.inventory.ContainerChest
+import net.minecraft.inventory.IInventory
+import net.minecraft.item.EnumDyeColor
+import net.minecraft.item.ItemStack
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+object MuseumItemHighlighter {
+
+ private val manager get() = NotEnoughUpdates.INSTANCE.manager
+ private val config get() = NotEnoughUpdates.INSTANCE.config.museum
+
+ private fun getHighlightColor() = ChromaColour.specialToChromaRGB(config.museumItemColor)
+
+
+ private val findRawItemForName = LRUCache.memoize(::findRawItemForName0, 4 * 7 * 2)
+
+ @SubscribeEvent
+ fun onRepositoryReload(event: RepositoryReloadEvent) {
+ findRawItemForName.clearCache()
+ }
+
+ private fun findRawItemForName0(arg: Pair<String, Boolean>): ItemStack? {
+ val (name, armor) = arg
+ return MuseumUtil.findItemsByName(name, armor).firstOrNull()?.let { manager.createItem(it) }
+ }
+
+
+ @SubscribeEvent
+ fun onItemOverride(event: ReplaceItemEvent) {
+ if (!config.museumItemShow) return
+ if (!isMuseumInventory(event.inventory)) return
+ val original = event.original ?: return
+ if (!isCompletedRetrievedItem(original)) return
+ val armor = StringUtils.cleanColour(event.inventory.displayName.unformattedText).endsWith("Armor Sets")
+ val rawItem = findRawItemForName.apply(original.displayName to armor) ?: return
+ val hydratedItem = hydrateMuseumItem(rawItem, original)
+ event.replaceWith(hydratedItem)
+ }
+
+ fun isCompletedRetrievedItem(itemStack: ItemStack): Boolean {
+ return itemStack.hasDisplayName() && itemStack.item == Items.dye && EnumDyeColor.byDyeDamage(itemStack.itemDamage) == EnumDyeColor.LIME
+ }
+
+ fun isMuseumInventory(inventory: IInventory): Boolean {
+ return StringUtils.cleanColour(inventory.displayName.unformattedText).startsWith("Museum ➜")
+ }
+
+ @SubscribeEvent
+ fun onBackgroundDrawn(event: GuiContainerBackgroundDrawnEvent) {
+ val egui = event.container ?: return
+ val chest = egui.inventorySlots as? ContainerChest ?: return
+ if (!config.museumItemShow) return
+ if (!isMuseumInventory(chest.lowerChestInventory)) return
+ val fixedHighlightColor = getHighlightColor()
+ for (slot in chest.inventorySlots) {
+ if (slot == null || slot.stack == null) continue
+ if (isHydratedMuseumItem(slot.stack) || isCompletedRetrievedItem(slot.stack)) {
+ val left = slot.xDisplayPosition
+ val top = slot.yDisplayPosition
+ Gui.drawRect(
+ left, top,
+ left + 16, top + 16,
+ fixedHighlightColor
+ )
+ }
+ }
+ }
+
+ fun hydrateMuseumItem(rawItem: ItemStack, original: ItemStack) = rawItem.copy().apply {
+ setStackDisplayName(original.displayName)
+ val originalLore = ItemUtils.getLore(original).toMutableList()
+ ItemUtils.setLore(this, originalLore)
+ val data = ItemUtils.getOrCreateTag(this)
+ val extraAttributes = data.getCompoundTag("ExtraAttributes")
+ extraAttributes.setByte("donated_museum", 1)
+ data.setTag("ExtraAttributes", extraAttributes)
+ data.setBoolean(MUSEUM_HYDRATED_ITEM_TAG, true)
+ }
+
+ fun isHydratedMuseumItem(stack: ItemStack): Boolean {
+ return ItemUtils.getOrCreateTag(stack).getBoolean(MUSEUM_HYDRATED_ITEM_TAG)
+ }
+
+ const val MUSEUM_HYDRATED_ITEM_TAG = "NEU_HYDRATED_MUSEUM_ITEM"
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/DynamicLightItemsEditor.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/DynamicLightItemsEditor.kt
new file mode 100644
index 00000000..7cebadcb
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscgui/DynamicLightItemsEditor.kt
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscgui
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.util.Utils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.GuiScreen
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraft.item.ItemStack
+import net.minecraft.util.ResourceLocation
+import net.minecraftforge.fml.common.registry.GameRegistry
+import org.lwjgl.opengl.GL11
+import java.awt.Color
+import kotlin.math.ceil
+
+class DynamicLightItemsEditor() : GuiScreen() {
+
+ val background = ResourceLocation("notenoughupdates:dynamic_light_items_editor.png")
+ val enabledButton = ResourceLocation("notenoughupdates:enabled_button.png")
+ val disabledButton = ResourceLocation("notenoughupdates:disabled_button.png")
+ val chestGui = ResourceLocation("textures/gui/container/generic_54.png")
+ val widgets = ResourceLocation("textures/gui/widgets.png")
+ val help = ResourceLocation("notenoughupdates:help.png")
+
+ var xSize = 217
+ var ySize = 88
+ var guiLeft = 0
+ var guiTop = 0
+
+ var stackToRender: String? = null
+ var itemSelected: String? = null
+
+ override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
+ drawDefaultBackground()
+
+ val numOfItems = NotEnoughUpdates.INSTANCE.config.hidden.dynamicLightItems.size
+ val numOfRows = if (didApplyMixin) ceil(numOfItems / 9f).toInt() else 0
+ ySize = 70 + 18 * numOfRows
+ guiLeft = (width - xSize) / 2
+ guiTop = (height - ySize) / 2
+
+ // Top and bottom half of gui
+ Minecraft.getMinecraft().textureManager.bindTexture(background)
+ Utils.drawTexturedRect(guiLeft.toFloat(), guiTop.toFloat(), xSize.toFloat(), 24F,
+ 0F, 1F, 0F, 24 / 88f, GL11.GL_NEAREST)
+ Utils.drawTexturedRect(guiLeft.toFloat(), (guiTop + ySize - 46).toFloat(), xSize.toFloat(), 46F,
+ 0F, 1F, 42 / 88f, 1F, GL11.GL_NEAREST)
+
+ fontRendererObj.drawString("Dynamic Light Items Editor", guiLeft + 10, guiTop + 7, 4210752)
+
+ GlStateManager.color(1f, 1f, 1f, 1f)
+ Minecraft.getMinecraft().textureManager.bindTexture(help)
+ Utils.drawTexturedRect((guiLeft + xSize + 3).toFloat(), guiTop.toFloat(), 16F, 16F, GL11.GL_NEAREST)
+ if (mouseX >= guiLeft + xSize + 3 &&
+ mouseX <= guiLeft + xSize + 19 &&
+ mouseY >= guiTop &&
+ mouseY <= guiTop + 16) {
+ val tooltip = listOf(
+ "§bDynamic Light Item Editor",
+ "§eWhat is this?",
+ "§eNEU makes use of OptiFine's feature of certain items",
+ "§eemitting dynamic light. By default OptiFine only implements",
+ "§ethis feature for a select few minecraft items.",
+ "",
+ "§eThis editor however, allows you to add specific skyblock",
+ "§eitems that will emit dynamic light when held. Simply hold the",
+ "§eitem you wish to add, then open this menu again and click",
+ "§e'Add Held Item', now if you have OptiFine installed and the",
+ "§edynamic lights option enabled, the added items will emit light!",
+ "",
+ "§eTo remove an item, click the item in this menu and click",
+ "§ethe 'Remove Item' button in the bottom right.",
+ )
+ Utils.drawHoveringText(tooltip, mouseX, mouseY, width, height, -1)
+ }
+
+ if (!didApplyMixin) {
+ fontRendererObj.drawString("Could not find OptiFine!", guiLeft + 50, guiTop + 22, Color.RED.rgb)
+ fontRendererObj.drawString("Go to #neu-support in", guiLeft + 50, guiTop + 32, Color.RED.rgb)
+ fontRendererObj.drawString("the discord for help", guiLeft + 52, guiTop + 42, Color.RED.rgb)
+ return
+ }
+
+ // Buttons
+ GlStateManager.color(1f, 1f, 1f, 1f)
+ Minecraft.getMinecraft().textureManager.bindTexture(enabledButton)
+ Utils.drawTexturedRect(guiLeft.toFloat() + 15, (guiTop + ySize - 32).toFloat(), 88F, 20F,
+ 0F, 1F, 0F, 1F, GL11.GL_NEAREST)
+
+ if (itemSelected != null) {
+ Minecraft.getMinecraft().textureManager.bindTexture(enabledButton)
+ } else {
+ Minecraft.getMinecraft().textureManager.bindTexture(disabledButton)
+ }
+ Utils.drawTexturedRect(guiLeft.toFloat() + 114, (guiTop + ySize - 32).toFloat(), 88F, 20F,
+ 0F, 1F, 0F, 1F, GL11.GL_NEAREST)
+
+ fontRendererObj.drawString("Add Held Item", guiLeft + 27, guiTop + ySize - 26, 4210752)
+ fontRendererObj.drawString("Remove Item", guiLeft + 130, guiTop + ySize - 26, 4210752)
+
+ GlStateManager.color(1f, 1f, 1f, 1f)
+
+ // Add in some part of the gui for every row
+ Minecraft.getMinecraft().textureManager.bindTexture(background)
+ for (i in 0 until numOfRows) {
+ Utils.drawTexturedRect(guiLeft.toFloat(), ((guiTop + 24) + (i * 18)).toFloat(), xSize.toFloat(), 18f,
+ 0f, 1f, 24 / 88f, 42 / 88f, GL11.GL_NEAREST)
+ }
+
+ var hoveredItem: String? = null
+ var selectedPosition: Pair<Int, Int> = Pair(-999, -999)
+
+ // Draw a slot for each item and the ItemStack
+ for ((index, item) in NotEnoughUpdates.INSTANCE.config.hidden.dynamicLightItems.withIndex()) {
+ val i = index % 9
+ val j = index / 9
+ GlStateManager.color(1f, 1f, 1f, 1f)
+
+ Minecraft.getMinecraft().textureManager.bindTexture(chestGui)
+ drawTexturedModalRect(guiLeft + 27 + i % 9 * 18, guiTop + 24 + j * 18, 7, 17, 18, 18)
+
+ val itemStack = resolveItemStack(item) ?: return
+ Utils.drawItemStack(itemStack, guiLeft + 28 + i % 9 * 18, guiTop + 25 + j * 18)
+
+ if (mouseX >= guiLeft + 27 + i % 9 * 18 && mouseX <= guiLeft + 45 + i % 9 * 18) {
+ if (mouseY >= guiTop + 24 + j * 18 && mouseY <= guiTop + 42 + j * 18) {
+ hoveredItem = item
+ val tooltip = itemStack.getTooltip(Minecraft.getMinecraft().thePlayer, false)
+ Utils.drawHoveringText(tooltip, mouseX, mouseY, width, height, -1)
+ }
+ }
+
+ if (itemSelected != null && itemSelected.equals(item)) {
+ // Save the position, so when we render the selected box its renders on top of everything
+ selectedPosition = Pair(guiLeft + 24 + i % 9 * 18, guiTop + 21 + j * 18)
+ }
+ }
+
+ stackToRender = hoveredItem
+
+ GlStateManager.color(1f, 1f, 1f, 1f)
+ Minecraft.getMinecraft().textureManager.bindTexture(widgets)
+ drawTexturedModalRect(selectedPosition.first, selectedPosition.second, 0, 22, 24, 24)
+
+ super.drawScreen(mouseX, mouseY, partialTicks)
+ }
+
+ override fun mouseClicked(mouseX: Int, mouseY: Int, mouseButton: Int) {
+ if (didApplyMixin) {
+ // Add Held Item button
+ if (mouseX >= guiLeft + 15 &&
+ mouseX <= guiLeft + 103 &&
+ mouseY >= (guiTop + ySize - 32) &&
+ mouseY <= (guiTop + ySize - 12)) {
+
+ val heldItem = Minecraft.getMinecraft().thePlayer.heldItem
+
+ if (heldItem == null) {
+ Utils.addChatMessage("§c[NEU] You can't add your hand to the list of dynamic light items.")
+ return
+ }
+
+ val internalName = resolveInternalName(heldItem)
+ if (internalName == null) {
+ Utils.addChatMessage("§c[NEU] Couldn't resolve an internal name for this item!")
+ return
+ }
+ NotEnoughUpdates.INSTANCE.config.hidden.dynamicLightItems.add(internalName)
+ }
+
+ // Remove Item button
+ if (mouseX >= guiLeft + 114 &&
+ mouseX <= guiLeft + 202 &&
+ mouseY >= guiTop + ySize - 32 &&
+ mouseY <= guiTop + ySize - 12 &&
+ itemSelected != null) {
+ NotEnoughUpdates.INSTANCE.config.hidden.dynamicLightItems.remove(itemSelected)
+ itemSelected = null
+ }
+
+ if (stackToRender != null) {
+ itemSelected = stackToRender
+ }
+ }
+
+ super.mouseClicked(mouseX, mouseY, mouseButton)
+ }
+
+ companion object {
+ @JvmStatic
+ var didApplyMixin = false
+
+ fun resolveItemStack(internalName: String): ItemStack? {
+ var itemStack = NotEnoughUpdates.INSTANCE.manager
+ .createItemResolutionQuery()
+ .withKnownInternalName(internalName)
+ .resolveToItemStack()
+ if (itemStack == null) {
+ // Try resolve the item stack through forge
+ itemStack = GameRegistry.makeItemStack(internalName, 0, 1, null)
+ if (itemStack == null) {
+ Utils.addChatMessage("§c[NEU] Couldn't resolve the ItemStack for $internalName")
+ return null
+ }
+ }
+
+ return itemStack
+ }
+
+ @JvmStatic
+ fun resolveInternalName(itemStack: ItemStack): String? {
+ var internalName =
+ NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(itemStack).resolveInternalName()
+ if (internalName == null) {
+ // If resolving internal name failed, the item may be a minecraft item
+ internalName = itemStack.item.registryName
+ if (internalName == null) {
+ // Check if minecraft searching also fails
+ // Leave error handling for caller since this method is also called in MixinOFDynamicLights which
+ // is run every tick, and we don't want to flood the chat
+ return null
+ }
+ }
+
+ return internalName
+ }
+
+ @JvmStatic
+ fun findDynamicLightItems(itemStack: ItemStack): Int {
+ val internalName: String = resolveInternalName(itemStack) ?: return 0
+ if (NotEnoughUpdates.INSTANCE.config.hidden.dynamicLightItems.contains(internalName)) {
+ return 15
+ }
+ return 0
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt
index e6dc0abc..acb379de 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt
@@ -98,7 +98,6 @@ data class KatRecipe(
)
Utils.drawStringCentered(
Utils.prettyTime(time),
- Minecraft.getMinecraft().fontRendererObj,
gui.guiLeft + textPosition.first.toFloat(), gui.guiTop + textPosition.second.toFloat(),
false, 0xff00ff
)
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
new file mode 100644
index 00000000..59fc2dd5
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag
+import io.github.moulberry.notenoughupdates.util.ApiUtil.Request
+import io.github.moulberry.notenoughupdates.util.kotlin.supplyImmediate
+import org.apache.http.NameValuePair
+import java.nio.file.Files
+import java.nio.file.Path
+import java.time.Duration
+import java.util.*
+import java.util.concurrent.CompletableFuture
+import java.util.function.Supplier
+import kotlin.io.path.deleteIfExists
+import kotlin.io.path.readText
+import kotlin.io.path.writeText
+import kotlin.time.Duration.Companion.hours
+import kotlin.time.Duration.Companion.seconds
+import kotlin.time.ExperimentalTime
+import kotlin.time.TimeSource
+import kotlin.time.toKotlinDuration
+
+@OptIn(ExperimentalTime::class)
+
+object ApiCache {
+ data class CacheKey(
+ val baseUrl: String,
+ val requestParameters: List<NameValuePair>,
+ val shouldGunzip: Boolean,
+ )
+
+ data class CacheResult internal constructor(
+ var cacheState: CacheState,
+ val firedAt: TimeSource.Monotonic.ValueTimeMark,
+ ) {
+ constructor(future: CompletableFuture<String>, firedAt: TimeSource.Monotonic.ValueTimeMark) : this(
+ CacheState.WaitingForFuture(future),
+ firedAt
+ ) {
+ future.thenAccept { text ->
+ synchronized(this) {
+ val f = Files.createTempFile(cacheBaseDir, "api-cache", ".bin")
+ log("Writing cache to disk: $f")
+ f.toFile().deleteOnExit()
+ f.writeText(text)
+ cacheState = CacheState.FileCached(f)
+ }
+ }
+ }
+
+ sealed interface CacheState {
+ object Disposed : CacheState
+ data class WaitingForFuture(val future: CompletableFuture<String>) : CacheState
+ data class FileCached(val file: Path) : CacheState
+ }
+
+ val isAvailable get() = cacheState is CacheState.FileCached
+
+ fun getCachedFuture(): CompletableFuture<String> {
+ synchronized(this) {
+ return when (val cs = cacheState) {
+ CacheState.Disposed -> supplyImmediate {
+ throw IllegalStateException("Attempting to read from a disposed future. Most likely caused by non synchronized access to ApiCache.cachedRequests")
+ }
+
+ is CacheState.FileCached -> supplyImmediate {
+ cs.file.readText()
+ }
+
+ is CacheState.WaitingForFuture -> cs.future
+ }
+ }
+ }
+
+ /**
+ * Should be called when removing / replacing a request from [cachedRequests].
+ * Should only be called while holding a lock on [ApiCache].
+ * This deletes the disk cache and smashes the internal state for it to be GCd.
+ * After calling this method no other method may be called on this object.
+ */
+ internal fun dispose() {
+ synchronized(this) {
+ val file = (cacheState as? CacheState.FileCached)?.file
+ log("Disposing cache for $file")
+ cacheState = CacheState.Disposed
+ file?.deleteIfExists()
+ }
+ }
+ }
+
+ private val cacheBaseDir by lazy {
+ val d = Files.createTempDirectory("neu-cache")
+ d.toFile().deleteOnExit()
+ d
+ }
+ private val cachedRequests = mutableMapOf<CacheKey, CacheResult>()
+ val histogramTotalRequests: MutableMap<String, Int> = mutableMapOf()
+ val histogramNonCachedRequests: MutableMap<String, Int> = mutableMapOf()
+
+ private val timeout = 10.seconds
+ private val globalMaxCacheAge = 1.hours
+
+ private fun log(message: String) {
+ NEUDebugFlag.API_CACHE.log(message)
+ }
+
+ private fun traceApiRequest(
+ request: Request,
+ failReason: String?,
+ ) {
+ if (!NotEnoughUpdates.INSTANCE.config.hidden.dev) return
+ val callingClass = Thread.currentThread().stackTrace
+ .find {
+ !it.className.startsWith("java.") &&
+ !it.className.startsWith("kotlin.") &&
+ it.className != ApiCache::class.java.name &&
+ it.className != ApiUtil::class.java.name &&
+ it.className != Request::class.java.name
+ }
+ val callingClassText = callingClass?.let {
+ "${it.className}.${it.methodName} (${it.fileName}:${it.lineNumber})"
+ } ?: "no calling class found"
+ callingClass?.className?.let {
+ histogramTotalRequests[it] = (histogramTotalRequests[it] ?: 0) + 1
+ if (failReason != null)
+ histogramNonCachedRequests[it] = (histogramNonCachedRequests[it] ?: 0) + 1
+ }
+ if (failReason != null) {
+ log("Executing api request for url ${request.baseUrl} by $callingClassText: $failReason")
+ } else {
+ log("Cache hit for api request for url ${request.baseUrl} by $callingClassText.")
+ }
+ }
+
+ private fun evictCache() {
+ synchronized(this) {
+ val it = cachedRequests.iterator()
+ while (it.hasNext()) {
+ val next = it.next()
+ if (next.value.firedAt.elapsedNow() >= globalMaxCacheAge) {
+ next.value.dispose()
+ it.remove()
+ }
+ }
+ }
+ }
+
+ fun cacheRequest(
+ request: Request,
+ cacheKey: CacheKey?,
+ futureSupplier: Supplier<CompletableFuture<String>>,
+ maxAge: Duration?
+ ): CompletableFuture<String> {
+ evictCache()
+ if (cacheKey == null) {
+ traceApiRequest(request, "uncacheable request (probably POST)")
+ return futureSupplier.get()
+ }
+ if (maxAge == null) {
+ traceApiRequest(request, "manually specified as uncacheable")
+ return futureSupplier.get()
+ }
+ fun recache(): CompletableFuture<String> {
+ return futureSupplier.get().also {
+ cachedRequests[cacheKey]?.dispose() // Safe to dispose like this because this function is always called in a synchronized block
+ cachedRequests[cacheKey] = CacheResult(it, TimeSource.Monotonic.markNow())
+ }
+ }
+ synchronized(this) {
+ val cachedRequest = cachedRequests[cacheKey]
+ if (cachedRequest == null) {
+ traceApiRequest(request, "no cache found")
+ return recache()
+ }
+
+ return if (cachedRequest.isAvailable) {
+ if (cachedRequest.firedAt.elapsedNow() > maxAge.toKotlinDuration()) {
+ traceApiRequest(request, "outdated cache")
+ recache()
+ } else {
+ // Using local cached request
+ traceApiRequest(request, null)
+ cachedRequest.getCachedFuture()
+ }
+ } else {
+ if (cachedRequest.firedAt.elapsedNow() > timeout) {
+ traceApiRequest(request, "suspiciously slow api response")
+ recache()
+ } else {
+ // Joining ongoing request
+ traceApiRequest(request, null)
+ cachedRequest.getCachedFuture()
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ErrorUtil.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ErrorUtil.kt
new file mode 100644
index 00000000..f849a40d
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ErrorUtil.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import java.io.ByteArrayOutputStream
+import java.io.PrintStream
+import java.nio.charset.StandardCharsets
+
+object ErrorUtil {
+ @JvmStatic
+ fun printCensoredStackTrace(e: Throwable, toCensor: List<String>): String {
+ val baos = ByteArrayOutputStream()
+ e.printStackTrace(PrintStream(baos, true, StandardCharsets.UTF_8.name()))
+ var string = String(baos.toByteArray(), StandardCharsets.UTF_8)
+ toCensor.forEach {
+ string = string.replace(it, "*".repeat(it.length))
+ }
+ return string
+ }
+
+ @JvmStatic
+ fun printStackTraceWithoutApiKey(e: Throwable): String {
+ return printCensoredStackTrace(e, listOf(NotEnoughUpdates.INSTANCE.config.apiData.apiKey))
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt
new file mode 100644
index 00000000..a2a61064
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/HotmInformation.kt
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.core.util.StringUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.inventory.ContainerChest
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+import java.util.regex.Pattern
+
+@NEUAutoSubscribe
+class HotmInformation {
+ private var ticksTillReload = 0
+ private val pattern = Pattern.compile("§[7b]Level (\\d*)(?:§8/.*)?")
+
+ @SubscribeEvent
+ fun onGuiOpen(event: GuiOpenEvent) {
+ val gui = event.gui
+ if (gui !is GuiChest) return
+
+ val containerName = (gui.inventorySlots as ContainerChest).lowerChestInventory.displayName.unformattedText
+ if (containerName == "Heart of the Mountain") {
+ ticksTillReload = 5
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (event.phase != TickEvent.Phase.START) return
+ if (ticksTillReload == 0) return
+ ticksTillReload--
+ if (ticksTillReload == 0) {
+ loadDataFromInventory()
+ }
+ }
+
+ private fun loadDataFromInventory() {
+ val profileSpecific = NotEnoughUpdates.INSTANCE.config.profileSpecific ?: return
+
+ for (slot in Minecraft.getMinecraft().thePlayer.openContainer.inventorySlots) {
+ val stack = slot.stack ?: continue
+ val displayName = stack.displayName
+ val lore = ItemUtils.getLore(stack)
+ if (!lore.any { it.contains("Right click to") }) continue
+
+ val perkName = StringUtils.cleanColour(displayName)
+ profileSpecific.hotmTree[perkName] = getLevel(lore[0])
+ }
+ }
+
+ private fun getLevel(string: String): Int {
+ val matcher = pattern.matcher(string)
+ val level = if (matcher.matches()) matcher.group(1).toInt() else 1
+
+ val withBlueCheeseGoblinOmelette = string.contains("§b")
+ val isNotMaxed = string.contains("§8/")
+ return if (withBlueCheeseGoblinOmelette && (isNotMaxed || level > 1)) level - 1 else level
+ }
+
+ companion object {
+ private val QUICK_FORGE_MULTIPLIERS = intArrayOf(
+ 985,
+ 970,
+ 955,
+ 940,
+ 925,
+ 910,
+ 895,
+ 880,
+ 865,
+ 850,
+ 845,
+ 840,
+ 835,
+ 830,
+ 825,
+ 820,
+ 815,
+ 810,
+ 805,
+ 700
+ )
+
+ /*
+ * 1000 = 100% of the time left
+ * 700 = 70% of the time left
+ * */
+ @JvmStatic
+ fun getQuickForgeMultiplier(level: Int): Int {
+ if (level <= 0) return 1000
+ return if (level > 20) -1 else QUICK_FORGE_MULTIPLIERS[level - 1]
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/CataCommand.java b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/KotlinStringUtils.kt
index afc47418..dc1e800c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/CataCommand.java
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/KotlinStringUtils.kt
@@ -17,20 +17,8 @@
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-package io.github.moulberry.notenoughupdates.commands.profile;
+package io.github.moulberry.notenoughupdates.util
-import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
-import net.minecraft.command.ICommandSender;
+import net.minecraft.util.StringUtils
-public class CataCommand extends ViewProfileCommand {
-
- public CataCommand() {
- super("cata");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- GuiProfileViewer.currentPage = GuiProfileViewer.ProfileViewerPage.DUNGEON;
- super.processCommand(sender, args);
- }
-}
+fun String.stripControlCodes(): String = StringUtils.stripControlCodes(this)
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.kt
new file mode 100644
index 00000000..bb0bc8b4
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.kt
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import net.minecraft.client.Minecraft
+import java.util.concurrent.Executor
+import java.util.concurrent.ForkJoinPool
+
+object MinecraftExecutor {
+
+ @JvmField
+ val OnThread = Executor {
+ val mc = Minecraft.getMinecraft()
+ if (mc.isCallingFromMinecraftThread) {
+ it.run()
+ } else {
+ Minecraft.getMinecraft().addScheduledTask(it)
+ }
+ }
+
+ @JvmField
+ val OffThread = Executor {
+ val mc = Minecraft.getMinecraft()
+ if (mc.isCallingFromMinecraftThread) {
+ ForkJoinPool.commonPool().execute(it)
+ } else {
+ it.run()
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/MuseumUtil.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/MuseumUtil.kt
new file mode 100644
index 00000000..dd52d175
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/MuseumUtil.kt
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import io.github.moulberry.notenoughupdates.NEUManager
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import net.minecraft.item.EnumDyeColor
+import net.minecraft.item.ItemDye
+import net.minecraft.item.ItemStack
+
+object MuseumUtil {
+
+ data class MuseumItem(
+ /**
+ * A potentially non-exhaustive list of item ids that are required for this museum donation.
+ */
+ val skyblockItemIds: List<String>,
+ val state: DonationState,
+ )
+
+ enum class DonationState {
+ /**
+ * Donated armor only shows one piece, so we use that for id resolution, which might result in incomplete
+ * results (hence the separate state). This still means that the entire set is donated, but it is guaranteed to
+ * be only a partial result. Other values of this enum do not guarantee a full result, but at least they do not
+ * guarantee a partial one.
+ */
+ DONATED_PRESENT_PARTIAL,
+ DONATED_PRESENT,
+ DONATED_VACANT,
+ MISSING,
+ }
+
+ fun findMuseumItem(stack: ItemStack, isOnArmorPage: Boolean): MuseumItem? {
+ val item = stack.item ?: return null
+ val items by lazy { findItemsByName(stack.displayName, isOnArmorPage)}
+ if (item is ItemDye) {
+ val dyeColor = EnumDyeColor.byDyeDamage(stack.itemDamage)
+ if (dyeColor == EnumDyeColor.LIME) {
+ // Item is donated, but not present in the museum
+ return MuseumItem(items, DonationState.DONATED_VACANT)
+ } else if (dyeColor == EnumDyeColor.GRAY) {
+ // Item is not donated
+ return MuseumItem(items, DonationState.MISSING)
+ }
+ // Otherwise unknown item, try to analyze as normal item.
+ }
+ val skyblockId = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(stack)
+ .resolveInternalName()
+ if (skyblockId != null) {
+ return MuseumItem(
+ listOf(skyblockId),
+ if (isOnArmorPage) DonationState.DONATED_PRESENT_PARTIAL else DonationState.DONATED_PRESENT
+ )
+ }
+ return MuseumItem(
+ items,
+ DonationState.DONATED_PRESENT
+ )
+ }
+
+ fun findItemsByName(displayName: String, armor: Boolean): List<String> {
+ return (if (armor)
+ findMuseumArmorSetByName(displayName)
+ else
+ listOf(findMuseumItemByName(displayName))).filterNotNull()
+
+ }
+
+ fun findMuseumItemByName(displayName: String): String? =
+ ItemResolutionQuery.findInternalNameByDisplayName(displayName, true)
+
+
+ fun findMuseumArmorSetByName(displayName: String): List<String?> {
+ val armorSlots = arrayOf(
+ "HELMET",
+ "LEGGINGS",
+ "CHESTPLATE",
+ "BOOTS"
+ )
+ val monochromeName = NEUManager.cleanForTitleMapSearch(displayName)
+ val results = ItemResolutionQuery.findInternalNameCandidatesForDisplayName(displayName)
+ .asSequence()
+ .filter {
+ val item = NotEnoughUpdates.INSTANCE.manager.createItem(it)
+ val name = NEUManager.cleanForTitleMapSearch(item.displayName)
+ monochromeName.replace("armor", "") in name
+ }
+ .toSet()
+ return armorSlots.map { armorSlot ->
+ results.singleOrNull { armorSlot in it }
+ }
+ }
+
+
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt
new file mode 100644
index 00000000..d44b7721
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/Rectangle.kt
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+/**
+ * An axis aligned rectangle in the following coordinate space:
+ *
+ * * The top direction is towards y=-INF
+ * * The bottom direction is towards y=+INF
+ * * The right direction is towards x=+INF
+ * * The left direction is towards x=-INF
+ */
+data class Rectangle(
+ val x: Int, val y: Int,
+ val width: Int, val height: Int,
+) {
+ /**
+ * The left edge of this rectangle (Low X)
+ */
+ val left get() = x
+
+ /**
+ * The right edge of this rectangle (High X)
+ */
+ val right get() = x + width
+
+ /**
+ * The top edge of this rectangle (Low X)
+ */
+ val top get() = y
+
+ /**
+ * The bottom edge of this rectangle (High X)
+ */
+ val bottom get() = y + height
+
+ init {
+ require(width >= 0)
+ require(height >= 0)
+ }
+
+ /**
+ * Check for intersections between two rectangles. Two rectangles with perfectly aligned edges do *not* count as
+ * intersecting.
+ */
+ fun intersects(other: Rectangle): Boolean {
+ val intersectsX = !(right <= other.left || left >= other.right)
+ val intersectsY = !(top >= other.bottom || bottom <= other.top)
+ return intersectsX && intersectsY
+ }
+
+ /**
+ * Check if this rectangle contains the given coordinate
+ */
+ fun contains(x1: Int, y1: Int) :Boolean{
+ return left <= x1 && x1 < left + width && top <= y1 && y1 < top + height
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTime.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTime.kt
new file mode 100644
index 00000000..8ceb1c51
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTime.kt
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import java.time.Instant
+
+data class SkyBlockTime(
+ val year: Int = 1,
+ val month: Int = 1,
+ val day: Int = 1,
+ val hour: Int = 0,
+ val minute: Int = 0,
+ val second: Int = 0,
+) {
+
+ val monthName get() = monthName(month)
+ val dayName get() = "$day${daySuffix(day)}"
+
+
+ fun toInstant(): Instant? {
+ return Instant.ofEpochMilli(toMillis())
+ }
+
+ fun toMillis(): Long {
+ val skyBlockYear = 124 * 60 * 60.0
+ val skyBlockMonth = skyBlockYear / 12
+ val skyBlockDay = skyBlockMonth / 31
+ val skyBlockHour = skyBlockDay / 24
+ val skyBlockMinute = skyBlockHour / 60
+ val skyBlockSecond = skyBlockMinute / 60
+
+ var time = 0.0
+ time += year * skyBlockYear
+ time += (month - 1) * skyBlockMonth
+ time += (day - 1) * skyBlockDay
+ time += hour * skyBlockHour
+ time += minute * skyBlockMinute
+ time += second * skyBlockSecond
+ time += 1559829300
+ return time.toLong() * 1000
+ }
+
+ companion object {
+ fun fromInstant(instant: Instant): SkyBlockTime {
+ val skyBlockTimeZero = 1559829300000 // Day 1, Year 1
+ var realMillis = (instant.toEpochMilli() - skyBlockTimeZero)
+
+ val skyBlockYear = 124 * 60 * 60 * 1000
+ val skyBlockMonth = skyBlockYear / 12
+ val skyBlockDay = skyBlockMonth / 31
+ val skyBlockHour = skyBlockDay / 24
+ val skyBlockMinute = skyBlockHour / 60
+ val skyBlockSecond = skyBlockMinute / 60
+
+ fun getUnit(factor: Int): Int {
+ val result = realMillis / factor
+ realMillis %= factor
+ return result.toInt()
+ }
+
+ val year = getUnit(skyBlockYear)
+ val month = getUnit(skyBlockMonth) + 1
+ val day = getUnit(skyBlockDay) + 1
+ val hour = getUnit(skyBlockHour)
+ val minute = getUnit(skyBlockMinute)
+ val second = getUnit(skyBlockSecond)
+ return SkyBlockTime(year, month, day, hour, minute, second)
+
+ }
+
+ fun now(): SkyBlockTime {
+ return fromInstant(Instant.now())
+ }
+
+ fun monthName(month: Int): String {
+ val prefix = when ((month - 1) % 3) {
+ 0 -> "Early "
+ 1 -> ""
+ 2 -> "Late "
+ else -> "Undefined!"
+ }
+
+ val name = when ((month - 1) / 3) {
+ 0 -> "Spring"
+ 1 -> "Summer"
+ 2 -> "Autumn"
+ 3 -> "Winter"
+ else -> "lol"
+ }
+
+ return prefix + name
+ }
+
+ fun daySuffix(n: Int): String {
+ return if (n in 11..13) {
+ "th"
+ } else when (n % 10) {
+ 1 -> "st"
+ 2 -> "nd"
+ 3 -> "rd"
+ else -> "th"
+ }
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/BrigadierRoot.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/BrigadierRoot.kt
new file mode 100644
index 00000000..66008044
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/BrigadierRoot.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2023 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util.brigadier
+
+import com.mojang.brigadier.CommandDispatcher
+import com.mojang.brigadier.ParseResults
+import com.mojang.brigadier.tree.ArgumentCommandNode
+import com.mojang.brigadier.tree.CommandNode
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.LRUCache
+import net.minecraft.command.ICommandSender
+import net.minecraftforge.client.ClientCommandHandler
+import java.lang.RuntimeException
+import java.util.*
+
+@NEUAutoSubscribe
+object BrigadierRoot {
+ private val help: MutableMap<CommandNode<DefaultSource>, String> = IdentityHashMap()
+ var dispatcher = CommandDispatcher<DefaultSource>()
+ private set
+ val parseText =
+ LRUCache.memoize<Pair<ICommandSender, String>, ParseResults<DefaultSource>>({ (sender, text) ->
+ dispatcher.parse(text, sender)
+ }, 1)
+
+ fun getHelpForNode(node: CommandNode<DefaultSource>): String? {
+ return help[node]
+ }
+
+ fun setHelpForNode(node: CommandNode<DefaultSource>, helpText: String) {
+ if (node.command == null) {
+ RuntimeException("Warning: Setting help on node that cannot be executed. Will be ignored").printStackTrace()
+ }
+ help[node] = helpText
+ }
+
+
+ fun getAllUsages(
+ path: String,
+ node: CommandNode<ICommandSender>,
+ visited: MutableSet<CommandNode<ICommandSender>> = mutableSetOf()
+ ): Sequence<NEUBrigadierHook.Usage> = sequence {
+ if (node in visited) return@sequence
+ visited.add(node)
+ val redirect = node.redirect
+ if (redirect != null) {
+ yieldAll(getAllUsages(path, node.redirect, visited))
+ visited.remove(node)
+ return@sequence
+ }
+ if (node.command != null)
+ yield(NEUBrigadierHook.Usage(path, getHelpForNode(node)))
+ node.children.forEach {
+ val nodeName = when (it) {
+ is ArgumentCommandNode<*, *> -> "<${it.name}>"
+ else -> it.name
+ }
+ yieldAll(getAllUsages("$path $nodeName", it, visited))
+ }
+ visited.remove(node)
+ }
+
+
+ fun updateHooks() = registerHooks(ClientCommandHandler.instance)
+
+ fun registerHooks(handler: ClientCommandHandler) {
+ val iterator = handler.commands.entries.iterator()
+ while (iterator.hasNext()) {
+ if (iterator.next().value is NEUBrigadierHook)
+ iterator.remove()
+ }
+ dispatcher = CommandDispatcher()
+ help.clear()
+ parseText.clearCache()
+ val event = RegisterBrigadierCommandEvent(this)
+ event.post()
+ event.hooks.forEach {
+ if (handler.commands.containsKey(it.commandName)) {
+ println("Could not register command ${it.commandName}")
+ } else {
+ handler.registerCommand(it)
+ }
+ }
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/EnumArgumentType.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/EnumArgumentType.kt
new file mode 100644
index 00000000..14b6ed6e
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/EnumArgumentType.kt
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util.brigadier
+
+import com.mojang.brigadier.LiteralMessage
+import com.mojang.brigadier.StringReader
+import com.mojang.brigadier.arguments.ArgumentType
+import com.mojang.brigadier.context.CommandContext
+import com.mojang.brigadier.exceptions.SimpleCommandExceptionType
+import com.mojang.brigadier.suggestion.Suggestions
+import com.mojang.brigadier.suggestion.SuggestionsBuilder
+import java.util.concurrent.CompletableFuture
+
+class EnumArgumentType<T : Enum<T>>(
+ val values: List<T>
+) : ArgumentType<T> {
+ companion object {
+ @JvmStatic
+ fun <T : Enum<T>> enum(values: Array<T>) = EnumArgumentType(values.toList())
+
+ inline fun <reified T : Enum<T>> enum() = enum(enumValues<T>())
+ }
+
+ override fun getExamples(): Collection<String> {
+ return values.map { it.name }
+ }
+
+ override fun <S : Any?> listSuggestions(
+ context: CommandContext<S>,
+ builder: SuggestionsBuilder
+ ): CompletableFuture<Suggestions> {
+
+ examples
+ .filter {builder.remaining.isBlank() || it.startsWith(builder.remaining, ignoreCase = true) }
+ .forEach { builder.suggest(it) }
+ return builder.buildFuture()
+ }
+
+ private val invalidEnum =
+ SimpleCommandExceptionType(LiteralMessage("Expected one of: ${values.joinToString(", ")}"))
+
+ override fun parse(reader: StringReader): T {
+ val enumName = reader.readString()
+ return values.find { enumName == it.name }
+ ?: throw invalidEnum.createWithContext(reader)
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/RestArgumentType.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/RestArgumentType.kt
new file mode 100644
index 00000000..adfdae6a
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/RestArgumentType.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util.brigadier
+
+import com.mojang.brigadier.StringReader
+import com.mojang.brigadier.arguments.ArgumentType
+
+object RestArgumentType : ArgumentType<String> {
+ override fun parse(reader: StringReader): String {
+ val remaining = reader.remaining
+ reader.cursor += remaining.length
+ return remaining
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt
new file mode 100644
index 00000000..17203a4b
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2023 Linnea Gräf
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util.brigadier
+
+import com.mojang.brigadier.arguments.ArgumentType
+import com.mojang.brigadier.builder.ArgumentBuilder
+import com.mojang.brigadier.builder.LiteralArgumentBuilder
+import com.mojang.brigadier.builder.RequiredArgumentBuilder
+import com.mojang.brigadier.context.CommandContext
+import com.mojang.brigadier.tree.ArgumentCommandNode
+import com.mojang.brigadier.tree.CommandNode
+import com.mojang.brigadier.tree.LiteralCommandNode
+import io.github.moulberry.notenoughupdates.commands.dev.DevTestCommand
+import io.github.moulberry.notenoughupdates.util.iterate
+import net.minecraft.command.ICommandSender
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.IChatComponent
+import java.lang.reflect.ParameterizedType
+import java.lang.reflect.Type
+import java.lang.reflect.TypeVariable
+
+
+typealias DefaultSource = ICommandSender
+
+
+
+private fun normalizeGeneric(argument: Type): Class<*> {
+ return if (argument is Class<*>) {
+ argument
+ } else if (argument is TypeVariable<*>) {
+ normalizeGeneric(argument.bounds[0])
+ } else if (argument is ParameterizedType) {
+ normalizeGeneric(argument.rawType)
+ } else {
+ Any::class.java
+ }
+}
+
+data class TypeSafeArg<T : Any>(val name: String, val argument: ArgumentType<T>) {
+ val argClass by lazy {
+ argument.javaClass
+ .iterate<Class<in ArgumentType<T>>> {
+ it.superclass
+ }
+ .flatMap {
+ it.genericInterfaces.toList()
+ }
+ .filterIsInstance<ParameterizedType>()
+ .find { it.rawType == ArgumentType::class.java }!!
+ .let {
+ normalizeGeneric(it.actualTypeArguments[0])
+ }
+ }
+
+ @JvmName("getWithThis")
+ fun <S> CommandContext<S>.get(): T =
+ get(this)
+
+
+ fun <S> get(ctx: CommandContext<S>): T {
+ return ctx.getArgument(name, argClass) as T
+ }
+}
+
+fun <T : ICommandSender, C : CommandContext<T>> C.reply(component: IChatComponent) {
+ source.addChatMessage(ChatComponentText("§e[NEU] ").appendSibling(component))
+}
+
+fun <T : ICommandSender, C : CommandContext<T>> C.reply(text: String, block: ChatComponentText.() -> Unit = {}) {
+ source.addChatMessage(ChatComponentText(text.split("\n").joinToString("\n") { "§e[NEU] $it" }).also(block))
+}
+
+operator fun <T : Any, C : CommandContext<*>> C.get(arg: TypeSafeArg<T>): T {
+ return arg.get(this)
+}
+
+
+fun <T : Any> argument(
+ name: String,
+ argument: ArgumentType<T>,
+ block: RequiredArgumentBuilder<DefaultSource, T>.(TypeSafeArg<T>) -> Unit
+): RequiredArgumentBuilder<DefaultSource, T> =
+ RequiredArgumentBuilder.argument<DefaultSource, T>(name, argument).also { block(it, TypeSafeArg(name, argument)) }
+
+fun <T : ArgumentBuilder<DefaultSource, T>, AT : Any> T.thenArgument(
+ name: String,
+ argument: ArgumentType<AT>,
+ block: RequiredArgumentBuilder<DefaultSource, AT>.(TypeSafeArg<AT>) -> Unit
+): ArgumentCommandNode<DefaultSource, AT> = argument(name, argument, block).build().also(::then)
+
+fun <T : ArgumentBuilder<DefaultSource, T>, AT : Any> T.thenArgumentExecute(
+ name: String,
+ argument: ArgumentType<AT>,
+ block: CommandContext<DefaultSource>.(TypeSafeArg<AT>) -> Unit
+): ArgumentCommandNode<DefaultSource, AT> = thenArgument(name, argument) {
+ thenExecute {
+ block(it)
+ }
+}
+
+fun literal(
+ name: String,
+ block: LiteralArgumentBuilder<DefaultSource>.() -> Unit = {}
+): LiteralArgumentBuilder<DefaultSource> =
+ LiteralArgumentBuilder.literal<DefaultSource>(name).also(block)
+
+fun <T : ArgumentBuilder<DefaultSource, T>> T.thenLiteral(
+ name: String,
+ block: LiteralArgumentBuilder<DefaultSource>.() -> Unit
+): LiteralCommandNode<DefaultSource> =
+ then(literal(name), block) as LiteralCommandNode<DefaultSource>
+
+
+fun <T : ArgumentBuilder<DefaultSource, T>> T.thenLiteralExecute(
+ name: String,
+ block: CommandContext<DefaultSource>.() -> Unit
+): LiteralCommandNode<DefaultSource> =
+ thenLiteral(name) {
+ thenExecute(block)
+ }
+
+fun <T : ArgumentBuilder<DefaultSource, T>, U : ArgumentBuilder<DefaultSource, U>> T.then(
+ node: U,
+ block: U.() -> Unit
+): CommandNode<DefaultSource> =
+ node.also(block).build().also(::then)
+
+fun <T : ArgumentBuilder<DefaultSource, T>> T.thenExecute(block: CommandContext<DefaultSource>.() -> Unit): T =
+ executes {
+ block(it)
+ 1
+ }
+
+fun <T : ArgumentBuilder<DefaultSource, T>> T.requiresDev(): T {
+ requires { DevTestCommand.isDeveloper(it) }
+ return this
+}
+
+fun NEUBrigadierHook.withHelp(helpText: String): NEUBrigadierHook {
+ commandNode.withHelp(helpText)
+ return this
+}
+
+fun <T : CommandNode<DefaultSource>> T.withHelp(helpText: String): T {
+ BrigadierRoot.setHelpForNode(this, helpText)
+ return this
+}
+
+fun <A : Any, T : RequiredArgumentBuilder<DefaultSource, A>> T.suggestsList(list: List<String>) {
+ suggestsList { list }
+}
+
+fun <A : Any, T : RequiredArgumentBuilder<DefaultSource, A>> T.suggestsList(list: () -> List<String>) {
+ suggests { context, builder ->
+ list().filter { it.startsWith(builder.remaining, ignoreCase = true) }
+ .forEach { builder.suggest(it) }
+ builder.buildFuture()
+ }
+}
+
+
+
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/iterate.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/iterate.kt
new file mode 100644
index 00000000..bcfe11aa
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/iterate.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+fun <T : Any> T.iterate(evolve: (T) -> T?): Sequence<T> = sequence {
+ var pointer: T? = this@iterate
+ while (pointer != null) {
+ yield(pointer)
+ pointer = evolve(pointer)
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/kotlin/completablefuture.kt
index e0ae7a1a..de45c1e3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/kotlin/completablefuture.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
+ * Copyright (C) 2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -17,30 +17,17 @@
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
-package io.github.moulberry.notenoughupdates.commands;
+package io.github.moulberry.notenoughupdates.util.kotlin
-import net.minecraft.command.CommandBase;
-import net.minecraft.command.ICommandSender;
+import java.util.concurrent.CompletableFuture
-public abstract class ClientCommandBase extends CommandBase {
- private final String name;
-
- protected ClientCommandBase(String name) {
- this.name = name;
- }
-
- @Override
- public String getCommandName() {
- return name;
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return "/" + name;
- }
-
- @Override
- public boolean canCommandSenderUseCommand(ICommandSender sender) {
- return true;
- }
+inline fun <R> supplyImmediate(block: () -> R): CompletableFuture<R> {
+ val cf = CompletableFuture<R>()
+ try {
+ cf.complete(block())
+ } catch (t: Throwable) {
+ cf.completeExceptionally(t)
+ }
+ return cf
}
+
diff --git a/src/main/resources/assets/notenoughupdates/disabled_button.png b/src/main/resources/assets/notenoughupdates/disabled_button.png
new file mode 100644
index 00000000..4283fbf3
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/disabled_button.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/dynamic_light_items_editor.png b/src/main/resources/assets/notenoughupdates/dynamic_light_items_editor.png
new file mode 100644
index 00000000..399924c1
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/dynamic_light_items_editor.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/enabled_button.png b/src/main/resources/assets/notenoughupdates/enabled_button.png
new file mode 100644
index 00000000..a0f8d7fc
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/enabled_button.png
Binary files differ
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index 8877aed8..279d5cef 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -5,6 +5,7 @@
"plugin": "io.github.moulberry.notenoughupdates.envcheck.NEUMixinConfigPlugin",
"compatibilityLevel": "JAVA_8",
"mixins": [
+ "AccessorCommandHandler",
"AccessorEntityAgeable",
"AccessorEntityArmorStand",
"AccessorGuiPlayerTabOverlay",
@@ -21,6 +22,7 @@
"MixinGuiChest",
"MixinGuiContainer",
"MixinGuiIngame",
+ "MixinGuiIngameForge",
"MixinGuiInventory",
"MixinGuiScreen",
"MixinGuiUtils",
@@ -35,6 +37,7 @@
"MixinMinecraft",
"MixinMouseHelper",
"MixinNetHandlerPlayClient",
+ "MixinOFDynamicLights",
"MixinPlayerControllerMP",
"MixinRender",
"MixinRendererLivingEntity",
diff --git a/src/test/kotlin/io/github/moulberry/notenoughupdates/util/RectangleTest.kt b/src/test/kotlin/io/github/moulberry/notenoughupdates/util/RectangleTest.kt
new file mode 100644
index 00000000..6d4270dd
--- /dev/null
+++ b/src/test/kotlin/io/github/moulberry/notenoughupdates/util/RectangleTest.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import org.junit.jupiter.api.Assertions.assertFalse
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.assertThrows
+
+class RectangleTest {
+
+ @Test
+ fun testNoNegativeSizes() {
+ assertThrows<IllegalArgumentException> {
+ Rectangle(0, 0, -1, 0)
+ }
+ assertThrows<IllegalArgumentException> {
+ Rectangle(0, 0, 0, -1)
+ }
+ }
+
+ @Test
+ fun testOverlaps() {
+ val topLeft = Rectangle(0, 0, 10, 10)
+ assertTrue(topLeft.intersects(topLeft))
+ assertTrue(topLeft.intersects(Rectangle(9, 2, 1, 1)))
+ assertTrue(topLeft.intersects(Rectangle(-2, -2, 4, 4)))
+ assertTrue(topLeft.intersects(Rectangle(4, 4, 1, 1)))
+ assertFalse(topLeft.intersects(Rectangle(-2,-2, 1,1)))
+ assertFalse(topLeft.intersects(Rectangle(-2,-2, 2,2)))
+ }
+}
diff --git a/src/test/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTimeTest.kt b/src/test/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTimeTest.kt
new file mode 100644
index 00000000..8d762460
--- /dev/null
+++ b/src/test/kotlin/io/github/moulberry/notenoughupdates/util/SkyBlockTimeTest.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.util
+
+import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Test
+import java.time.Instant
+
+class SkyBlockTimeTest {
+ @Test
+ fun someRandomTimestamp() {
+ val sbt = SkyBlockTime.fromInstant(Instant.ofEpochSecond(1676236163L))
+ assertEquals(SkyBlockTime(260, 10, 7, 17, 15, 38), sbt)
+ assertEquals("Early Winter", sbt.monthName)
+ }
+
+ @Test
+ fun isReversibleEquivalent() {
+ val ts = 167623132230L
+ val someTimeStamp = Instant.ofEpochSecond(ts)
+ assertEquals(someTimeStamp.toEpochMilli(), SkyBlockTime.fromInstant(someTimeStamp).toMillis())
+ }
+
+ @Test
+ fun monthNames() {
+ assertEquals(
+ listOf(
+ "Early Spring",
+ "Spring",
+ "Late Spring",
+ "Early Summer",
+ "Summer",
+ "Late Summer",
+ "Early Autumn",
+ "Autumn",
+ "Late Autumn",
+ "Early Winter",
+ "Winter",
+ "Late Winter"
+ ), (1..12).map { SkyBlockTime.monthName(it) })
+ }
+
+ @Test
+ fun theOriginOfTime() {
+ assertEquals(SkyBlockTime(year = 0), SkyBlockTime.fromInstant(Instant.ofEpochMilli(1559829300000L)))
+ }
+
+
+}