diff --git a/.github/workflows/remove-labels-on-pr-close.yml b/.github/workflows/remove-labels-on-pr-close.yml index 28735af823b1..8d46ab83a2cd 100644 --- a/.github/workflows/remove-labels-on-pr-close.yml +++ b/.github/workflows/remove-labels-on-pr-close.yml @@ -4,13 +4,13 @@ name: "Remove All Labels" on: pull_request_target: - types: [closed] + types: [ closed ] jobs: remove_very_soon: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: rogerluan/label-remover@v1.0.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + - uses: rogerluan/label-remover@v1.0.1 + with: + github_token: ${{ secrets.github_token }} diff --git a/build.gradle.kts b/build.gradle.kts index c971ba14fef2..34082660b648 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ plugins { } group = "at.hannibal2.skyhanni" -version = "0.25.Beta.25" +version = "0.25.Beta.26" val gitHash by lazy { val baos = ByteArrayOutputStream() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 239dfc8d2a49..260688446bca 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -191,6 +191,9 @@ + Added /shignore. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1469) + This lets you block users from running party commands. + Option to Replace Roman Numerals. - Mikecraft1224 (https://github.com/hannibal002/SkyHanni/pull/1722) ++ Added a simple Ferocity Display. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1765) + + Shows the Ferocity stat as a single GUI element. + + Requires the Tab List widget to be enabled and Ferocity to be selected to work. ### Improvements @@ -234,6 +237,8 @@ + Maeve's Garden visitor dialogue is no longer hidden, preventing confusion about potential bugs. + Displays the middle of the plot while the pest line is showing. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1647) + This makes it clearer when the guess points to the middle of the plot rather than to a pest. ++ Improved pest count accuracy in plot detection. - Empa (https://github.com/hannibal002/SkyHanni/pull/1764) ++ Added options to show crops per second and crops per hour in the Crop Milestone Display. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1536) #### Diana Improvements @@ -327,6 +332,7 @@ + Click an item that can be upgraded/purchased with chocolate to set it as a reminder goal. + Works with Rabbits, Barn, Time Tower, etc. + Option to display this timer universally, even outside the inventory. ++ Added a display for the time remaining until Tower Charges are full. - Empa (https://github.com/hannibal002/SkyHanni/pull/1760) #### Slayer Improvements @@ -358,6 +364,7 @@ + Renamed Deep Caverns parkour to Deep Caverns Guide. - seraid (https://github.com/hannibal002/SkyHanni/pull/1443) + Make Fossil Excavator a category rather than accordion. - walker (https://github.com/hannibal002/SkyHanni/pull/1441) + Disabled colored blocks in the Mineshaft. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1749) ++ Disabled mining commissions block color in Dwarven Mines. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1790) #### Event Improvements @@ -398,6 +405,7 @@ + Improved wording for Chocolate Factory spam filter and upgrade notification config options. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1729) + Added an option to only receive Rabbit Crush warnings during the Hoppity event. - Empa (https://github.com/hannibal002/SkyHanni/pull/1762) ++ Warn when all three Hoppity eggs are ready to be found. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1747) #### Rift Improvements @@ -430,6 +438,8 @@ + Architect Draft messages can now be copied and pasted. - raven (https://github.com/hannibal002/SkyHanni/pull/1732) + Updated setting description for clarity. - seraid (https://github.com/hannibal002/SkyHanni/pull/1736) + The GUI position editor can now edit all GUIs that were visible within the last 20 seconds, including those inside inventories. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1768) ++ Improved the performance of scoreboard and tab list reading. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1779) ++ Improved performance of minion nametag feature and removed unnecessary checks between blocks. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1780) ### Fixes @@ -514,6 +524,8 @@ + Fixed stash getting detected as private message. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1716) + Fixed spaces in chat formatting. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1704) + Fixed player chat spacing issue with the crimson faction icon. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1770) ++ Fixed extra space in chat formatting. - Jordyrat (https://github.com/hannibal002/SkyHanni/pull/1785) ++ Fixed incorrect chat format when using the Hypixel command /show. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1781) #### GUI Fixes @@ -567,6 +579,7 @@ + Fixed more double objectives in Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1731) + Fixed missing Hay Eaten line in Custom Scoreboard in Rift. - Empa (https://github.com/hannibal002/SkyHanni/pull/1721) + Fixed Custom Scoreboard showing the Spooky Festival Time twice. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1757) ++ Fixed unknown scoreboard lines chat error message when Hypixel sends incomplete line data. - Empa (https://github.com/hannibal002/SkyHanni/pull/1761) #### Dungeon Fixes @@ -612,6 +625,7 @@ + Fixed the Chocolate Factory upgrade warning incorrectly displaying when no upgrade was possible. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1741) + Fixed a case where the chocolate factory upgrade warning did not work. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1758) ++ Fixed Chocolate Factory time remaining calculations while the Time Tower is active. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1774) #### Rift Fixes @@ -620,6 +634,7 @@ + Fixed Blood Effigies timers in the Rift. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1649) + Fixed timers showing even when above the set respawn time. + Fixed display flickering due to milliseconds. ++ Fixed duplicate word "soul" in an Enigma Waypoint. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1776) #### Mining Fixes @@ -706,6 +721,7 @@ j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1698) + Fixed Active Effects in Compact Tab List always showing 0. - Luna (https://github.com/hannibal002/SkyHanni/pull/1706) + Fixed bugged minion name tags on your private island when opening a minion. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1630) ++ Fixed supercrafted items being incorrectly added to profit trackers. - Empa (https://github.com/hannibal002/SkyHanni/pull/1784) ### Technical Details @@ -886,6 +902,7 @@ ThatGravyBoat (https://github.com/hannibal002/SkyHanni/pull/1696) + Useful for hiding extra layers of a player such as armor, capes, Items and so on. + Removed code duplication in AxisAlignedBB.getCorners. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1756) ++ Added a RemovalListener to TimeLimitedCache and TimeLimitedSet. - Empa (https://github.com/hannibal002/SkyHanni/pull/1761) ### Removed Features diff --git a/docs/FEATURES.md b/docs/FEATURES.md index d8ef32d1beca..8d0dafb00554 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -1159,6 +1159,9 @@ Use `/sh` or `/skyhanni` to open the SkyHanni config in game. + Inventory background to GUI editor. - seraid (https://github.com/hannibal002/SkyHanni/pull/1622) + Added option to hide item tooltips inside the Harp. - raven (https://github.com/hannibal002/SkyHanni/pull/1700) + Option to Replace Roman Numerals. - Mikecraft1224 (https://github.com/hannibal002/SkyHanni/pull/1722) ++ Simple Ferocity Display. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1765) + + Shows the Ferocity stat as a single GUI element. + + Requires the Tab List widget to be enabled and Ferocity to be selected to work.
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 77fd0806b617..2287a640e5fb 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -19,6 +19,7 @@ import at.hannibal2.skyhanni.data.ActionBarStatsData import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.data.CropAccessoryData import at.hannibal2.skyhanni.data.EntityMovementData +import at.hannibal2.skyhanni.data.EventCounter import at.hannibal2.skyhanni.data.FameRanks import at.hannibal2.skyhanni.data.FixedRateTimerManager import at.hannibal2.skyhanni.data.FriendAPI @@ -87,6 +88,7 @@ import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier import at.hannibal2.skyhanni.features.chroma.ChromaManager import at.hannibal2.skyhanni.features.combat.BestiaryData +import at.hannibal2.skyhanni.features.combat.FerocityDisplay import at.hannibal2.skyhanni.features.combat.HideDamageSplash import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker @@ -445,8 +447,8 @@ import at.hannibal2.skyhanni.test.TestCopyRngMeterValues import at.hannibal2.skyhanni.test.TestExportTools import at.hannibal2.skyhanni.test.TestShowSlotNumber import at.hannibal2.skyhanni.test.WorldEdit -import at.hannibal2.skyhanni.test.command.CopyNearbyParticlesCommand import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.test.command.TrackParticlesCommand import at.hannibal2.skyhanni.test.command.TrackSoundsCommand import at.hannibal2.skyhanni.test.hotswap.HotswapSupport import at.hannibal2.skyhanni.utils.ChatUtils @@ -483,7 +485,7 @@ import org.apache.logging.log4j.Logger clientSideOnly = true, useMetadata = true, guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop", - version = "0.25.Beta.25", + version = "0.25.Beta.26", ) class SkyHanniMod { @@ -514,6 +516,7 @@ class SkyHanniMod { loadModule(EntityMovementData()) loadModule(EntityOutlineRenderer) loadModule(EntityUtils) + loadModule(EventCounter) loadModule(FixedRateTimerManager()) loadModule(GardenBestCropTime()) loadModule(GardenComposterUpgradesData()) @@ -710,6 +713,7 @@ class SkyHanniMod { loadModule(FarmingLaneCreator) loadModule(FarmingLaneFeatures) loadModule(FarmingWeightDisplay()) + loadModule(FerocityDisplay()) loadModule(FirePillarDisplay()) loadModule(FireVeilWandParticles()) loadModule(FishingBaitWarnings()) @@ -893,7 +897,7 @@ class SkyHanniMod { loadModule(SulphurSkitterBox()) loadModule(SummoningMobManager()) loadModule(SummoningSoulsName()) - loadModule(SuperCraftFeatures()) + loadModule(SuperCraftFeatures) loadModule(SuperpairsClicksAlert()) loadModule(TabListReader) loadModule(TabListRenderer) @@ -932,26 +936,24 @@ class SkyHanniMod { loadModule(WildStrawberryDyeNotification()) loadModule(WrongFungiCutterWarning()) - init() - // test stuff loadModule(ButtonOnPause()) - loadModule(CopyNearbyParticlesCommand) loadModule(FixGhostEntities) loadModule(HighlightMissingRepoItems()) loadModule(PacketTest) loadModule(ParkourWaypointSaver()) loadModule(SkyHanniDebugsAndTests()) - loadModule(SkyHanniDebugsAndTests) loadModule(TestBingo) loadModule(TestCopyBestiaryValues) loadModule(TestCopyRngMeterValues) loadModule(TestShowSlotNumber()) + loadModule(TrackParticlesCommand) loadModule(TrackSoundsCommand) loadModule(WorldEdit) - PreInitFinishedEvent().postAndCatch() loadModule(MobDebug()) + init() + PreInitFinishedEvent().postAndCatch() } @Mod.EventHandler @@ -969,10 +971,18 @@ class SkyHanniMod { } catch (e: Exception) { Exception("Error reading repo data", e).printStackTrace() } + // TODO rework + loadedClasses.clear() } + private val loadedClasses = mutableSetOf() + fun loadModule(obj: Any) { modules.add(obj) + if (!loadedClasses.add(obj.javaClass.name)) { + println("Loading module twice: ${obj.javaClass.name}") + } + MinecraftForge.EVENT_BUS.register(obj) } diff --git a/src/main/java/at/hannibal2/skyhanni/api/BlockChangeAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/BlockChangeAPI.kt index 3991a9265b69..0add6761a3d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/BlockChangeAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/BlockChangeAPI.kt @@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object BlockChangeAPI { @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (event.packet is S23PacketBlockChange) { val blockPos = event.packet.blockPosition ?: return val blockState = event.packet.blockState ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index 81eb5c049fb9..db6e3c1de9ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.api +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.CollectionUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.ItemAddEvent @@ -9,7 +10,6 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NumberUtil.formatLong @@ -38,7 +38,7 @@ object CollectionAPI { // TODO repo private val incorrectCollectionNames = mapOf( - "Mushroom" to "RED_MUSHROOM".asInternalName() + "Mushroom" to SkyhanniItems.RED_MUSHROOM() ) @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index bcbee1cade1d..e5c9067cdad5 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -203,37 +203,27 @@ object SkillAPI { } @SubscribeEvent - fun onDebugDataCollectCurrent(event: DebugDataCollectEvent) { - event.title("Current Skill") + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Skills") val storage = storage if (storage == null) { event.addIrrelevant("SkillMap is empty") return } - val skillType = activeSkill - if (skillType == null) { - event.addIrrelevant("activeSkill is null") - return - } - - event.addData { - storage[skillType]?.let { skillInfo -> - addDebug(skillType, skillInfo) + event.addIrrelevant { + val activeSkill = activeSkill + if (activeSkill == null) { + add("activeSkill is null") + } else { + add("active skill:") + storage[activeSkill]?.let { skillInfo -> + addDebug(activeSkill, skillInfo) + } + add("") + add("") } - } - } - @SubscribeEvent - fun onDebugDataCollectAll(event: DebugDataCollectEvent) { - event.title("All Skills") - val storage = storage - if (storage == null) { - event.addIrrelevant("SkillMap is empty") - return - } - - event.addIrrelevant { for ((skillType, skillInfo) in storage) { addDebug(skillType, skillInfo) } diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index 576ac127c5ac..16b0fcfa3d5d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -225,6 +225,7 @@ class ConfigManager { // debug features "features.dev.DebugConfig.trackSoundPosition", + "features.dev.DebugConfig.trackParticlePosition", "features.dev.DevConfig.debugPos", "features.dev.DevConfig.debugLocationPos", "features.dev.DevConfig.debugItemPos", diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 06eb5c57eff9..93d8eacc8b47 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.config.features.skillprogress.SkillProgressConfig; import at.hannibal2.skyhanni.config.features.slayer.SlayerConfig; import at.hannibal2.skyhanni.config.storage.Storage; -import at.hannibal2.skyhanni.utils.LorenzUtils; +import at.hannibal2.skyhanni.utils.datetime.DateUtils; import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.Config; import io.github.notenoughupdates.moulconfig.Social; @@ -43,7 +43,7 @@ public boolean shouldAutoFocusSearchbar() { @Override public HorizontalAlign alignCategory(ProcessedCategory category, boolean isSelected) { - if (LorenzUtils.INSTANCE.isAprilFoolsDay()) + if (DateUtils.isAprilFools()) return HorizontalAlign.RIGHT; return super.alignCategory(category, isSelected); } @@ -65,7 +65,7 @@ public void saveNow() { @Override public String getTitle() { String modName = "SkyHanni"; - if (LorenzUtils.INSTANCE.isAprilFoolsDay()) + if (DateUtils.isAprilFools()) modName = new StringBuilder().append("اسکای هانی").reverse().toString(); // Minecraft does not render RTL strings very nicely, so we reverse the string here. Not authentic, but close enough. return modName + " " + SkyHanniMod.getVersion() + " by §channibal2§r, config by §5Moulberry §rand §5nea89"; diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index f99b214b5a4d..50a579c526d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -72,10 +72,10 @@ import at.hannibal2.skyhanni.test.command.CopyActionBarCommand import at.hannibal2.skyhanni.test.command.CopyBossbarCommand import at.hannibal2.skyhanni.test.command.CopyItemCommand import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand -import at.hannibal2.skyhanni.test.command.CopyNearbyParticlesCommand import at.hannibal2.skyhanni.test.command.CopyScoreboardCommand import at.hannibal2.skyhanni.test.command.SoundCommand import at.hannibal2.skyhanni.test.command.TestChatCommand +import at.hannibal2.skyhanni.test.command.TrackParticlesCommand import at.hannibal2.skyhanni.test.command.TrackSoundsCommand import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.ChatUtils @@ -458,6 +458,10 @@ object Commands { "shtracksounds", "Tracks the sounds for the specified duration (in seconds) and copies it to the clipboard" ) { TrackSoundsCommand.command(it) } + registerCommand( + "shtrackparticles", + "Tracks the particles for the specified duration (in seconds) and copies it to the clipboard" + ) { TrackParticlesCommand.command(it) } registerCommand( "shcopytablist", "Copies the tab list data to the clipboard" @@ -478,10 +482,6 @@ object Commands { "shcopyitem", "Copies information about the item in hand to the clipboard" ) { CopyItemCommand.onCommand() } - registerCommand( - "shcopyparticles", - "Copied information about the particles that spawn in the next 50ms to the clipboard" - ) { CopyNearbyParticlesCommand.command(it) } registerCommand("shtestpacket", "Logs incoming and outgoing packets to the console") { PacketTest.command(it) } registerCommand( "shtestmessage", diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java index 0504a918dbd0..bf8e795d7074 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java @@ -44,6 +44,11 @@ public class CombatConfig { @Accordion public EnderNodeConfig enderNodeTracker = new EnderNodeConfig(); + @Expose + @ConfigOption(name = "Ferocity Display", desc = "") + @Accordion + public FerocityDisplayConfig ferocityDisplay = new FerocityDisplayConfig(); + @Expose @ConfigOption(name = "Hide Damage Splash", desc = "Hide all damage splashes anywhere in SkyBlock.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java new file mode 100644 index 000000000000..42c8bb9a6d92 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.config.features.combat; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; + +public class FerocityDisplayConfig { + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Show ferocity stat as single gui element. " + + "Requires tab list widget enabled and ferocity selected to work." + ) + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigLink(owner = FerocityDisplayConfig.class, field = "enabled") + public Position position = new Position(10, 80, false, true); +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java index 9415d109e191..02caee0c8a2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java @@ -134,4 +134,8 @@ public class DebugConfig { // Does not have a config element! @Expose public Position trackSoundPosition = new Position(0, 0); + + // Also does not have a config element! + @Expose + public Position trackParticlePosition = new Position(0, 0); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java index 31fed5074ded..1278542b508e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java @@ -43,6 +43,12 @@ public class HoppityEggsConfig { @FeatureToggle public boolean showClaimedEggs = false; + @Expose + @ConfigOption(name = "Warn When Unclaimed", desc = "Warn when all three eggs are ready to be found.") + @ConfigEditorBoolean + @FeatureToggle + public boolean warnUnclaimedEggs = false; + @Expose @ConfigOption(name = "Show during Contest", desc = "Show during a farming contest.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java index 56094742853f..39ed3c4ae27b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java @@ -12,7 +12,7 @@ public class ChumBucketHiderConfig { @ConfigOption(name = "Enable", desc = "Hide the Chum/Chumcap Bucket name tags for other players.") @ConfigEditorBoolean @FeatureToggle - public Property enabled = Property.of(true); + public Property enabled = Property.of(false); @Expose @ConfigOption(name = "Hide Bucket", desc = "Hide the Chum/Chumcap Bucket.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java index abc256c9732e..9d124f9880a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java @@ -116,7 +116,9 @@ public enum MilestoneTextEntry implements HasLegacyId { MILESTONE_TIER("§7Pumpkin Tier 22", 1), NUMBER_OUT_OF_TOTAL("§e12,300§8/§e100,000", 2), TIME("§7In §b12m 34s", 3), + CROPS_PER_SECOND("§7Crops/Second§8: §e205.75"), CROPS_PER_MINUTE("§7Crops/Minute§8: §e12,345", 4), + CROPS_PER_HOUR("§7Crops/Hour§8: §e740,700"), BLOCKS_PER_SECOND("§7Blocks/Second§8: §e19.85", 5), PERCENTAGE("§7Percentage: §e12.34%", 6), ; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java index bacd8aae051a..fec74751125b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java @@ -50,6 +50,7 @@ public class ChocolateFactoryConfig { ChocolateFactoryStat.MULTIPLIER, ChocolateFactoryStat.BARN, ChocolateFactoryStat.TIME_TOWER, + ChocolateFactoryStat.TIME_TOWER_FULL, ChocolateFactoryStat.LEADERBOARD_POS, ChocolateFactoryStat.TIME_TO_BEST_UPGRADE )); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java index f77e528645fc..7e11ce6f9856 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java @@ -11,7 +11,7 @@ public class ChocolateUpgradeWarningsConfig { @ConfigOption(name = "Upgrade Warning", desc = "Chat notification when you have a chocolate factory upgrade available to purchase.") @ConfigEditorBoolean @FeatureToggle - public boolean upgradeWarning = true; + public boolean upgradeWarning = false; @Expose @ConfigOption(name = "Upgrade Warning Sound", desc = "Also plays a sound when an upgrade is available. " + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java index 1e1fef454861..81eeb2b1abc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java @@ -15,7 +15,7 @@ public class MiningEventConfig { "also enables you sending data. §eTakes up to a minute to sync new events.") @ConfigEditorBoolean @FeatureToggle - public boolean enabled = true; + public boolean enabled = false; @Expose @ConfigOption(name = "Show Outside Mining Islands", desc = "Shows the event tracker when you are not inside of the Dwarven Mines or Crystal Hollows.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index fcee78dc43e3..514cea176e7e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -2,6 +2,7 @@ import at.hannibal2.skyhanni.api.SkillAPI; import at.hannibal2.skyhanni.data.MaxwellAPI; +import at.hannibal2.skyhanni.data.item.SkyhanniItems; import at.hannibal2.skyhanni.data.model.ComposterUpgrade; import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker; import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostData; @@ -251,10 +252,10 @@ public static class GardenStorage { public Map toolWithBountiful = new HashMap<>(); @Expose - public NEUInternalName composterCurrentOrganicMatterItem = NEUInternalName.Companion.getNONE(); + public NEUInternalName composterCurrentOrganicMatterItem = SkyhanniItems.NONE.invoke(); @Expose - public NEUInternalName composterCurrentFuelItem = NEUInternalName.Companion.getNONE(); + public NEUInternalName composterCurrentFuelItem = SkyhanniItems.NONE.invoke(); @Expose public int uniqueVisitors = 0; diff --git a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt index f7a730a651d5..28f1e254b3b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt @@ -1,10 +1,12 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object EventCounter { @@ -14,8 +16,15 @@ object EventCounter { private var map = mutableMapOf() private var lastUpdate = SimpleTimeMark.farPast() + private var enabled = false + + @SubscribeEvent + fun onSecondPassed(event: SecondPassedEvent) { + enabled = LorenzUtils.onHypixel && config.eventCounter + } + fun count(eventName: String) { - if (!isEnabled()) return + if (!enabled) return map.addOrPut(eventName, 1) @@ -42,6 +51,4 @@ object EventCounter { println("") println("total: ${total.addSeparators()}") } - - private fun isEnabled() = LorenzUtils.onHypixel && config.eventCounter } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 765a51e95447..af68cd84733e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -24,6 +24,7 @@ import net.minecraft.client.gui.inventory.GuiInventory import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.opengl.GL11 import java.util.UUID import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes @@ -54,7 +55,7 @@ class GuiEditManager { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { GlStateManager.color(1f, 1f, 1f, 1f) GlStateManager.enableBlend() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt index 498d87d10b87..2e6ff68962e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt @@ -1,16 +1,19 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.SackChangeEvent import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent +import at.hannibal2.skyhanni.features.inventory.SuperCraftFeatures.craftedPattern import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds @@ -23,9 +26,6 @@ class ItemAddManager { ; } - private val ARCHFIEND_DICE = "ARCHFIEND_DICE".asInternalName() - private val HIGH_CLASS_ARCHFIEND_DICE = "HIGH_CLASS_ARCHFIEND_DICE".asInternalName() - private val diceRollChatPattern by RepoPattern.pattern( "data.itemmanager.diceroll", "§eYour §r§(5|6High Class )Archfiend Dice §r§erolled a §r§.(?.)§r§e! Bonus: §r§.(?.*)❤" @@ -57,11 +57,12 @@ class ItemAddManager { for (sackChange in event.sackChanges) { val change = sackChange.delta - if (change > 0) { - val internalName = sackChange.internalName + val internalName = sackChange.internalName + if (change > 0 && internalName !in superCraftedItems) { Source.SACKS.addItem(internalName, change) } } + superCraftedItems.clear() } @SubscribeEvent @@ -69,7 +70,7 @@ class ItemAddManager { if (!LorenzUtils.inSkyBlock) return val internalName = event.internalName - if (internalName == ARCHFIEND_DICE || internalName == HIGH_CLASS_ARCHFIEND_DICE) { + if (internalName == SkyhanniItems.ARCHFIEND_DICE() || internalName == SkyhanniItems.HIGH_CLASS_ARCHFIEND_DICE()) { if (lastDiceRoll.passedSince() < 500.milliseconds) { return } @@ -83,11 +84,17 @@ class ItemAddManager { } private var lastDiceRoll = SimpleTimeMark.farPast() + private var superCraftedItems = TimeLimitedSet(30.seconds) @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (diceRollChatPattern.matches(event.message)) { lastDiceRoll = SimpleTimeMark.now() } + craftedPattern.matchMatcher(event.message) { + val internalName = NEUInternalName.fromItemName(group("item")) + if (!SackAPI.sackListInternalNames.contains(internalName.asString())) return@matchMatcher + superCraftedItems.add(internalName) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt index feafbb368ac3..75288c163062 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.ItemInHandChangeEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -11,7 +12,6 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraft.client.Minecraft import net.minecraft.network.play.server.S29PacketSoundEffect @@ -82,12 +82,12 @@ object MinecraftData { fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return val hand = McPlayer.heldItem - val newItem = hand?.getInternalName() ?: NEUInternalName.NONE + val newItem = hand?.getInternalName() ?: SkyhanniItems.NONE() val oldItem = InventoryUtils.itemInHandId if (newItem != oldItem) { InventoryUtils.recentItemsInHand.keys.removeIf { it + 30_000 > System.currentTimeMillis() } - if (newItem != NEUInternalName.NONE) { + if (newItem != SkyhanniItems.NONE()) { InventoryUtils.recentItemsInHand[System.currentTimeMillis()] = newItem } InventoryUtils.itemInHandId = newItem @@ -98,7 +98,7 @@ object MinecraftData { @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { - InventoryUtils.itemInHandId = NEUInternalName.NONE + InventoryUtils.itemInHandId = SkyhanniItems.NONE() InventoryUtils.recentItemsInHand.clear() } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt index cfe08927e349..776580602d95 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt @@ -37,7 +37,7 @@ object OtherInventoryData { } @SubscribeEvent - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onInventoryDataReceiveEvent(event: PacketEvent.ReceiveEvent) { val packet = event.packet if (packet is S2EPacketCloseWindow) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt index edcc00c9ee46..b10792424942 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt @@ -38,7 +38,7 @@ class OwnInventoryData { ) @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onItemPickupReceivePacket(event: PacketEvent.ReceiveEvent) { if (!LorenzUtils.inSkyBlock) return val packet = event.packet diff --git a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt index dad26d1c558c..b0b1ed1aa032 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.ArrowTypeJson import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -56,7 +57,6 @@ object QuiverAPI { private var hasBow = false const val MAX_ARROW_AMOUNT = 2880 - private val SKELETON_MASTER_CHESTPLATE = "SKELETON_MASTER_CHESTPLATE".asInternalName() var NONE_ARROW_TYPE: ArrowType? = null private var FLINT_ARROW_TYPE: ArrowType? = null @@ -262,7 +262,7 @@ object QuiverAPI { private fun checkChestplate() { val wasWearing = wearingSkeletonMasterChestplate wearingSkeletonMasterChestplate = - McPlayer.chestplate?.getInternalName() == SKELETON_MASTER_CHESTPLATE + McPlayer.chestplate?.getInternalName() == SkyhanniItems.SKELETON_MASTER_CHESTPLATE() if (wasWearing != wearingSkeletonMasterChestplate) { QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() } @@ -286,8 +286,8 @@ object QuiverAPI { val arrowData = event.getConstant("ArrowTypes") arrows = arrowData.arrows.map { ArrowType(it.value.arrow, it.key.asInternalName()) } - NONE_ARROW_TYPE = getArrowByNameOrNull("NONE".asInternalName()) - FLINT_ARROW_TYPE = getArrowByNameOrNull("ARROW".asInternalName()) + NONE_ARROW_TYPE = getArrowByNameOrNull(SkyhanniItems.NONE()) + FLINT_ARROW_TYPE = getArrowByNameOrNull(SkyhanniItems.ARROW()) } class UnknownArrowType(message: String) : Exception(message) diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index df9d6fea1b99..d82c882f0924 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.features.inventory.SackDisplayConfig.PriceFrom +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuSacksJson import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -140,7 +141,7 @@ object SackAPI { lore.matchAll(gemstonePattern) { val rarity = group("gemrarity") val stored = group("stored").formatInt() - gem.internalName = gemstoneMap[name.removeColor()] ?: NEUInternalName.NONE + gem.internalName = gemstoneMap[name.removeColor()] ?: SkyhanniItems.NONE() if (gemstoneMap.containsKey(name.removeColor())) { val internalName = "${rarity.uppercase()}_${ name.uppercase().split(" ")[0].removeColor() @@ -212,7 +213,7 @@ object SackAPI { val filletPerTrophy = FishingAPI.getFilletPerTrophy(stack.getInternalName()) val filletValue = filletPerTrophy * stored item.magmaFish = filletValue - "MAGMA_FISH".asInternalName().sackPrice(filletValue) + SkyhanniItems.MAGMA_FISH().sackPrice(filletValue) } else { internalName.sackPrice(stored).coerceAtLeast(0) } @@ -347,7 +348,7 @@ object SackAPI { } data class SackGemstone( - var internalName: NEUInternalName = NEUInternalName.NONE, + var internalName: NEUInternalName = SkyhanniItems.NONE(), var rough: Int = 0, var flawed: Int = 0, var fine: Int = 0, @@ -364,7 +365,7 @@ object SackAPI { ) : AbstractSackItem() data class SackOtherItem( - var internalName: NEUInternalName = NEUInternalName.NONE, + var internalName: NEUInternalName = SkyhanniItems.NONE(), var colorCode: String = "", var total: Int = 0, var magmaFish: Int = 0, @@ -404,18 +405,18 @@ data class SackItem( // TODO repo private val gemstoneMap = mapOf( - "Jade Gemstones" to "ROUGH_JADE_GEM".asInternalName(), - "Amber Gemstones" to "ROUGH_AMBER_GEM".asInternalName(), - "Topaz Gemstones" to "ROUGH_TOPAZ_GEM".asInternalName(), - "Sapphire Gemstones" to "ROUGH_SAPPHIRE_GEM".asInternalName(), - "Amethyst Gemstones" to "ROUGH_AMETHYST_GEM".asInternalName(), - "Jasper Gemstones" to "ROUGH_JASPER_GEM".asInternalName(), - "Ruby Gemstones" to "ROUGH_RUBY_GEM".asInternalName(), - "Opal Gemstones" to "ROUGH_OPAL_GEM".asInternalName(), - "Onyx Gemstones" to "ROUGH_ONYX_GEM".asInternalName(), - "Aquamarine Gemstones" to "ROUGH_AQUAMARINE_GEM".asInternalName(), - "Citrine Gemstones" to "ROUGH_CITRINE_GEM".asInternalName(), - "Peridot Gemstones" to "ROUGH_PERIDOT_GEM".asInternalName(), + "Jade Gemstones" to SkyhanniItems.ROUGH_JADE_GEM(), + "Amber Gemstones" to SkyhanniItems.ROUGH_AMBER_GEM(), + "Topaz Gemstones" to SkyhanniItems.ROUGH_TOPAZ_GEM(), + "Sapphire Gemstones" to SkyhanniItems.ROUGH_SAPPHIRE_GEM(), + "Amethyst Gemstones" to SkyhanniItems.ROUGH_AMETHYST_GEM(), + "Jasper Gemstones" to SkyhanniItems.ROUGH_JASPER_GEM(), + "Ruby Gemstones" to SkyhanniItems.ROUGH_RUBY_GEM(), + "Opal Gemstones" to SkyhanniItems.ROUGH_OPAL_GEM(), + "Onyx Gemstones" to SkyhanniItems.ROUGH_ONYX_GEM(), + "Aquamarine Gemstones" to SkyhanniItems.ROUGH_AQUAMARINE_GEM(), + "Citrine Gemstones" to SkyhanniItems.ROUGH_CITRINE_GEM(), + "Peridot Gemstones" to SkyhanniItems.ROUGH_PERIDOT_GEM(), ) // ideally should be correct but using alright should also be fine unless they sold their whole sacks diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index 66c3587ba074..72bc96988101 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -1,10 +1,12 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.RawScoreboardUpdateEvent import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.mc.McWorld +import net.minecraft.network.play.server.S3BPacketScoreboardObjective import net.minecraft.scoreboard.Score import net.minecraft.scoreboard.ScorePlayerTeam import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -66,8 +68,19 @@ class ScoreboardData { var objectiveTitle = "" } + var dirty = false + + @SubscribeEvent(receiveCanceled = true) + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { + if (event.packet is S3BPacketScoreboardObjective) { + dirty = true + } + } + @SubscribeEvent(priority = EventPriority.HIGHEST) fun onTick(event: LorenzTickEvent) { + if (!dirty) return + dirty = false val list = fetchScoreboardLines().reversed() val semiFormatted = list.map { cleanSB(it) } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt index 869ff784bb0d..c4af58e0eb5e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt @@ -12,6 +12,7 @@ import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager import net.minecraft.network.play.server.S45PacketTitle import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.opengl.GL11 import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -78,7 +79,7 @@ object TitleManager { val height = scaledResolution.scaledHeight GlStateManager.enableBlend() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) val renderer = Minecraft.getMinecraft().fontRendererObj GlStateManager.pushMatrix() diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt index c19fa4a42fde..023589e0f090 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt @@ -96,7 +96,7 @@ class PlayerChatManager { */ private val privateIslandRankPattern by patternGroup.pattern( "privateislandrank", - "(?.*?)(?§.\\[(?!MVP(§.\\++)?§.]|VIP\\+*|YOU§.TUBE|ADMIN|MOD|GM)[^]]+\\])(?.*)" + "(?.*?)(?§.\\[(?!MVP(§.\\++)?§.]|VIP\\+*|YOU§.TUBE|ADMIN|MOD|GM)[^]]+\\]) (?.*)" ) /** diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt index 035a166bbc8c..b5108c6acec0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt @@ -13,8 +13,10 @@ import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.features.misc.compacttablist.AdvancedPlayerList +import at.hannibal2.skyhanni.utils.ChatUtils.changeColor import at.hannibal2.skyhanni.utils.ComponentMatcherUtils.matchStyledMatcher import at.hannibal2.skyhanni.utils.ComponentSpan +import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.applyFormattingFrom @@ -140,7 +142,10 @@ class PlayerNameFormatter { level = event.levelComponent ) ) - appendSibling(event.action.intoComponent()) + + appendText(" ") + appendSibling(event.action.intoComponent().changeColor(LorenzColor.GRAY)) + appendText(" ") appendSibling(event.item.intoComponent()) }) ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/data/item/SkyhanniItems.kt b/src/main/java/at/hannibal2/skyhanni/data/item/SkyhanniItems.kt new file mode 100644 index 000000000000..6d62a190e893 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/item/SkyhanniItems.kt @@ -0,0 +1,186 @@ +package at.hannibal2.skyhanni.data.item + +import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName + +enum class SkyhanniItems(private var id: String? = null, private var tier: Int? = null) { + ADVANCED_GARDENING_AXE, + ADVANCED_GARDENING_HOE, + ANCESTRAL_SPADE, + ARCHFIEND_DICE, + ARCHITECT_FIRST_DRAFT, + ARROW, + ASCENSION_ROPE, + BLUE_STAINED_GLASS("STAINED_GLASS-11"), + BOOKWORM_BOOK, + BOOK_OF_STATS, + BOX_OF_SEEDS, + BUCKET, + CACTUS, + CACTUS_GREEN("INK_SACK-2"), + CACTUS_KNIFE, + CHICKEN_HEAD, + COMPOST, + CONJURING_SWORD, + CROPIE_TALISMAN, + CRYPT_DREADLORD_SWORD, + DYE_WILD_STRAWBERRY, + EARTH_SHARD, + EGGLOCATOR, + EMPTY_ODONATA_BOTTLE, + ENCHANTED_BROWN_MUSHROOM, + ENCHANTED_CACTUS_GREEN, + ENCHANTED_COOKIE, + ENCHANTED_ENDER_PEARL, + ENCHANTED_ENDSTONE, + ENCHANTED_GOLDEN_CARROT, + ENCHANTED_MELON, + ENCHANTED_OBSIDIAN, + ENCHANTED_PUMPKIN, + ENCHANTED_RED_MUSHROOM, + ENDERMAN, + ENDER_GAUNTLET, + ENDER_NECKLACE, + ENDER_PEARL, + ENDSTONE_GEODE, + END_BOOTS, + END_CHESTPLATE, + END_HELMET, + END_LEGGINGS, + END_STONE_SHULKER, + ETHERWARP_CONDUIT, + ETHERWARP_MERGER, + FARMING_FOR_DUMMIES, + FARMING_WAND, + FERMENTO_ARTIFACT, + FIFTH_MASTER_STAR, + FIRE_VEIL_WAND, + FIRST_MASTER_STAR, + FOURTH_MASTER_STAR, + FUMING_POTATO_BOOK, + GOLDEN_CARROT, + GOLDEN_DRAGON, + GOLD_PICKAXE, + GRAND_EXP_BOTTLE, + GREEN_THUMB, + HEAVY_PEARL, + HELIX, + HIGH_CLASS_ARCHFIEND_DICE, + HOT_POTATO_BOOK, + ICE_SPRAY_WAND, + INFERNO_GENERATOR_1, + INFINI_VACUUM, + INFINI_VACUUM_HOOVERIUS, + JACOBS_TICKET, + JALAPENO_BOOK, + KISMET_FEATHER, + KUUDRA_BURNING_TIER_KEY, + KUUDRA_FIERY_TIER_KEY, + KUUDRA_HOT_TIER_KEY, + KUUDRA_INFERNAL_TIER_KEY, + KUUDRA_TIER_KEY, + LARVA_HOOK, + LEATHER, + LIME_STAINED_GLASS("STAINED_GLASS-5"), + MAGIC_RUNE, + MAGMA_FISH, + MANA_DISINTEGRATOR, + MAP, + MISSING_ITEM, + MITE_GEL, + NETHER_STALK, + NEW_BOTTLE_OF_JYRRE, + NEW_YEAR_CAKE, + NONE, + ORANGE_STAINED_GLASS("STAINED_GLASS-1"), + PAPER, + PEST_BEETLE_MONSTER, + PEST_CRICKET_MONSTER, + PEST_EARTHWORM_MONSTER, + PEST_FLY_MONSTER, + PEST_LOCUST_MONSTER, + PEST_MITE_MONSTER, + PEST_MOSQUITO_MONSTER, + PEST_MOTH_MONSTER, + PEST_RAT_MONSTER, + PEST_SLUG_MONSTER, + PINK_STAINED_GLASS("STAINED_GLASS-6"), + PLASMA, + POLARVOID_BOOK, + PUMPKIN, + PURPLE_STAINED_GLASS("STAINED_GLASS-10"), + RABBIT_HIDE, + RACING_HELMET, + RANCHERS_BOOTS, + RECOMBOBULATOR_3000, + RED_MUSHROOM, + RED_STAINED_GLASS("STAINED_GLASS-14"), + REFINED_BOTTLE_OF_JYRRE, + REVENANT_GENERATOR_1, + ROUGH_AMBER_GEM, + ROUGH_AMETHYST_GEM, + ROUGH_AQUAMARINE_GEM, + ROUGH_CITRINE_GEM, + ROUGH_JADE_GEM, + ROUGH_JASPER_GEM, + ROUGH_ONYX_GEM, + ROUGH_OPAL_GEM, + ROUGH_PERIDOT_GEM, + ROUGH_RUBY_GEM, + ROUGH_SAPPHIRE_GEM, + ROUGH_TOPAZ_GEM, + SECOND_MASTER_STAR, + SEEDS, + SHADOW_FURY, + SHRIMP_THE_FISH, + SILENT_DEATH, + SIL_EX, + SKELETON_MASTER_CHESTPLATE, + SKYBLOCK_COIN, + SKYBLOCK_ENIGMA_SOUL, + SKYMART_HYPER_VACUUM, + SKYMART_TURBO_VACUUM, + SKYMART_VACUUM, + SORROW, + SQUASH_RING, + STARRED_SHADOW_FURY, + STONK_PICKAXE, + SUPERBOOM_TNT, + SUSPICIOUS_SCRAP, + TARANTULA_GENERATOR_1, + THE_ART_OF_PEACE, + THE_ART_OF_WAR, + THIRD_MASTER_STAR, + TITANIC_EXP_BOTTLE, + TRANSMISSION_TUNER, + TURBOMAX_VACUUM, + ULTIMATE_REITERATE, + VAMPIRE_GENERATOR_1, + VOIDLING_GENERATOR_1, + VOLTA, + VOODOO_DOLL_WILTED, + WEIRDER_TUBA, + WEIRD_TUBA, + WHEAT, + WHITE_STAINED_GLASS("STAINED_GLASS"), + WISP_POTION, + WIZARD_PORTAL_MEMENTO, + WOOD_SINGULARITY, + ZOMBIE_COMMANDER_WHIP, + ZOMBIE_KNIGHT_SWORD, + ZOMBIE_SOLDIER_CUTLASS, + ; + + // TODO make it work with items with a dash in their name + + private val baseItem by lazy { (id ?: name).asInternalName() } + operator fun invoke() = baseItem + + private val internalName get() = "$name;$tier" + private val item get() = internalName.asInternalName() + + operator fun invoke(tier: Int): NEUInternalName { + this.tier = tier + return item + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt index 68f42f43b81d..7c695c7eec2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ReceiveParticleEvent.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import net.minecraft.util.EnumParticleTypes import net.minecraftforge.fml.common.eventhandler.Cancelable @@ -18,4 +19,16 @@ class ReceiveParticleEvent( LorenzEvent() { val distanceToPlayer by lazy { location.distanceToPlayer() } + + override fun toString(): String { + return "ReceiveParticleEvent(type='$type', location=${location.round(1)}, count=$count, speed=$speed, offset=${ + offset.round( + 1 + ) + }, longDistance=$longDistance, particleArgs=${particleArgs.contentToString()}, distanceToPlayer=${ + distanceToPlayer.roundTo( + 1 + ) + })" + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt index 2793c8ca2486..77aed2b34a75 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.features.bingo.card.goals.GoalType import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matches -import at.hannibal2.skyhanni.utils.datetime.TimeUtils +import at.hannibal2.skyhanni.utils.datetime.DateUtils import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.time.LocalTime @@ -95,7 +95,7 @@ object BingoAPI { } private fun getStartOfMonthInMillis() = OffsetDateTime.of( - TimeUtils.getCurrentLocalDate().plusDays(5).withDayOfMonth(1), + DateUtils.now.plusDays(5).withDayOfMonth(1), LocalTime.MIDNIGHT, ZoneOffset.UTC ).toEpochSecond() diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index a50c28fcf2b7..590b7775e2e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -156,11 +157,11 @@ class MinionCraftHelper { for (internalId in NEUItems.allNeuRepoItems().keys) { val internalName = internalId.asInternalName() if (internalName.endsWith("_GENERATOR_1")) { - if (internalName == "REVENANT_GENERATOR_1".asInternalName() || - internalName == "TARANTULA_GENERATOR_1".asInternalName() || - internalName == "VOIDLING_GENERATOR_1".asInternalName() || - internalName == "INFERNO_GENERATOR_1".asInternalName() || - internalName == "VAMPIRE_GENERATOR_1".asInternalName() + if (internalName == SkyhanniItems.REVENANT_GENERATOR_1() || + internalName == SkyhanniItems.TARANTULA_GENERATOR_1() || + internalName == SkyhanniItems.VOIDLING_GENERATOR_1() || + internalName == SkyhanniItems.INFERNO_GENERATOR_1() || + internalName == SkyhanniItems.VAMPIRE_GENERATOR_1() ) continue tierOneMinions.add(internalName) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt new file mode 100644 index 000000000000..c589922cf4be --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt @@ -0,0 +1,45 @@ +package at.hannibal2.skyhanni.features.combat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.StringUtils.matchFirst +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class FerocityDisplay { + private val config get() = SkyHanniMod.feature.combat.ferocityDisplay + + /** + * REGEX-TEST: Ferocity: §r§c⫽14 + */ + private val ferocityPattern by RepoPattern.pattern( + "combat.ferocity.tab", + " Ferocity: §r§c⫽(?.*)" + ) + + private var display = "" + + @SubscribeEvent + fun onTabListUpdate(event: TabListUpdateEvent) { + if (!isEnabled()) return + display = "" + val stat = event.tabList.matchFirst(ferocityPattern) { + group("stat") + } ?: return + + display = "§c⫽$stat" + + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent) { + if (!isEnabled()) return + + config.position.renderString(display, posLabel = "Ferocity Display") + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNode.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNode.kt index bdfb97833e46..8839c8bd69bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNode.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNode.kt @@ -1,33 +1,33 @@ package at.hannibal2.skyhanni.features.combat.endernodetracker +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName enum class EnderNode( val internalName: NEUInternalName, val displayName: String, ) { - ENCHANTED_ENDSTONE("ENCHANTED_ENDSTONE".asInternalName(), "§aEnchanted End Stone"), - ENCHANTED_OBSIDIAN("ENCHANTED_OBSIDIAN".asInternalName(), "§aEnchanted Obsidian"), - ENCHANTED_ENDER_PEARL("ENCHANTED_ENDER_PEARL".asInternalName(), "§aEnchanted Ender Pearl"), - GRAND_EXP_BOTTLE("GRAND_EXP_BOTTLE".asInternalName(), "§aGrand Experience Bottle"), - TITANIC_EXP_BOTTLE("TITANIC_EXP_BOTTLE".asInternalName(), "§9Titanic Experience Bottle"), - END_STONE_SHULKER("END_STONE_SHULKER".asInternalName(), "§9End Stone Shulker"), - ENDSTONE_GEODE("ENDSTONE_GEODE".asInternalName(), "§9End Stone Geode"), - MAGIC_RUNE("MAGIC_RUNE;1".asInternalName(), "§d◆ Magical Rune I"), - ENDER_GAUNTLET("ENDER_GAUNTLET".asInternalName(), "§5Ender Gauntlet"), - MITE_GEL("MITE_GEL".asInternalName(), "§5Mite Gel"), - SHRIMP_THE_FISH("SHRIMP_THE_FISH".asInternalName(), "§cShrimp the Fish"), + ENCHANTED_ENDSTONE(SkyhanniItems.ENCHANTED_ENDSTONE(), "§aEnchanted End Stone"), + ENCHANTED_OBSIDIAN(SkyhanniItems.ENCHANTED_OBSIDIAN(), "§aEnchanted Obsidian"), + ENCHANTED_ENDER_PEARL(SkyhanniItems.ENCHANTED_ENDER_PEARL(), "§aEnchanted Ender Pearl"), + GRAND_EXP_BOTTLE(SkyhanniItems.GRAND_EXP_BOTTLE(), "§aGrand Experience Bottle"), + TITANIC_EXP_BOTTLE(SkyhanniItems.TITANIC_EXP_BOTTLE(), "§9Titanic Experience Bottle"), + END_STONE_SHULKER(SkyhanniItems.END_STONE_SHULKER(), "§9End Stone Shulker"), + ENDSTONE_GEODE(SkyhanniItems.ENDSTONE_GEODE(), "§9End Stone Geode"), + MAGIC_RUNE(SkyhanniItems.MAGIC_RUNE(1), "§d◆ Magical Rune I"), + ENDER_GAUNTLET(SkyhanniItems.ENDER_GAUNTLET(), "§5Ender Gauntlet"), + MITE_GEL(SkyhanniItems.MITE_GEL(), "§5Mite Gel"), + SHRIMP_THE_FISH(SkyhanniItems.SHRIMP_THE_FISH(), "§cShrimp the Fish"), - END_HELMET("END_HELMET".asInternalName(), "§5Ender Helmet"), - END_CHESTPLATE("END_CHESTPLATE".asInternalName(), "§5Ender Chestplate"), - END_LEGGINGS("END_LEGGINGS".asInternalName(), "§5Ender Leggings"), - END_BOOTS("END_BOOTS".asInternalName(), "§5Ender Boots"), - ENDER_NECKLACE("ENDER_NECKLACE".asInternalName(), "§5Ender Necklace"), - COMMON_ENDERMAN_PET("ENDERMAN;0".asInternalName(), "§fEnderman"), - UNCOMMON_ENDERMAN_PET("ENDERMAN;1".asInternalName(), "§aEnderman"), - RARE_ENDERMAN_PET("ENDERMAN;2".asInternalName(), "§9Enderman"), - EPIC_ENDERMAN_PET("ENDERMAN;3".asInternalName(), "§5Enderman"), - LEGENDARY_ENDERMAN_PET("ENDERMAN;4".asInternalName(), "§6Enderman") + END_HELMET(SkyhanniItems.END_HELMET(), "§5Ender Helmet"), + END_CHESTPLATE(SkyhanniItems.END_CHESTPLATE(), "§5Ender Chestplate"), + END_LEGGINGS(SkyhanniItems.END_LEGGINGS(), "§5Ender Leggings"), + END_BOOTS(SkyhanniItems.END_BOOTS(), "§5Ender Boots"), + ENDER_NECKLACE(SkyhanniItems.ENDER_NECKLACE(), "§5Ender Necklace"), + COMMON_ENDERMAN_PET(SkyhanniItems.ENDERMAN(0), "§fEnderman"), + UNCOMMON_ENDERMAN_PET(SkyhanniItems.ENDERMAN(1), "§aEnderman"), + RARE_ENDERMAN_PET(SkyhanniItems.ENDERMAN(2), "§9Enderman"), + EPIC_ENDERMAN_PET(SkyhanniItems.ENDERMAN(3), "§5Enderman"), + LEGENDARY_ENDERMAN_PET(SkyhanniItems.ENDERMAN(4), "§6Enderman") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index c4534c335193..390d75cabc79 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterCon import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.SkillExperience +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.ActionBarUpdateEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -42,7 +43,6 @@ import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble import at.hannibal2.skyhanni.utils.NumberUtil.formatLong @@ -114,9 +114,6 @@ object GhostCounter { private var currentSkill = "" private var currentSkillLevel = -1 private const val CONFIG_VALUE_VERSION = 1 - private val SORROW = "SORROW".asInternalName() - private val PLASMA = "PLASMA".asInternalName() - private val VOLTA = "VOLTA".asInternalName() @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { @@ -262,10 +259,10 @@ object GhostCounter { addAsSingletonList(etaFormatting.base.formatText(eta).formatText(killETA)) val rate = 0.12 * (1 + (avgMagicFind.toDouble() / 100)) - val sorrowValue = SORROW.getBazaarData()?.sellOfferPrice?.toLong() ?: 0L + val sorrowValue = SkyhanniItems.SORROW().getBazaarData()?.sellOfferPrice?.toLong() ?: 0L val final: String = (killInterp * sorrowValue * (rate / 100)).toLong().addSeparators() - val plasmaValue = PLASMA.getBazaarData()?.sellOfferPrice?.toLong() ?: 0L - val voltaValue = VOLTA.getBazaarData()?.sellOfferPrice?.toLong() ?: 0L + val plasmaValue = SkyhanniItems.PLASMA().getBazaarData()?.sellOfferPrice?.toLong() ?: 0L + val voltaValue = SkyhanniItems.VOLTA().getBazaarData()?.sellOfferPrice?.toLong() ?: 0L var moneyMade: Long = 0 val priceMap = listOf( Triple("Sorrow", Option.SORROWCOUNT.getInt(), sorrowValue), diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt index 4a6fdf2ea1bf..a847a1e5dd81 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt @@ -80,7 +80,7 @@ class SpawnTimers { // All this to detect "quickspawn" vs regular arachne spawn @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!saveNextTickParticles) return if (searchTime.passedSince() < 3.seconds) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt index a8a4406179bc..b5d2e16e5c5f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage.DungeonStorage.DungeonRunInfo import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacks +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.DungeonCompleteEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -19,7 +20,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.StringUtils.anyMatches @@ -54,8 +54,6 @@ class CroesusChestTracker { private val frontArrowSlotId = 53 private val backArrowSlotId = 45 - private val kismetInternalName = "KISMET_FEATHER".asInternalName() - private var inCroesusInventory = false private var croesusEmpty = false private var currentPage = 0 @@ -242,7 +240,8 @@ class CroesusChestTracker { private fun getKismetUsed(runIndex: Int) = getRun0(runIndex)?.kismetUsed ?: false - private fun getKismetAmount() = kismetInternalName.getAmountInSacks() + kismetInternalName.getAmountInInventory() + private fun getKismetAmount() = + SkyhanniItems.KISMET_FEATHER().getAmountInSacks() + SkyhanniItems.KISMET_FEATHER().getAmountInInventory() private fun croesusSlotMapToRun(slotId: Int) = when (slotId) { in 10..16 -> slotId - 10 // 0 - 6 diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt index 29d3f8d11d02..d01b1690654a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt @@ -2,11 +2,11 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacks +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -26,8 +26,6 @@ class DungeonArchitectFeatures { "§4\\[STATUE] Oruo the Omniscient§r§f: (?:§.)*(?\\S*) (?:§.)*chose the wrong .*" ) - private val architectsFirstDraftItem = "ARCHITECT_FIRST_DRAFT".asInternalName() - @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!isEnabled()) return @@ -41,7 +39,7 @@ class DungeonArchitectFeatures { } private fun generateMessage(name: String, event: LorenzChatEvent) { - val architectItemAmount = architectsFirstDraftItem.getAmountInSacks() + val architectItemAmount = SkyhanniItems.ARCHITECT_FIRST_DRAFT().getAmountInSacks() if (architectItemAmount <= 0) return ChatUtils.clickableChat( diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt index 470f0cd5c021..e7e0f1cc112d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaAPI.kt @@ -3,16 +3,16 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.Perk import at.hannibal2.skyhanni.data.PetAPI +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraft.item.ItemStack object DianaAPI { - private val spade by lazy { "ANCESTRAL_SPADE".asInternalName() } + private val spade = SkyhanniItems.ANCESTRAL_SPADE() fun hasSpadeInHand() = InventoryUtils.itemInHandId == spade diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index d64e637dff2e..79e5162ace2c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -56,7 +56,7 @@ object GriffinBurrowParticleFinder { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!isEnabled()) return if (!config.burrowsSoopyGuess) return val packet = event.packet diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt index 4548521c5492..4fa522fd057f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.event.hoppity +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -9,7 +10,6 @@ import at.hannibal2.skyhanni.utils.DisplayTableEntry import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables @@ -212,13 +212,13 @@ object HoppityCollectionStats { val chocolateMultiplier: Double, val item: NEUInternalName, ) { - COMMON("§fCommon", 1, 0.002, "STAINED_GLASS".asInternalName()), - UNCOMMON("§aUncommon", 2, 0.003, "STAINED_GLASS-5".asInternalName()), - RARE("§9Rare", 4, 0.004, "STAINED_GLASS-11".asInternalName()), - EPIC("§5Epic", 10, 0.005, "STAINED_GLASS-10".asInternalName()), - LEGENDARY("§6Legendary", 0, 0.02, "STAINED_GLASS-1".asInternalName()), - MYTHIC("§dMythic", 0, 0.0, "STAINED_GLASS-6".asInternalName()), - TOTAL("§cTotal", 0, 0.0, "STAINED_GLASS-14".asInternalName()), + COMMON("§fCommon", 1, 0.002, SkyhanniItems.WHITE_STAINED_GLASS()), + UNCOMMON("§aUncommon", 2, 0.003, SkyhanniItems.LIME_STAINED_GLASS()), + RARE("§9Rare", 4, 0.004, SkyhanniItems.BLUE_STAINED_GLASS()), + EPIC("§5Epic", 10, 0.005, SkyhanniItems.PURPLE_STAINED_GLASS()), + LEGENDARY("§6Legendary", 0, 0.02, SkyhanniItems.ORANGE_STAINED_GLASS()), + MYTHIC("§dMythic", 0, 0.0, SkyhanniItems.PINK_STAINED_GLASS()), + TOTAL("§cTotal", 0, 0.0, SkyhanniItems.RED_STAINED_GLASS()), ; companion object { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index 3c4761ebc8b3..e48b71ba6e54 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.event.hoppity import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.ItemClickEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -16,7 +17,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import at.hannibal2.skyhanni.utils.RecalculatingValue import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine @@ -33,7 +33,7 @@ import kotlin.time.Duration.Companion.seconds object HoppityEggLocator { private val config get() = HoppityEggsManager.config - private val locatorItem = "EGGLOCATOR".asInternalName() + private val locatorItem = SkyhanniItems.EGGLOCATOR() private var lastParticlePosition: LorenzVec? = null private var lastParticlePositionForever: LorenzVec? = null @@ -253,7 +253,7 @@ object HoppityEggLocator { private val ItemStack.isLocatorItem get() = getInternalName() == locatorItem - fun hasLocatorInHotbar() = RecalculatingValue(1.seconds) { + private fun hasLocatorInHotbar() = RecalculatingValue(1.seconds) { LorenzUtils.inSkyBlock && McPlayer.has(locatorItem, onlyHotBar = true) }.getValue() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index c8cb944f2f1c..ca6d638e7304 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -14,12 +14,16 @@ import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow +import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.now import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.datetime.SkyBlockTime import at.hannibal2.skyhanni.utils.datetime.TimeUtils.format +import at.hannibal2.skyhanni.utils.mc.McSound +import at.hannibal2.skyhanni.utils.mc.McSound.play import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Matcher import kotlin.time.Duration.Companion.seconds @@ -57,6 +61,10 @@ object HoppityEggsManager { private var lastMeal: HoppityEggType? = null private var lastNote: String? = null + // has claimed all eggs at least once + private var warningActive = false + private var lastWarnTime = SimpleTimeMark.farPast() + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { lastMeal = null @@ -145,7 +153,7 @@ object HoppityEggsManager { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return if (!config.showClaimedEggs) return - if (ReminderUtils.isBusy(config.showDuringContest)) return + if (isBuzy()) return if (!ChocolateFactoryAPI.isHoppityEvent()) return val displayList = HoppityEggType.entries @@ -160,8 +168,35 @@ object HoppityEggsManager { @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { HoppityEggType.checkClaimed() + checkWarn() } + private fun checkWarn() { + if (!warningActive) { + warningActive = HoppityEggType.entries.all { it.isClaimed() } + } + + if (warningActive) { + if (HoppityEggType.entries.all { !it.isClaimed() }) { + warn() + } + } + } + + private fun warn() { + if (!config.warnUnclaimedEggs) return + if (isBuzy()) return + if (lastWarnTime.passedSince() < 30.seconds) return + + lastWarnTime = now() + val amount = HoppityEggType.entries.size + ChatUtils.chat("All $amount Hoppity Eggs are ready to be found.!") + LorenzUtils.sendTitle("§e$amount Hoppity Eggs!", 5.seconds) + McSound.PLING.play() + } + + private fun isBuzy() = ReminderUtils.isBusy(config.showDuringContest) + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt index 08c8942701fe..b8b79b990539 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt @@ -1,12 +1,12 @@ package at.hannibal2.skyhanni.features.event.winter import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.addItemIcon import at.hannibal2.skyhanni.utils.RenderUtils.renderSingleLineWithItems @@ -33,6 +33,7 @@ class JyrreTimer { } private fun resetDisplay() { + if (display.isEmpty()) return display = if (config.showInactive) drawDisplay() else emptyList() duration = 0.seconds } @@ -61,7 +62,7 @@ class JyrreTimer { display = drawDisplay() } - private val displayIcon by lazy { "REFINED_BOTTLE_OF_JYRRE".asInternalName().getItemStack() } + private val displayIcon by lazy { SkyhanniItems.REFINED_BOTTLE_OF_JYRRE().getItemStack() } fun drawDisplay(): MutableList { duration -= 1.seconds diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index 60f3e098405b..61b2c68e3303 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -7,17 +7,19 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.getLorenzVec import at.hannibal2.skyhanni.utils.mc.McPlayer import net.minecraft.entity.Entity import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class ChumBucketHider { private val config get() = SkyHanniMod.feature.fishing.chumBucketHider - private val titleEntity = mutableListOf() - private val hiddenEntities = mutableListOf() + private val titleEntity = TimeLimitedSet(5.seconds) + private val hiddenEntities = TimeLimitedSet(5.seconds) @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { @@ -51,7 +53,7 @@ class ChumBucketHider { // Second text line if (name.contains("/10 §aChums")) { val entityLocation = entity.getLorenzVec() - for (title in titleEntity) { + for (title in titleEntity.toSet()) { if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { hiddenEntities.add(entity) event.isCanceled = true @@ -63,7 +65,7 @@ class ChumBucketHider { // Chum Bucket if (config.hideBucket.get() && entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket") }) { val entityLocation = entity.getLorenzVec() - for (title in titleEntity) { + for (title in titleEntity.toSet()) { if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { hiddenEntities.add(entity) event.isCanceled = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index 6c80621cda02..c4b919582807 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing.tracker import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.FishingProfitItemsJson import at.hannibal2.skyhanni.events.FishingBobberCastEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -16,7 +17,6 @@ import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatInt @@ -80,7 +80,7 @@ object FishingProfitTracker { val neuInternalNames = itemCategories["Trophy Fish"]!! return if (internalName in neuInternalNames) { - SkyHanniTracker.getPricePer(MAGMA_FISH) * FishingAPI.getFilletPerTrophy(internalName) + SkyHanniTracker.getPricePer(SkyhanniItems.MAGMA_FISH()) * FishingAPI.getFilletPerTrophy(internalName) } else super.getCustomPricePer(internalName) } @@ -90,8 +90,6 @@ object FishingProfitTracker { private val ItemTrackerData.TrackedItem.timesCaught get() = timesGained - private val MAGMA_FISH by lazy { "MAGMA_FISH".asInternalName() } - private val nameAll: CategoryName = "All" private var currentCategory: CategoryName = nameAll diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index b9bee537eb2e..9093cae899ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -1,12 +1,12 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getFilletValue import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -28,7 +28,7 @@ class TrophyFishFillet { val multiplier = if (Keyboard.KEY_LSHIFT.isKeyHeld()) event.itemStack.stackSize else 1 val filletValue = info.getFilletValue(rarity) * multiplier // TODO use magma fish member - val filletPrice = filletValue * "MAGMA_FISH".asInternalName().getPrice() + val filletPrice = filletValue * SkyhanniItems.MAGMA_FISH().getPrice() event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${NumberUtil.format(filletPrice)}§7)") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index 586bb19a47d5..7cc86392a1f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -16,7 +17,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables @@ -129,7 +129,7 @@ class AnitaMedalProfit { } private fun getFullCost(requiredItems: MutableList): Double { - val jacobTicketPrice = "JACOBS_TICKET".asInternalName().getPrice() + val jacobTicketPrice = SkyhanniItems.JACOBS_TICKET().getPrice() var otherItemsPrice = 0.0 for (rawItemName in requiredItems) { val pair = ItemUtils.readItemAmount(rawItemName) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt index c11c2640d72b..fca8820f5453 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName enum class CropAccessory( val internalName: NEUInternalName?, @@ -12,17 +12,17 @@ enum class CropAccessory( NONE(null, emptySet(), 0.0, null), CROPIE( - "CROPIE_TALISMAN".asInternalName(), + SkyhanniItems.CROPIE_TALISMAN(), setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT), 10.0, Pair("CROPIE", 256) ), SQUASH( - "SQUASH_RING".asInternalName(), + SkyhanniItems.SQUASH_RING(), setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT, CropType.COCOA_BEANS, CropType.MELON, CropType.PUMPKIN), 20.0, Pair("SQUASH", 128) ), - FERMENTO("FERMENTO_ARTIFACT".asInternalName(), CropType.entries.toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)), + FERMENTO(SkyhanniItems.FERMENTO_ARTIFACT(), CropType.entries.toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)), ; fun getFortune(cropType: CropType): Double { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index c6f26f31854c..ab8617762fed 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -100,7 +100,7 @@ object GardenNextJacobContest { return } - event.addData { + event.addIrrelevant { add("Current time: ${SimpleTimeMark.now()}") add("") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index ea1d40f5c168..f6ebfb187931 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils @@ -30,7 +31,7 @@ class ComposterDisplay { private var display = emptyList>() private var composterEmptyTime: Duration? = null - private val bucket by lazy { "BUCKET".asInternalName().getItemStack() } + private val bucket by lazy { SkyhanniItems.BUCKET().getItemStack() } private var tabListData by ComposterAPI::tabListData enum class DataType(rawPattern: String, val icon: String) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index e3da49c31ac9..424b9821f934 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.OverlayPriceTypeEntry import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.RetrieveFromEntry import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacksOrNull +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import at.hannibal2.skyhanni.data.model.ComposterUpgrade import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -31,7 +32,6 @@ import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.NONE import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStack @@ -104,8 +104,6 @@ object ComposterOverlay { ChatUtils.chat("Composter test offset set to $testOffset.") } - private val COMPOST by lazy { "COMPOST".asInternalName() } - @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { inInventory = false @@ -189,10 +187,11 @@ object ComposterOverlay { ) return } - if (currentOrganicMatterItem.let { it !in organicMatterFactors.keys && it != NONE }) { - currentOrganicMatterItem = NONE + if (currentOrganicMatterItem.let { it !in organicMatterFactors.keys && it != SkyhanniItems.NONE() }) { + currentOrganicMatterItem = SkyhanniItems.NONE() } - if (currentFuelItem.let { it !in fuelFactors.keys && it != NONE }) currentFuelItem = NONE + if (currentFuelItem.let { it !in fuelFactors.keys && it != SkyhanniItems.NONE() }) currentFuelItem = + SkyhanniItems.NONE() if (inComposter) { organicMatterDisplay = drawOrganicMatterDisplay() @@ -269,7 +268,7 @@ object ComposterOverlay { currentOrganicMatterItem = it update() } - if (currentOrganicMatterItem == NONE) { + if (currentOrganicMatterItem == SkyhanniItems.NONE()) { currentOrganicMatterItem = fillList update() } @@ -290,7 +289,7 @@ object ComposterOverlay { currentFuelItem = it update() } - if (currentFuelItem == NONE) { + if (currentFuelItem == SkyhanniItems.NONE()) { currentFuelItem = fillList update() } @@ -301,7 +300,7 @@ object ComposterOverlay { private fun addExtraData(newList: MutableList>) { val organicMatterItem = currentOrganicMatterItem ?: return val fuelItem = currentFuelItem ?: return - if (organicMatterItem == NONE || fuelItem == NONE) return + if (organicMatterItem == SkyhanniItems.NONE() || fuelItem == SkyhanniItems.NONE()) return newList.addSelector( "§7Per ", @@ -373,7 +372,7 @@ object ComposterOverlay { " §7Material costs per $timeText: §6${NumberUtil.format(totalCost)}$materialCostFormatPreview" newList.addAsSingletonList(materialCostFormat) - val priceCompost = COMPOST.getPrice() + val priceCompost = SkyhanniItems.COMPOST().getPrice() val profit = ((priceCompost * multiDropFactor) - (fuelPricePer + organicMatterPricePer)) * timeMultiplier val profitPreview = ((priceCompost * multiDropFactorPreview) - (fuelPricePerPreview + organicMatterPricePerPreview)) * timeMultiplierPreview diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index c81f83a57d4b..209a44a5514c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent @@ -58,7 +59,7 @@ object CropMoneyDisplay { private val cropNames = mutableMapOf() private val toolHasBountiful get() = GardenAPI.storage?.toolWithBountiful - private val BOX_OF_SEEDS by lazy { "BOX_OF_SEEDS".asInternalName().getItemStack() } + private val BOX_OF_SEEDS by lazy { SkyhanniItems.BOX_OF_SEEDS().getItemStack() } @SubscribeEvent fun onProfileJoin(event: ProfileJoinEvent) { @@ -127,8 +128,8 @@ object CropMoneyDisplay { toolHasBountiful?.put(it, reforgeName == "bountiful") if (GardenAPI.mushroomCowPet && it != CropType.MUSHROOM && config.mooshroom) { - val redMushroom = "ENCHANTED_RED_MUSHROOM".asInternalName() - val brownMushroom = "ENCHANTED_BROWN_MUSHROOM".asInternalName() + val redMushroom = SkyhanniItems.ENCHANTED_RED_MUSHROOM() + val brownMushroom = SkyhanniItems.ENCHANTED_BROWN_MUSHROOM() val (redPrice, brownPrice) = if (LorenzUtils.noTradeMode) { val redPrice = (redMushroom.getNpcPriceOrNull() ?: 160.0) / 160 val brownPrice = (brownMushroom.getNpcPriceOrNull() ?: 160.0) / 160 @@ -147,8 +148,8 @@ object CropMoneyDisplay { val itemInHand = McPlayer.heldItem?.getInternalName() if (itemInHand?.contains("DICER") == true && config.dicer) { val (dicerDrops, internalName) = when (it) { - CropType.MELON -> GardenCropSpeed.latestMelonDicer to "ENCHANTED_MELON".asInternalName() - CropType.PUMPKIN -> GardenCropSpeed.latestPumpkinDicer to "ENCHANTED_PUMPKIN".asInternalName() + CropType.MELON -> GardenCropSpeed.latestMelonDicer to SkyhanniItems.ENCHANTED_MELON() + CropType.PUMPKIN -> GardenCropSpeed.latestPumpkinDicer to SkyhanniItems.ENCHANTED_PUMPKIN() else -> ErrorManager.skyHanniError( "Unknown dicer detected.", @@ -360,7 +361,7 @@ object CropMoneyDisplay { debugList.addAsSingletonList(" added seedsPerHour: $seedsPerHour") } val factor = NEUItems.getPrimitiveMultiplier(internalName).amount - npcPrice += "SEEDS".asInternalName().getNpcPrice() * seedsPerHour / factor + npcPrice += SkyhanniItems.SEEDS().getNpcPrice() * seedsPerHour / factor sellOffer += it.sellOfferPrice * seedsPerHour instantSell += it.instantBuyPrice * seedsPerHour } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 98eab50e534e..f971c752b7a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -216,8 +216,15 @@ object GardenCropMilestoneDisplay { } } - val format = (farmingFortuneSpeed * 60).addSeparators() - lineMap[MilestoneTextEntry.CROPS_PER_MINUTE] = Renderable.string("§7Crops/Minute§8: §e$format") + val secondFormat = (farmingFortuneSpeed).addSeparators() + lineMap[MilestoneTextEntry.CROPS_PER_SECOND] = Renderable.string("§7Crops/Second§8: §e$secondFormat") + + val minuteFormat = (farmingFortuneSpeed * 60).addSeparators() + lineMap[MilestoneTextEntry.CROPS_PER_MINUTE] = Renderable.string("§7Crops/Minute§8: §e$minuteFormat") + + val hourFormat = (farmingFortuneSpeed * 60 * 60).addSeparators() + lineMap[MilestoneTextEntry.CROPS_PER_HOUR] = Renderable.string("§7Crops/Hour§8: §e$hourFormat") + val formatBps = speed.roundTo(config.blocksBrokenPrecision).addSeparators() lineMap[MilestoneTextEntry.BLOCKS_PER_SECOND] = Renderable.string("§7Blocks/Second§8: §e$formatBps") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt index c1743abc8665..1e9eef21db5d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.farming +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -8,7 +9,6 @@ import at.hannibal2.skyhanni.utils.ItemBlink import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.mc.McSound import at.hannibal2.skyhanni.utils.mc.McSound.play @@ -19,8 +19,6 @@ class WildStrawberryDyeNotification { private var lastCloseTime = SimpleTimeMark.farPast() - val item by lazy { "DYE_WILD_STRAWBERRY".asInternalName() } - @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { lastCloseTime = SimpleTimeMark.now() @@ -36,7 +34,7 @@ class WildStrawberryDyeNotification { val itemStack = event.itemStack val internalName = itemStack.getInternalName() - if (internalName == item) { + if (internalName == SkyhanniItems.DYE_WILD_STRAWBERRY()) { val name = itemStack.name LorenzUtils.sendTitle(name, 5.seconds) ChatUtils.chat("You found a $name§e!") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt index 3dee4368246d..ef96437b0063 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.UpgradePage import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.datetime.DateUtils import at.hannibal2.skyhanni.utils.mc.McSound import at.hannibal2.skyhanni.utils.mc.McSound.play import at.hannibal2.skyhanni.utils.system.OS @@ -28,7 +28,7 @@ open class FFGuideGUI : GuiScreen() { private var firefoxTrials = 0 fun open() { - if (LorenzUtils.isAprilFoolsDay) { + if (DateUtils.isAprilFools()) { when (firefoxTrials) { 0 -> { ChatUtils.chat("Are you looking for the FF browser?", prefix = false) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index 65f8630b6438..d7b12a3ca09a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.garden.inventory +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.AnitaUpgradeCostsJson import at.hannibal2.skyhanni.data.jsonobjects.repo.AnitaUpgradePrice import at.hannibal2.skyhanni.events.LorenzToolTipEvent @@ -7,7 +8,6 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.CollectionUtils.indexOfFirst import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -60,7 +60,7 @@ class AnitaExtraFarmingFortune { // TODO: maybe only show the price when playing classic // if (!LorenzUtils.noTradeMode) { - val price = jacobTickets * "JACOBS_TICKET".asInternalName().getPrice() + val price = jacobTickets * SkyhanniItems.JACOBS_TICKET().getPrice() event.toolTip.add(index, " §7Price: §6${NumberUtil.format(price)} coins") // } event.toolTip.add(index, "§aJacob Tickets §8x${jacobTickets.addSeparators()}") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt index 35bb364a21a5..1cf21eb4cdc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.pests import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -24,7 +25,6 @@ import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchFirst @@ -50,11 +50,11 @@ object PestAPI { var lastPestKillTime = SimpleTimeMark.farPast() val vacuumVariants = listOf( - "SKYMART_VACUUM".asInternalName(), - "SKYMART_TURBO_VACUUM".asInternalName(), - "SKYMART_HYPER_VACUUM".asInternalName(), - "INFINI_VACUUM".asInternalName(), - "INFINI_VACUUM_HOOVERIUS".asInternalName(), + SkyhanniItems.SKYMART_VACUUM(), + SkyhanniItems.SKYMART_TURBO_VACUUM(), + SkyhanniItems.SKYMART_HYPER_VACUUM(), + SkyhanniItems.INFINI_VACUUM(), + SkyhanniItems.INFINI_VACUUM_HOOVERIUS(), ) fun hasVacuumInHand() = InventoryUtils.itemInHandId in vacuumVariants @@ -121,28 +121,27 @@ object PestAPI { var firstScoreboardCheck = false private fun fixPests(loop: Int = 2) { - val accurateAmount = getPlotsWithAccuratePests().sumOf { it.pests } - val inaccurateAmount = getPlotsWithInaccuratePests().size - if (scoreboardPests == accurateAmount + inaccurateAmount) { // if we can assume all inaccurate plots have 1 pest each - for (plot in getPlotsWithInaccuratePests()) { - plot.pests = 1 + DelayedRun.runDelayed(2.seconds) { + val accurateAmount = getPlotsWithAccuratePests().sumOf { it.pests } + val inaccurateAmount = getPlotsWithInaccuratePests().size + if (scoreboardPests == accurateAmount + inaccurateAmount) { // if we can assume all inaccurate plots have 1 pest each + for (plot in getPlotsWithInaccuratePests()) { + plot.pests = 1 + plot.isPestCountInaccurate = false + } + } else if (inaccurateAmount == 1) { // if we can assume all the inaccurate pests are in the only inaccurate plot + val plot = getPlotsWithInaccuratePests().firstOrNull() ?: return@runDelayed + plot.pests = scoreboardPests - accurateAmount plot.isPestCountInaccurate = false - } - } else if (inaccurateAmount == 1) { // if we can assume all the inaccurate pests are in the only inaccurate plot - val plot = getPlotsWithInaccuratePests().firstOrNull() ?: return - plot.pests = scoreboardPests - accurateAmount - plot.isPestCountInaccurate = false - } else if (accurateAmount + inaccurateAmount > scoreboardPests) { // when logic fails and we reach impossible pest counts - getInfestedPlots().forEach { - it.pests = 0 - it.isPestCountInaccurate = true - } - if (loop > 0) { - DelayedRun.runDelayed(2.seconds) { - fixPests(loop - 1) + } else if (accurateAmount + inaccurateAmount > scoreboardPests) { // when logic fails and we reach impossible pest counts + getInfestedPlots().forEach { + it.pests = 0 + it.isPestCountInaccurate = true } + if (loop > 0) { + fixPests(loop - 1) + } else sendPestError() } - else sendPestError() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt index 3525b5e44265..f7e751621913 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.features.garden.pests +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.features.combat.damageindicator.BossType import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName enum class PestType( val displayName: String, @@ -18,7 +18,7 @@ enum class PestType( BossType.GARDEN_PEST_BEETLE, SprayType.DUNG, VinylType.NOT_JUST_A_PEST, - "PEST_BEETLE_MONSTER".asInternalName(), + SkyhanniItems.PEST_BEETLE_MONSTER(), CropType.NETHER_WART, ), CRICKET( @@ -26,7 +26,7 @@ enum class PestType( BossType.GARDEN_PEST_CRICKET, SprayType.HONEY_JAR, VinylType.CRICKET_CHOIR, - "PEST_CRICKET_MONSTER".asInternalName(), + SkyhanniItems.PEST_CRICKET_MONSTER(), CropType.CARROT, ), EARTHWORM( @@ -34,7 +34,7 @@ enum class PestType( BossType.GARDEN_PEST_EARTHWORM, SprayType.COMPOST, VinylType.EARTHWORM_ENSEMBLE, - "PEST_EARTHWORM_MONSTER".asInternalName(), + SkyhanniItems.PEST_EARTHWORM_MONSTER(), CropType.MELON, ), FLY( @@ -42,7 +42,7 @@ enum class PestType( BossType.GARDEN_PEST_FLY, SprayType.DUNG, VinylType.PRETTY_FLY, - "PEST_FLY_MONSTER".asInternalName(), + SkyhanniItems.PEST_FLY_MONSTER(), CropType.WHEAT, ), LOCUST( @@ -50,7 +50,7 @@ enum class PestType( BossType.GARDEN_PEST_LOCUST, SprayType.PLANT_MATTER, VinylType.CICADA_SYMPHONY, - "PEST_LOCUST_MONSTER".asInternalName(), + SkyhanniItems.PEST_LOCUST_MONSTER(), CropType.POTATO, ), MITE( @@ -58,7 +58,7 @@ enum class PestType( BossType.GARDEN_PEST_MITE, SprayType.TASTY_CHEESE, VinylType.DYNAMITES, - "PEST_MITE_MONSTER".asInternalName(), + SkyhanniItems.PEST_MITE_MONSTER(), CropType.CACTUS, ), MOSQUITO( @@ -66,7 +66,7 @@ enum class PestType( BossType.GARDEN_PEST_MOSQUITO, SprayType.COMPOST, VinylType.BUZZIN_BEATS, - "PEST_MOSQUITO_MONSTER".asInternalName(), + SkyhanniItems.PEST_MOSQUITO_MONSTER(), CropType.SUGAR_CANE, ), MOTH( @@ -74,7 +74,7 @@ enum class PestType( BossType.GARDEN_PEST_MOTH, SprayType.HONEY_JAR, VinylType.WINGS_OF_HARMONY, - "PEST_MOTH_MONSTER".asInternalName(), + SkyhanniItems.PEST_MOTH_MONSTER(), CropType.COCOA_BEANS, ), RAT( @@ -82,7 +82,7 @@ enum class PestType( BossType.GARDEN_PEST_RAT, SprayType.TASTY_CHEESE, VinylType.RODENT_REVOLUTION, - "PEST_RAT_MONSTER".asInternalName(), + SkyhanniItems.PEST_RAT_MONSTER(), CropType.COCOA_BEANS, ), SLUG( @@ -90,7 +90,7 @@ enum class PestType( BossType.GARDEN_PEST_SLUG, SprayType.PLANT_MATTER, VinylType.SLOW_AND_GROOVY, - "PEST_SLUG_MONSTER".asInternalName(), + SkyhanniItems.PEST_SLUG_MONSTER(), CropType.MUSHROOM, ), ; diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index d93a5adec2e1..f6e75b5fa4bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.features.garden.visitor.VisitorConfig.Highli import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacks import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacksOrNull +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -40,7 +41,6 @@ import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NEUItems.getPrice @@ -99,7 +99,7 @@ object GardenVisitorFeatures { private val logger = LorenzLogger("garden/visitors") private var lastFullPrice = 0.0 - private val greenThumb = "GREEN_THUMB;1".asInternalName() + private val greenThumb = SkyhanniItems.GREEN_THUMB(1) @SubscribeEvent fun onProfileJoin(event: ProfileJoinEvent) { @@ -601,7 +601,7 @@ object GardenVisitorFeatures { return } - event.addData { + event.addIrrelevant { val visitors = VisitorAPI.getVisitors() add("visitors: ${visitors.size}") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt index 8fe8bee3c41f..709b486abaa0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacks +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorOpenEvent @@ -30,7 +31,7 @@ class GardenVisitorSupercraft { private var lastSuperCraftMaterial = "" private val superCraftItem by lazy { - val neuItem = "GOLD_PICKAXE".asInternalName().getItemStack() + val neuItem = SkyhanniItems.GOLD_PICKAXE().getItemStack() Utils.createItemStack( neuItem.item, "§bSuper Craft", diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index c89abec543b4..c3889ab71a18 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -38,12 +38,36 @@ import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.pluralize import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.datetime.SkyBlockTime import at.hannibal2.skyhanni.utils.datetime.TimeUtils.format import at.hannibal2.skyhanni.utils.datetime.TimeUtils.formatted import java.util.function.Supplier +import kotlin.time.Duration.Companion.milliseconds + +internal var confirmedUnknownLines = mutableListOf() +internal var unconfirmedUnknownLines = listOf() +internal var unknownLinesSet = TimeLimitedSet(500.milliseconds) { onRemoval(it) } + +private fun onRemoval(line: String) { + if (!unconfirmedUnknownLines.contains(line)) return + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { it == line } + confirmedUnknownLines.add(line) + if (!config.unknownLinesWarning) return + val pluralize = pluralize(confirmedUnknownLines.size, "unknown line", withNumber = true) + val message = "CustomScoreboard detected $pluralize" + ErrorManager.logErrorWithData( + CustomScoreboardUtils.UndetectedScoreboardLines(message), + message, + "Unknown Lines" to confirmedUnknownLines, + "Island" to HypixelData.skyBlockIsland, + "Area" to HypixelData.skyBlockArea, + "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, + noStackTrace = true, + betaOnly = true, + ) +} -internal var unknownLines = listOf() internal var amountOfUnknownLines = 0 enum class ScoreboardElement( @@ -773,30 +797,15 @@ private fun getFooterDisplayPair(): List = ).flatten() private fun getExtraDisplayPair(): List { - if (unknownLines.isEmpty()) return listOf("" to HorizontalAlignment.LEFT) - - val size = unknownLines.size - if (amountOfUnknownLines != size && config.unknownLinesWarning) { - val message = "CustomScoreboard detected ${pluralize(unknownLines.size, "unknown line", withNumber = true)}" - ErrorManager.logErrorWithData( - CustomScoreboardUtils.UndetectedScoreboardLines(message), - message, - "Unknown Lines" to unknownLines, - "Island" to HypixelData.skyBlockIsland, - "Area" to HypixelData.skyBlockArea, - "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, - noStackTrace = true, - betaOnly = true, - ) - amountOfUnknownLines = size - } + if (confirmedUnknownLines.isEmpty()) return listOf("" to HorizontalAlignment.LEFT) + amountOfUnknownLines = confirmedUnknownLines.size - return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + unknownLines.map { it to HorizontalAlignment.LEFT } + return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + confirmedUnknownLines.map { it to HorizontalAlignment.LEFT } } private fun getExtraShowWhen(): Boolean { - if (unknownLines.isEmpty()) { + if (confirmedUnknownLines.isEmpty()) { amountOfUnknownLines = 0 } - return unknownLines.isNotEmpty() + return confirmedUnknownLines.isNotEmpty() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt index fdc2232bef27..84b6446fc621 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt @@ -297,10 +297,6 @@ object ScoreboardPattern { "essence", "^\\s*.*Essence: §.(?-?\\d+(:?,\\d{3})*(?:\\.\\d+)?)$" ) - val brokenRedstonePattern by miscSb.pattern( - "brokenredstone", - "\\s*(?:(?:§.)*⚡ (§.)*Redston|e: (?:§.)*\\d+%)\\s*" - ) val redstonePattern by miscSb.pattern( "redstone", "\\s*(§.)*⚡ §cRedstone: (§.)*\\d{1,3}%$" diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt index 7a82fb6abee6..95724c49d3e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.PurseAPI import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.misc.ServerRestartTitle import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeResets @@ -14,7 +15,7 @@ object UnknownLinesHandler { fun handleUnknownLines() { val sidebarLines = ScoreboardData.sidebarLinesFormatted - unknownLines = sidebarLines + unconfirmedUnknownLines = sidebarLines .map { it.removeResets() } .filter { it.isNotBlank() } .filter { it.trim().length > 3 } @@ -86,7 +87,6 @@ object UnknownLinesHandler { SbPattern.bossDamagePattern, SbPattern.slayerQuestPattern, SbPattern.essencePattern, - SbPattern.brokenRedstonePattern, SbPattern.redstonePattern, SbPattern.visitingPattern, SbPattern.flightDurationPattern, @@ -123,7 +123,7 @@ object UnknownLinesHandler { SbPattern.cluesPattern, ) - unknownLines = unknownLines.filterNot { line -> + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { line -> patternsToExclude.any { pattern -> pattern.matches(line) } } @@ -134,16 +134,16 @@ object UnknownLinesHandler { val objectiveLine = sidebarLines.firstOrNull { SbPattern.objectivePattern.matches(it) } ?: "Objective" - unknownLines = unknownLines.filter { sidebarLines.nextAfter(objectiveLine) != it } + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(objectiveLine) != it } // TODO create function - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(objectiveLine, 2) != it && !SbPattern.thirdObjectiveLinePattern.matches(it) } // Remove jacobs contest for (i in 1..3) - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.jacobsContestPattern.matches(line) } ?: "§eJacob's Contest", i) != it @@ -151,24 +151,43 @@ object UnknownLinesHandler { // Remove slayer for (i in 1..2) - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.slayerQuestPattern.matches(line) } ?: "Slayer Quest", i) != it } // remove trapper mob location - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.mobLocationPattern.matches(line) } ?: "Tracker Mob Location:") != it } // da - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.darkAuctionCurrentItemPattern.matches(line) } ?: "Current Item:") != it } + + + /* + * handle broken scoreboard lines + */ + confirmedUnknownLines.forEach { line -> + if (!unconfirmedUnknownLines.contains(line)) { + confirmedUnknownLines = confirmedUnknownLines.filterNot { it == line }.toMutableList() + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { it == line } + } + } + unconfirmedUnknownLines.forEach { line -> + if (confirmedUnknownLines.contains(line)) { + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { it == line } + } else if (!unknownLinesSet.contains(line)) { + ChatUtils.debug("Unknown Scoreboard line: '$line'") + unknownLinesSet.add(line) + } + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index d241d27b17c4..64fe2f2aa20b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson import at.hannibal2.skyhanni.data.jsonobjects.repo.SalvageFilter import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -29,7 +30,6 @@ import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.MultiFilter -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils.drawBorder import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -68,8 +68,6 @@ class HideNotClickableItems { "SEEDS|CARROT_ITEM|POTATO_ITEM|PUMPKIN_SEEDS|SUGAR_CANE|MELON_SEEDS|CACTUS|INK_SACK-3" ) - private val netherWart by lazy { "NETHER_STALK".asInternalName() } - @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { val hideNotClickable = event.getConstant("HideNotClickableItems") @@ -226,7 +224,7 @@ class HideNotClickableItems { // TODO add more special named fossils (hypixel why) val list = listOf( - "HELIX".asInternalName(), + SkyhanniItems.HELIX(), ) if (internalName in list) { @@ -419,7 +417,7 @@ class HideNotClickableItems { return true } - if (stack.getInternalName() == netherWart) return false + if (stack.getInternalName() == SkyhanniItems.NETHER_STALK()) return false hideReason = "This item is not a nether wart!" return true diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index d321f3c8b1a5..7d14cb28aefe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -22,6 +22,7 @@ import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumbe import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.SKILL_LEVEL import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.VACUUM_GARDEN import at.hannibal2.skyhanni.data.PetAPI +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.pests.PestAPI @@ -36,7 +37,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal @@ -94,11 +94,11 @@ object ItemDisplayOverlayFeatures { if (MASTER_STAR_TIER.isSelected()) { when (internalName) { - "FIRST_MASTER_STAR".asInternalName() -> return "1" - "SECOND_MASTER_STAR".asInternalName() -> return "2" - "THIRD_MASTER_STAR".asInternalName() -> return "3" - "FOURTH_MASTER_STAR".asInternalName() -> return "4" - "FIFTH_MASTER_STAR".asInternalName() -> return "5" + SkyhanniItems.FIRST_MASTER_STAR() -> return "1" + SkyhanniItems.SECOND_MASTER_STAR() -> return "2" + SkyhanniItems.THIRD_MASTER_STAR() -> return "3" + SkyhanniItems.FOURTH_MASTER_STAR() -> return "4" + SkyhanniItems.FIFTH_MASTER_STAR() -> return "5" } } @@ -120,7 +120,7 @@ object ItemDisplayOverlayFeatures { } } - if (NEW_YEAR_CAKE.isSelected() && internalName == "NEW_YEAR_CAKE".asInternalName()) { + if (NEW_YEAR_CAKE.isSelected() && internalName == SkyhanniItems.NEW_YEAR_CAKE()) { val year = item.getNewYearCake()?.toString() ?: "" return "§b$year" } @@ -149,11 +149,11 @@ object ItemDisplayOverlayFeatures { if (KUUDRA_KEY.isSelected() && itemName.contains("Kuudra Key")) { return when (internalName) { - "KUUDRA_TIER_KEY".asInternalName() -> "§a1" - "KUUDRA_HOT_TIER_KEY".asInternalName() -> "§22" - "KUUDRA_BURNING_TIER_KEY".asInternalName() -> "§e3" - "KUUDRA_FIERY_TIER_KEY".asInternalName() -> "§64" - "KUUDRA_INFERNAL_TIER_KEY".asInternalName() -> "§c5" + SkyhanniItems.KUUDRA_TIER_KEY() -> "§a1" + SkyhanniItems.KUUDRA_HOT_TIER_KEY() -> "§22" + SkyhanniItems.KUUDRA_BURNING_TIER_KEY() -> "§e3" + SkyhanniItems.KUUDRA_FIERY_TIER_KEY() -> "§64" + SkyhanniItems.KUUDRA_INFERNAL_TIER_KEY() -> "§c5" else -> "§4?" } } @@ -187,13 +187,13 @@ object ItemDisplayOverlayFeatures { } } - if (RANCHERS_BOOTS_SPEED.isSelected() && internalName == "RANCHERS_BOOTS".asInternalName()) { + if (RANCHERS_BOOTS_SPEED.isSelected() && internalName == SkyhanniItems.RANCHERS_BOOTS()) { item.getRanchersSpeed()?.let { val isUsingBlackCat = PetAPI.isCurrentPet("Black Cat") val helmet = McPlayer.helmet?.getInternalName() val hand = McPlayer.heldItem?.getInternalName() - val racingHelmet = "RACING_HELMET".asInternalName() - val cactusKnife = "CACTUS_KNIFE".asInternalName() + val racingHelmet = SkyhanniItems.RACING_HELMET() + val cactusKnife = SkyhanniItems.CACTUS_KNIFE() val is500 = isUsingBlackCat || helmet == racingHelmet || (GardenAPI.inGarden() && hand == cactusKnife) val effectiveSpeedCap = if (is500) 500 else 400 val text = if (it > 999) "1k" else "$it" @@ -201,7 +201,7 @@ object ItemDisplayOverlayFeatures { } } - if (LARVA_HOOK.isSelected() && internalName == "LARVA_HOOK".asInternalName()) { + if (LARVA_HOOK.isSelected() && internalName == SkyhanniItems.LARVA_HOOK()) { lore.matchFirst(harvestPattern) { val amount = group("amount").toInt() return when { @@ -239,7 +239,7 @@ object ItemDisplayOverlayFeatures { } } - if (BOTTLE_OF_JYRRE.isSelected() && internalName == "NEW_BOTTLE_OF_JYRRE".asInternalName()) { + if (BOTTLE_OF_JYRRE.isSelected() && internalName == SkyhanniItems.NEW_BOTTLE_OF_JYRRE()) { val seconds = item.getBottleOfJyrreSeconds() ?: 0 return "§a${(seconds / 3600)}" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index 7868d0440fcf..3f65e3a391e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.config.features.inventory.SackDisplayConfig.NumberF import at.hannibal2.skyhanni.config.features.inventory.SackDisplayConfig.PriceFormatEntry import at.hannibal2.skyhanni.config.features.inventory.SackDisplayConfig.SortingTypeEntry import at.hannibal2.skyhanni.data.SackAPI +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi @@ -19,7 +20,6 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -151,7 +151,7 @@ object SackDisplay { ) ) //TOOD add cache - addItemStack("MAGMA_FISH".asInternalName()) + addItemStack(SkyhanniItems.MAGMA_FISH()) } if (config.showPrice && price != 0L) addAlignedNumber("§6${format(price)}") }) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt index 9d3f921049d5..c95533184629 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt @@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SuperCraftFeatures { - private val craftedPattern by RepoPattern.pattern( +object SuperCraftFeatures { + val craftedPattern by RepoPattern.pattern( "inventory.supercrafting.craft.new", "§eYou Supercrafted §r§r§r§.(?[^§]+)(?:§r§8x(?[\\d,]+))?§r§e!" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt index 7082f6ebf229..e9821e441b53 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt @@ -1,9 +1,9 @@ package at.hannibal2.skyhanni.features.inventory.bazaar import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.system.OS @@ -20,7 +20,7 @@ class BazaarOpenPriceWebsite { private var lastClick = SimpleTimeMark.farPast() private val item by lazy { - val neuItem = "PAPER".asInternalName().getItemStack() + val neuItem = SkyhanniItems.PAPER().getItemStack() Utils.createItemStack( neuItem.item, "§bPrice History", diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt index fe6136fc414e..01fead2e707c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt @@ -126,8 +126,6 @@ object ChocolateFactoryAPI { var needed = goal val profileStorage = profileStorage ?: return Duration.ZERO - val updatedAgo = SimpleTimeMark(profileStorage.lastDataSave).passedSince().inWholeSeconds - val baseMultiplier = profileStorage.rawChocolateMultiplier val rawChocolatePerSecond = profileStorage.rawChocPerSecond val timeTowerMultiplier = baseMultiplier + profileStorage.timeTowerLevel * 0.1 @@ -140,7 +138,7 @@ object ChocolateFactoryAPI { val secondsAtRate = needed / timeTowerChocPerSecond if (secondsAtRate < secondsUntilTowerExpires) { - return secondsAtRate.seconds - updatedAgo.seconds + return secondsAtRate.seconds } needed -= (secondsUntilTowerExpires * timeTowerChocPerSecond).toLong() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt index 4ca62a1a6288..15c699fd5597 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.datetime.TimeUtils.format import at.hannibal2.skyhanni.utils.mc.McPlayer import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.system.OS @@ -56,6 +57,8 @@ object ChocolateFactoryStats { "§6${ChocolateFactoryTimeTowerManager.timeTowerCharges()}" } + val timeTowerFull = ChocolateFactoryTimeTowerManager.timeTowerFullTimemark() + val prestigeEstimate = ChocolateAmount.PRESTIGE.formattedTimeUntilGoal(ChocolateFactoryAPI.chocolateForPrestige) val chocolateUntilPrestigeCalculation = ChocolateFactoryAPI.chocolateForPrestige - ChocolateAmount.PRESTIGE.chocolate() @@ -91,6 +94,11 @@ object ChocolateFactoryStats { put(ChocolateFactoryStat.EMPTY_4, "") put(ChocolateFactoryStat.TIME_TOWER, "§eTime Tower: §6$timeTowerInfo") + put( + ChocolateFactoryStat.TIME_TOWER_FULL, + "§eFull Tower Charges: §b${timeTowerFull.timeUntil().format()}\n" + + "§bHappens at: ${timeTowerFull.formattedDate("EEEE, MMM d h:mm a")}" + ) put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Prestige: $prestigeEstimate") put( ChocolateFactoryStat.RAW_PER_SECOND, @@ -102,7 +110,7 @@ object ChocolateFactoryStats { ) put(ChocolateFactoryStat.TIME_TO_BEST_UPGRADE, "§eBest Upgrade: $upgradeAvailableAt") } - val text = config.statsDisplayList.filter { it.shouldDisplay() }.mapNotNull { map[it] } + val text = config.statsDisplayList.filter { it.shouldDisplay() }.flatMap { map[it]?.split("\n") ?: listOf() } display = listOf(Renderable.clickAndHover( Renderable.verticalContainer(text.map(Renderable::string)), @@ -143,6 +151,9 @@ object ChocolateFactoryStats { EMPTY_3(""), EMPTY_4(""), TIME_TOWER("§eTime Tower: §62/3 Charges", { ChocolateFactoryTimeTowerManager.currentCharges() != -1 }), + TIME_TOWER_FULL( + "§eTime Tower Full Charges: §b5h 13m 59s\n§bHappens at: Monday, May 13 5:32 AM", + { ChocolateFactoryTimeTowerManager.currentCharges() != -1 || ChocolateFactoryTimeTowerManager.timeTowerFull() }), TIME_TO_PRESTIGE("§eTime To Prestige: §b1d 13h 59m 4s", { ChocolateFactoryAPI.currentPrestige != 5 }), RAW_PER_SECOND("§eRaw Per Second: §62,136"), CHOCOLATE_UNTIL_PRESTIGE("§eChocolate To Prestige: §65,851", { ChocolateFactoryAPI.currentPrestige != 5 }), diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt index 7fab87d71a5b..4c2240bf159e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt @@ -98,6 +98,16 @@ object ChocolateFactoryTimeTowerManager { return endTime > currentTime } + fun timeTowerFullTimemark(): SimpleTimeMark { + val profileStorage = profileStorage ?: return SimpleTimeMark.farPast() + if (timeTowerFull()) return SimpleTimeMark.farPast() + val nextChargeDuration = SimpleTimeMark(profileStorage.nextTimeTower) + val remainingChargesAfter = profileStorage.maxTimeTowerUses - (profileStorage.currentTimeTowerUses + 1) + val endTime = nextChargeDuration + (profileStorage.timeTowerCooldown).hours * remainingChargesAfter + + return endTime + } + fun timeTowerActiveDuration(): Duration { if (!timeTowerActive()) return Duration.ZERO val currentTime = profileStorage?.lastDataSave ?: 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt index f9cd75f47937..6c22f31d91a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt @@ -1,13 +1,13 @@ package at.hannibal2.skyhanni.features.itemabilities import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.datetime.TimeUtils.format @@ -22,7 +22,7 @@ class ChickenHeadTimer { private var lastTime = SimpleTimeMark.farPast() private val cooldown = 5.seconds - private val chickenHead = "CHICKEN_HEAD".asInternalName() + private val chickenHead = SkyhanniItems.CHICKEN_HEAD() @SubscribeEvent fun onTick(event: LorenzTickEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt index 15f3f9da2af1..ffd013f41516 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.itemability.FireVeilWandConfig.DisplayEntry import at.hannibal2.skyhanni.data.ClickType +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.ItemClickEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -12,7 +13,6 @@ import at.hannibal2.skyhanni.utils.ColourUtils.toChromaColour import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft @@ -23,7 +23,6 @@ import kotlin.time.Duration.Companion.seconds class FireVeilWandParticles { private val config get() = SkyHanniMod.feature.inventory.itemAbilities.fireVeilWands - private val item by lazy { "FIRE_VEIL_WAND".asInternalName() } private var lastClick = SimpleTimeMark.farPast() @@ -45,7 +44,7 @@ class FireVeilWandParticles { if (AshfangFreezeCooldown.iscurrentlyFrozen()) return - if (internalName == item) { + if (internalName == SkyhanniItems.FIRE_VEIL_WAND()) { lastClick = SimpleTimeMark.now() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 9624dae57dfc..5a11873f0b63 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.itemabilities.abilitycooldown import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.ActionBarUpdateEvent import at.hannibal2.skyhanni.events.ItemClickEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -21,7 +22,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls @@ -57,9 +57,6 @@ class ItemAbilityCooldown { private var lastAbility = "" private var items = mapOf>() private var abilityItems = mapOf>() - private val WEIRD_TUBA = "WEIRD_TUBA".asInternalName() - private val WEIRDER_TUBA = "WEIRDER_TUBA".asInternalName() - private val VOODOO_DOLL_WILTED = "VOODOO_DOLL_WILTED".asInternalName() @SubscribeEvent fun onPlaySound(event: PlaySoundEvent) { @@ -89,8 +86,8 @@ class ItemAbilityCooldown { if (event.pitch == 1f && event.volume == 1f) { val internalName = McPlayer.heldItem?.getInternalName() ?: return if (!internalName.equalsOneOf( - "SHADOW_FURY".asInternalName(), - "STARRED_SHADOW_FURY".asInternalName() + SkyhanniItems.SHADOW_FURY(), + SkyhanniItems.STARRED_SHADOW_FURY(), ) ) return @@ -124,7 +121,7 @@ class ItemAbilityCooldown { // Jinxed Voodoo Doll Miss event.soundName == "mob.ghast.scream" && event.volume == 1.0f && event.pitch >= 1.6 && event.pitch <= 1.7 -> { val recentItems = InventoryUtils.recentItemsInHand.values - if (VOODOO_DOLL_WILTED in recentItems) { + if (SkyhanniItems.VOODOO_DOLL_WILTED() in recentItems) { ItemAbility.VOODOO_DOLL_WILTED.sound() } } @@ -135,10 +132,10 @@ class ItemAbilityCooldown { // Weird Tuba & Weirder Tuba event.soundName == "mob.wolf.howl" && event.volume == 0.5f -> { val recentItems = InventoryUtils.recentItemsInHand.values - if (WEIRD_TUBA in recentItems) { + if (SkyhanniItems.WEIRD_TUBA() in recentItems) { ItemAbility.WEIRD_TUBA.sound() } - if (WEIRDER_TUBA in recentItems) { + if (SkyhanniItems.WEIRDER_TUBA() in recentItems) { ItemAbility.WEIRDER_TUBA.sound() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt index 319d5b5dde15..29ea226b8804 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.mining import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -16,7 +17,6 @@ import at.hannibal2.skyhanni.utils.ColourUtils.toChromaColour import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.ParkourHelper import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent @@ -34,7 +34,7 @@ class DeepCavernsGuide { private var showStartIcon = false private val startIcon by lazy { - val neuItem = "MAP".asInternalName().getItemStack() + val neuItem = SkyhanniItems.MAP().getItemStack() Utils.createItemStack( neuItem.item, "§bDeep Caverns Guide", diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt index db2ad5a01c7c..10e5a365cd15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt @@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent -import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.LorenzUtils @@ -106,7 +105,6 @@ object MiningCommissionsBlocksColor { if (block.highlight != newValue) { if (newValue && block in ignoredTabListCommissions) continue block.highlight = newValue - ChatUtils.debug("changed from tab list: ${block.displayName} -> $newValue") dirty = true } } @@ -124,7 +122,6 @@ object MiningCommissionsBlocksColor { block.highlight = false dirty = true ignoredTabListCommissions.add(block) - ChatUtils.debug("finished from chat: $name") } } @@ -137,7 +134,9 @@ object MiningCommissionsBlocksColor { inCrystalHollows = IslandType.CRYSTAL_HOLLOWS.isInIsland() && HypixelData.skyBlockArea != "Crystal Nucleus" } - val newEnabled = (inDwarvenMines || inCrystalHollows || inGlaciteArea) && config.enabled + // TODO add dwarven mines support +// val newEnabled = (inDwarvenMines || inCrystalHollows || inGlaciteArea) && config.enabled + val newEnabled = (inCrystalHollows || inGlaciteArea) && config.enabled var reload = false if (newEnabled != enabled) { enabled = newEnabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt index faf275cc818d..5aaadd470bc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.MiningAPI.getCold import at.hannibal2.skyhanni.data.MiningAPI.inColdIsland import at.hannibal2.skyhanni.data.MiningAPI.lastColdReset +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.ColdUpdateEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -14,7 +15,6 @@ import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzUtils.runDelayed -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.makePrimitiveStack import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.mc.McSound @@ -26,7 +26,7 @@ import kotlin.time.Duration.Companion.seconds object MiningNotifications { - private val ASCENSION_ROPE = "ASCENSION_ROPE".asInternalName().makePrimitiveStack(1) + private val ASCENSION_ROPE = SkyhanniItems.ASCENSION_ROPE().makePrimitiveStack(1) enum class MiningNotificationList(val str: String, val notification: String) { MINESHAFT_SPAWN("§bGlacite Mineshaft", "§bMineshaft"), diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/FossilExcavatorAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/FossilExcavatorAPI.kt index 56b3242b938c..46d3cf4b2f36 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/FossilExcavatorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/FossilExcavatorAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.mining.fossilexcavator import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent @@ -10,7 +11,6 @@ import at.hannibal2.skyhanni.events.mining.FossilExcavationEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -48,7 +48,7 @@ object FossilExcavatorAPI { var inInventory = false var inExcavatorMenu = false - val scrapItem = "SUSPICIOUS_SCRAP".asInternalName() + val scrapItem = SkyhanniItems.SUSPICIOUS_SCRAP() @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 2e60c491d433..f5b4344f2a3d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -29,8 +29,8 @@ import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LocationUtils.canBeSeen import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec @@ -340,7 +340,7 @@ class MinionFeatures { val minions = minions ?: return for (minion in minions) { val location = minion.key.add(y = 1.0) - if (!location.canBeSeen()) continue + if (location.distanceToPlayer() > 50) continue val lastEmptied = minion.value.lastClicked if (playerLocation.distance(location) >= config.emptiedTime.distance) continue diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt index a42a4cacd265..156d9307e47c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt @@ -2,15 +2,14 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.CollectionAPI +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.ChatUtils -import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -165,8 +164,8 @@ object CollectionTracker { } private fun countCurrentlyInInventory(): Int { - val cactus = "CACTUS".asInternalName() - val cactusGreen = "INK_SACK-2".asInternalName() + val cactus = SkyhanniItems.CACTUS() + val cactusGreen = SkyhanniItems.CACTUS_GREEN() return McPlayer.countItems { if (internalName == cactus && it.getInternalName() == cactusGreen) { return@countItems true diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt index 7e266ca70aeb..0f94d7132735 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.hours @@ -12,13 +12,12 @@ import kotlin.time.Duration.Companion.hours class FixNEUHeavyPearls { private val config get() = SkyHanniMod.feature.misc - private val heavyPearl = "HEAVY_PEARL".asInternalName() @SubscribeEvent fun onItemAdd(event: ItemAddEvent) { if (!isEnabled()) return - if (event.internalName == heavyPearl && event.amount == 3) { + if (event.internalName == SkyhanniItems.HEAVY_PEARL() && event.amount == 3) { val specific = NotEnoughUpdates.INSTANCE.config.getProfileSpecific() if (System.currentTimeMillis() > specific.dailyHeavyPearlCompleted + 1.hours.inWholeMilliseconds) { ChatUtils.chat("Mark NEU Heavy Pearls as done.") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index 6cdba8e83bed..a045222a7a6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -218,7 +218,7 @@ class NonGodPotEffectDisplay { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { val packet = event.packet if (!checkFooter) return if (packet is S47PacketPlayerListHeaderFooter) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt index 7532c8afe99c..8bba37ed2371 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRecipientName import at.hannibal2.skyhanni.utils.StringUtils.anyMatches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -14,8 +14,6 @@ class RestorePieceOfWizardPortalLore { private val config get() = SkyHanniMod.feature.misc - private val item by lazy { "WIZARD_PORTAL_MEMENTO".asInternalName() } - private val earnedPattern by RepoPattern.pattern( "misc.restore.wizard.portal.earned", "§7Earned by:.*" @@ -25,7 +23,7 @@ class RestorePieceOfWizardPortalLore { fun onTooltip(event: LorenzToolTipEvent) { if (!config.restorePieceOfWizardPortalLore) return val stack = event.itemStack - if (stack.getInternalName() != item) return + if (stack.getInternalName() != SkyhanniItems.WIZARD_PORTAL_MEMENTO()) return if (earnedPattern.anyMatches(stack.getLore())) return val recipient = stack.getRecipientName() ?: return event.toolTip.add(5, "§7Earned by: $recipient") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 9fe25aa71ad8..1b99d44d3cba 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -80,7 +80,7 @@ class TpsCounter { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!config.tpsDisplay) return hasPacketReceived = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt index 69d7cf4155f2..9baa0e317621 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.utils.ChatUtils @@ -10,7 +11,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatLong @@ -43,7 +43,7 @@ class AuctionHouseCopyUnderbidPrice { val item = event.inventoryItems[13] ?: return val internalName = item.getInternalName() - if (internalName == NEUInternalName.NONE) return + if (internalName == SkyhanniItems.NONE()) return val price = internalName.getPrice().toLong() if (price <= 0) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index dcb9924690f7..bd06ae8d0e7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -222,7 +223,7 @@ object EstimatedItemValueCalculator { private fun addRecomb(stack: ItemStack, list: MutableList): Double { if (!stack.isRecombobulated()) return 0.0 - val price = "RECOMBOBULATOR_3000".asInternalName().getPrice() + val price = SkyhanniItems.RECOMBOBULATOR_3000().getPrice() list.add("§7Recombobulated: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -230,7 +231,7 @@ object EstimatedItemValueCalculator { private fun addJalapenoBook(stack: ItemStack, list: MutableList): Double { if (!stack.hasJalapenoBook()) return 0.0 - val price = "JALAPENO_BOOK".asInternalName().getPrice() + val price = SkyhanniItems.JALAPENO_BOOK().getPrice() list.add("§7Jalapeno Book: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -238,8 +239,8 @@ object EstimatedItemValueCalculator { private fun addEtherwarp(stack: ItemStack, list: MutableList): Double { if (!stack.hasEtherwarp()) return 0.0 - val wtfHardcodedConduit = "ETHERWARP_CONDUIT".asInternalName() - val wtfHardcodedMerger = "ETHERWARP_MERGER".asInternalName() + val wtfHardcodedConduit = SkyhanniItems.ETHERWARP_CONDUIT() + val wtfHardcodedMerger = SkyhanniItems.ETHERWARP_MERGER() val price = wtfHardcodedConduit.getPrice() + wtfHardcodedMerger.getPrice() list.add("§7Etherwarp: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price @@ -248,7 +249,7 @@ object EstimatedItemValueCalculator { private fun addWoodSingularity(stack: ItemStack, list: MutableList): Double { if (!stack.hasWoodSingularity()) return 0.0 - val price = "WOOD_SINGULARITY".asInternalName().getPrice() + val price = SkyhanniItems.WOOD_SINGULARITY().getPrice() list.add("§7Wood Singularity: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -256,7 +257,7 @@ object EstimatedItemValueCalculator { private fun addArtOfWar(stack: ItemStack, list: MutableList): Double { if (!stack.hasArtOfWar()) return 0.0 - val price = "THE_ART_OF_WAR".asInternalName().getPrice() + val price = SkyhanniItems.THE_ART_OF_WAR().getPrice() list.add("§7The Art of War: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -264,7 +265,7 @@ object EstimatedItemValueCalculator { private fun addStatsBook(stack: ItemStack, list: MutableList): Double { if (!stack.hasBookOfStats()) return 0.0 - val price = "BOOK_OF_STATS".asInternalName().getPrice() + val price = SkyhanniItems.BOOK_OF_STATS().getPrice() list.add("§7Book of Stats: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -273,7 +274,7 @@ object EstimatedItemValueCalculator { private fun addArtOfPeace(stack: ItemStack, list: MutableList): Double { if (!stack.hasArtOfPeace()) return 0.0 - val price = "THE_ART_OF_PEACE".asInternalName().getPrice() + val price = SkyhanniItems.THE_ART_OF_PEACE().getPrice() list.add("§7The Art Of Peace: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -293,13 +294,13 @@ object EstimatedItemValueCalculator { var totalPrice = 0.0 - val wtfHardcodedHpb = "HOT_POTATO_BOOK".asInternalName() + val wtfHardcodedHpb = SkyhanniItems.HOT_POTATO_BOOK() val hpbPrice = wtfHardcodedHpb.getPrice() * hpb list.add("§7HPB's: §e$hpb§7/§e10 §7(§6" + NumberUtil.format(hpbPrice) + "§7)") totalPrice += hpbPrice if (fuming > 0) { - val wtfHardcodedFuming = "FUMING_POTATO_BOOK".asInternalName() + val wtfHardcodedFuming = SkyhanniItems.FUMING_POTATO_BOOK() val fumingPrice = wtfHardcodedFuming.getPrice() * fuming list.add("§7Fuming: §e$fuming§7/§e5 §7(§6" + NumberUtil.format(fumingPrice) + "§7)") totalPrice += fumingPrice @@ -311,7 +312,7 @@ object EstimatedItemValueCalculator { private fun addFarmingForDummies(stack: ItemStack, list: MutableList): Double { val count = stack.getFarmingForDummiesCount() ?: return 0.0 - val wtfHardcodedDumbFarmers = "FARMING_FOR_DUMMIES".asInternalName() + val wtfHardcodedDumbFarmers = SkyhanniItems.FARMING_FOR_DUMMIES() val price = wtfHardcodedDumbFarmers.getPrice() * count list.add("§7Farming for Dummies: §e$count§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)") return price @@ -320,7 +321,7 @@ object EstimatedItemValueCalculator { private fun addPolarvoidBook(stack: ItemStack, list: MutableList): Double { val count = stack.getPolarvoidBookCount() ?: return 0.0 - val broDilloMiningSoBad = "POLARVOID_BOOK".asInternalName() + val broDilloMiningSoBad = SkyhanniItems.POLARVOID_BOOK() val price = broDilloMiningSoBad.getPrice() * count list.add("§7Polarvoid: §e$count§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)") return price @@ -329,7 +330,7 @@ object EstimatedItemValueCalculator { private fun addBookwormBook(stack: ItemStack, list: MutableList): Double { val count = stack.getBookwormBookCount() ?: return 0.0 - val tfHardcodedItemAgain = "BOOKWORM_BOOK".asInternalName() + val tfHardcodedItemAgain = SkyhanniItems.BOOKWORM_BOOK() val price = tfHardcodedItemAgain.getPrice() * count list.add("§7Bookworm's Favorite Book: §e$count§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)") return price @@ -339,9 +340,9 @@ object EstimatedItemValueCalculator { val tier = stack.getSilexCount() ?: return 0.0 val internalName = stack.getInternalName() - val maxTier = if (internalName == "STONK_PICKAXE".asInternalName()) 4 else 5 + val maxTier = if (internalName == SkyhanniItems.STONK_PICKAXE()) 4 else 5 - val wtfHardcodedSilex = "SIL_EX".asInternalName() + val wtfHardcodedSilex = SkyhanniItems.SIL_EX() val price = wtfHardcodedSilex.getPrice() * tier list.add("§7Silex: §e$tier§7/§e$maxTier §7(§6" + NumberUtil.format(price) + "§7)") return price @@ -350,7 +351,7 @@ object EstimatedItemValueCalculator { private fun addTransmissionTuners(stack: ItemStack, list: MutableList): Double { val count = stack.getTransmissionTunerCount() ?: return 0.0 - val wtfHardcodedTuner = "TRANSMISSION_TUNER".asInternalName() + val wtfHardcodedTuner = SkyhanniItems.TRANSMISSION_TUNER() val price = wtfHardcodedTuner.getPrice() * count list.add("§7Transmission Tuners: §e$count§7/§e4 §7(§6" + NumberUtil.format(price) + "§7)") return price @@ -359,7 +360,7 @@ object EstimatedItemValueCalculator { private fun addManaDisintegrators(stack: ItemStack, list: MutableList): Double { val count = stack.getManaDisintegrators() ?: return 0.0 - val wtfHardcodedTuner = "MANA_DISINTEGRATOR".asInternalName() + val wtfHardcodedTuner = SkyhanniItems.MANA_DISINTEGRATOR() val price = wtfHardcodedTuner.getPrice() * count list.add("§7Mana Disintegrators: §e$count§7/§e10 §7(§6" + NumberUtil.format(price) + "§7)") return price @@ -507,19 +508,19 @@ object EstimatedItemValueCalculator { // TODO repo private val hasAlwaysScavenger = listOf( - "CRYPT_DREADLORD_SWORD".asInternalName(), - "ZOMBIE_SOLDIER_CUTLASS".asInternalName(), - "CONJURING_SWORD".asInternalName(), - "EARTH_SHARD".asInternalName(), - "ZOMBIE_KNIGHT_SWORD".asInternalName(), - "SILENT_DEATH".asInternalName(), - "ZOMBIE_COMMANDER_WHIP".asInternalName(), - "ICE_SPRAY_WAND".asInternalName(), + SkyhanniItems.CRYPT_DREADLORD_SWORD(), + SkyhanniItems.ZOMBIE_SOLDIER_CUTLASS(), + SkyhanniItems.CONJURING_SWORD(), + SkyhanniItems.EARTH_SHARD(), + SkyhanniItems.ZOMBIE_KNIGHT_SWORD(), + SkyhanniItems.SILENT_DEATH(), + SkyhanniItems.ZOMBIE_COMMANDER_WHIP(), + SkyhanniItems.ICE_SPRAY_WAND(), ) private val hasAlwaysReplenish = listOf( - "ADVANCED_GARDENING_HOE".asInternalName(), - "ADVANCED_GARDENING_AXE".asInternalName(), + SkyhanniItems.ADVANCED_GARDENING_HOE(), + SkyhanniItems.ADVANCED_GARDENING_AXE(), ) private fun addEnchantments(stack: ItemStack, list: MutableList): Double { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt index aa7d9228ec32..f540164d2bdd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.misc.limbo import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.roundTo @@ -36,7 +36,6 @@ class LimboPlaytime { private val storage get() = ProfileStorageData.playerSpecific?.limbo - private val itemID = "ENDER_PEARL".asInternalName() private val itemName = "§aLimbo" private lateinit var limboItem: ItemStack private var lastCreateCooldown = SimpleTimeMark.farPast() @@ -52,7 +51,7 @@ class LimboPlaytime { if (lastCreateCooldown.passedSince() > 3.seconds) { lastCreateCooldown = SimpleTimeMark.now() limboItem = Utils.createItemStack( - itemID.getItemStack().item, + SkyhanniItems.ENDER_PEARL().getItemStack().item, itemName, *createItemLore() ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt index ae7338684b97..746ecc7697b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest -import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.data.item.SkyhanniItems class UnknownQuest(unknownName: String) : - Quest(NEUInternalName.MISSING_ITEM, null, QuestCategory.UNKNOWN, unknownName, QuestState.NOT_ACCEPTED) + Quest(SkyhanniItems.MISSING_ITEM(), null, QuestCategory.UNKNOWN, unknownName, QuestState.NOT_ACCEPTED) diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt index c30a089190ea..c69afb45067f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import net.minecraft.item.ItemStack object RiftAPI { @@ -20,8 +19,6 @@ object RiftAPI { // internal name -> motes var motesPrice = emptyMap() - val farmingTool by lazy { "FARMING_WAND".asInternalName() } - fun ItemStack.motesNpcPrice(): Double? { val baseMotes = motesPrice[getInternalName()] ?: return null val burgerStacks = config.motes.burgerStacks diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt index 020a6c1b7f7f..765066ab20c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftAgaricusCap.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.dreadfarm +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI @@ -29,7 +30,7 @@ class RiftAgaricusCap { } private fun updateLocation(): LorenzVec? { - if (McPlayer.heldItem?.getInternalName() != RiftAPI.farmingTool) return null + if (McPlayer.heldItem?.getInternalName() != SkyhanniItems.FARMING_WAND()) return null val currentLocation = McPlayer.blockLookingAt ?: return null when (currentLocation.getBlockStateAt().toString()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt index 82980e77c8d4..7888d15b6034 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.dreadfarm +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -45,7 +46,7 @@ class RiftWiltedBerberisHelper { list = list.editCopy { removeIf { it.lastTime.passedSince() > 500.milliseconds } } - hasFarmingToolInHand = McPlayer.heldItem?.getInternalName() == RiftAPI.farmingTool + hasFarmingToolInHand = McPlayer.heldItem?.getInternalName() == SkyhanniItems.FARMING_WAND() if (Minecraft.getMinecraft().thePlayer.onGround) { val block = LocationUtils.playerLocation().add(y = -1).getBlockAt() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt index 05de8996774e..8c47ed294d05 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminHighlighter.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI @@ -11,7 +12,6 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.mc.McWorld import net.minecraft.entity.EntityLivingBase @@ -63,7 +63,7 @@ class VerminHighlighter { private fun inArea() = LorenzUtils.skyBlockArea.let { it == "West Village" || it == "Infested House" } - private fun hasItemInHand() = InventoryUtils.itemInHandId == "TURBOMAX_VACUUM".asInternalName() + private fun hasItemInHand() = InventoryUtils.itemInHandId == SkyhanniItems.TURBOMAX_VACUUM() fun isEnabled() = RiftAPI.inRift() && inArea() && config.enabled && hasItemInHand() diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt index 7ad48ca32b7f..fd468c280909 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.IslandChangeEvent @@ -12,7 +13,6 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches @@ -45,7 +45,6 @@ object VerminTracker { ) private var hasVacuum = false - private val TURBOMAX_VACUUM = "TURBOMAX_VACUUM".asInternalName() private val config get() = RiftAPI.config.area.westVillage.verminTracker @@ -71,7 +70,7 @@ object VerminTracker { @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { if (!RiftAPI.inRift()) return - hasVacuum = McPlayer.has(TURBOMAX_VACUUM) + hasVacuum = McPlayer.has(SkyhanniItems.TURBOMAX_VACUUM()) } @SubscribeEvent @@ -93,7 +92,7 @@ object VerminTracker { val bin = event.inventoryItems[13]?.getLore() ?: return val bag = McPlayer.inventory - .firstOrNull { it.getInternalName() == TURBOMAX_VACUUM } + .firstOrNull { it.getInternalName() == SkyhanniItems.TURBOMAX_VACUUM() } ?.getLore() ?: emptyList() val binCounts = countVermin(bin) diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt index 20f1806b7568..24b7f1934d26 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/wyldwoods/RiftOdonata.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.wyldwoods +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper @@ -7,7 +8,6 @@ import at.hannibal2.skyhanni.utils.ColourUtils.toChromaColour import at.hannibal2.skyhanni.utils.ColourUtils.withAlpha import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.mc.McPlayer import at.hannibal2.skyhanni.utils.mc.McWorld import net.minecraft.entity.item.EntityArmorStand @@ -19,7 +19,7 @@ class RiftOdonata { private var hasBottleInHand = false private val odonataSkullTexture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkODA2ZGVmZGZkZjU5YjFmMjYwOWM4ZWUzNjQ2NjZkZTY2MTI3YTYyMzQxNWI1NDMwYzkzNThjNjAxZWY3YyJ9fX0=" - private val emptyBottle by lazy { "EMPTY_ODONATA_BOTTLE".asInternalName() } + private val emptyBottle by lazy { SkyhanniItems.EMPTY_ODONATA_BOTTLE() } @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt index a4f6ecefb8b2..d78db818606e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.everywhere +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.repo.EnigmaSoulsJson import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -15,7 +16,6 @@ import at.hannibal2.skyhanni.utils.InventoryUtils.getAllItems import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.highlight @@ -38,7 +38,7 @@ object EnigmaSoulWaypoints { private var adding = true private val item by lazy { - val neuItem = "SKYBLOCK_ENIGMA_SOUL".asInternalName().getItemStack() + val neuItem = SkyhanniItems.SKYBLOCK_ENIGMA_SOUL().getItemStack() Utils.createItemStack( neuItem.item, "§5Toggle Missing", @@ -98,13 +98,14 @@ object EnigmaSoulWaypoints { val split = event.slot.stack.displayName.split("Enigma: ") if (split.size == 2) { event.makePickblock() - if (soulLocations.contains(split.last())) { - if (!trackedSouls.contains(split.last())) { - ChatUtils.chat("§5Tracking the ${split.last()} Enigma Soul!", prefixColor = "§5") - trackedSouls.add(split.last()) + val name = split.last() + if (soulLocations.contains(name)) { + if (!trackedSouls.contains(name)) { + ChatUtils.chat("§5Tracking the $name Enigma Soul!", prefixColor = "§5") + trackedSouls.add(name) } else { - trackedSouls.remove(split.last()) - ChatUtils.chat("§5No longer tracking the ${split.last()} Enigma Soul!", prefixColor = "§5") + trackedSouls.remove(name) + ChatUtils.chat("§5No longer tracking the $name Enigma Soul!", prefixColor = "§5") } } } @@ -136,7 +137,7 @@ object EnigmaSoulWaypoints { for (soul in trackedSouls) { soulLocations[soul]?.let { event.drawWaypointFilled(it, config.colour.toChromaColour(), seeThroughBlocks = true, beacon = true) - event.drawDynamicText(it.add(y = 1), "§5$soul Soul", 1.5) + event.drawDynamicText(it.add(y = 1), "§5${soul.removeSuffix(" Soul")} Soul", 1.5) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt index 7c4b4386cef0..30eaf81c5ab8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt @@ -2,12 +2,12 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.SlayerAPI +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.TimeLimitedCache @@ -38,7 +38,7 @@ class SlayerItemsOnGround { // happens in spiders den sometimes if (itemStack.item == Items.spawn_egg) continue if (itemStack.getInternalName().equals("")) continue // TODO remove, should never happen - if (itemStack.getInternalName() == NEUInternalName.NONE) continue + if (itemStack.getInternalName() == SkyhanniItems.NONE()) continue val (itemName, price) = SlayerAPI.getItemNameAndPrice(itemStack.getInternalName(), itemStack.stackSize) if (config.minimumPrice > price) continue diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt index 34939d511ae8..811f9de1e168 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt @@ -8,6 +8,8 @@ import net.minecraft.client.resources.model.IBakedModel import net.minecraft.util.BlockPos import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable + +// Taken and modified from Skytils fun modifyGetModelFromBlockState( blockRendererDispatcher: BlockRendererDispatcher, state: IBlockState?, diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt index bdb103385a6c..9adc01d5660a 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.misc.ContributorManager import at.hannibal2.skyhanni.utils.EntityOutlineRenderer import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.datetime.DateUtils import net.minecraft.client.renderer.GlStateManager import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.player.EntityPlayer @@ -31,7 +32,7 @@ object RendererLivingEntityHook { @JvmStatic fun shouldBeUpsideDown(userName: String?): Boolean { if (!LorenzUtils.inSkyBlock) return false - if (!config.flipContributors && !LorenzUtils.isAprilFoolsDay) return false + if (!config.flipContributors && !DateUtils.isAprilFools()) return false val name = userName ?: return false return ContributorManager.shouldBeUpsideDown(name) } @@ -42,7 +43,7 @@ object RendererLivingEntityHook { @JvmStatic fun rotatePlayer(player: EntityPlayer) { if (!LorenzUtils.inSkyBlock) return - if (!config.rotateContributors && !LorenzUtils.isAprilFoolsDay) return + if (!config.rotateContributors && !DateUtils.isAprilFools()) return val name = player.name ?: return if (!ContributorManager.shouldSpin(name)) return val rotation = ((player.ticksExisted % 90) * 4).toFloat() diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java index fa0b44f74963..dc837fc47ff4 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java @@ -12,6 +12,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// Taken from Skytils @Mixin(BlockRendererDispatcher.class) public abstract class MixinBlockRendererDispatcher implements IResourceManagerReloadListener { @Inject(method = "getModelFromBlockState", at = @At("RETURN"), cancellable = true) diff --git a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt index 9392bb5413db..ba63f895738c 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt @@ -90,7 +90,7 @@ object PacketTest { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!enabled) return val packet = event.packet packet.print() diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 47af6e8f0e7a..2c5e0ad8e4c5 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -428,7 +429,7 @@ class SkyHanniDebugsAndTests { if (!debugConfig.showInternalName) return val itemStack = event.itemStack val internalName = itemStack.getInternalName() - if ((internalName == NEUInternalName.NONE) && !debugConfig.showEmptyNames) return + if ((internalName == SkyhanniItems.NONE()) && !debugConfig.showEmptyNames) return event.toolTip.add("Internal Name: '${internalName.asString()}'") } @@ -482,7 +483,7 @@ class SkyHanniDebugsAndTests { if (!debugConfig.showItemName) return val itemStack = event.itemStack val internalName = itemStack.getInternalName() - if (internalName == NEUInternalName.NONE) { + if (internalName == SkyhanniItems.NONE()) { event.toolTip.add("Item name: no item.") return } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt index f82ea2b17b06..e69de29bb2d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt @@ -1,72 +0,0 @@ -package at.hannibal2.skyhanni.test.command - -import at.hannibal2.skyhanni.events.PacketEvent -import at.hannibal2.skyhanni.utils.ChatUtils -import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.NumberUtil.roundTo -import at.hannibal2.skyhanni.utils.system.OS -import at.hannibal2.skyhanni.utils.toLorenzVec -import net.minecraft.network.play.server.S2APacketParticles -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -// Note: Each particle is copied anywhere between 1-3 times. Different each time. Shouldn't affect using this for debugging or developing -object CopyNearbyParticlesCommand { - - private var searchRadius = 0 - private var saveNextTick = false - private var searchTime: Long = 0 - private val resultList = mutableListOf() - private var tickTime: Long = 0 - private var counter = 0 - - fun command(args: Array) { - searchRadius = 10 - if (args.size == 1) { - searchRadius = args[0].toInt() - } - saveNextTick = true - searchTime = System.currentTimeMillis() - resultList.clear() - counter = 0 - tickTime = 0L - } - - @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { - if (!saveNextTick) return - // command was sent in or around a tick so skipping the tick - if (System.currentTimeMillis() <= searchTime + 5) return - - if (resultList.isEmpty() && tickTime == 0L) tickTime = System.currentTimeMillis() - - if (System.currentTimeMillis() > tickTime + 30) { - if (counter == 0) ChatUtils.chat("No particles found nearby, try a larger search radius") else { - val string = resultList.joinToString("\n") - OS.copyToClipboard(string) - ChatUtils.chat("$counter particles copied into the clipboard!") - } - saveNextTick = false - return - } - - val packet = event.packet - if (packet is S2APacketParticles) { - val location = packet.toLorenzVec().round(2) - if (LocationUtils.playerLocation().distance(location) > searchRadius) return - val offset = LorenzVec(packet.xOffset, packet.yOffset, packet.zOffset).round(2) - resultList.add("particle type: ${packet.particleType}") - resultList.add("particle location: $location") - resultList.add("distance from player: ${LocationUtils.playerLocation().distance(location).roundTo(2)}") - resultList.add("particle offset: $offset") - resultList.add("is long distance: ${packet.isLongDistance}") - resultList.add("particle count: ${packet.particleCount}") - resultList.add("particle speed: ${packet.particleSpeed}") - resultList.add("particle arguments: ${packet.particleArgs.asList()}") - resultList.add("") - resultList.add("") - counter++ - } - } -} diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TrackParticlesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TrackParticlesCommand.kt new file mode 100644 index 000000000000..8cf95d40f0b1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TrackParticlesCommand.kt @@ -0,0 +1,123 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NumberUtil.roundTo +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow +import at.hannibal2.skyhanni.utils.renderables.Renderable +import at.hannibal2.skyhanni.utils.system.OS +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.concurrent.ConcurrentLinkedDeque +import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds + +object TrackParticlesCommand { + + private var cutOffTime = SimpleTimeMark.farPast() + private var startTime = SimpleTimeMark.farPast() + + private val particles = ConcurrentLinkedDeque>() + + private var isRecording = false + + private val position get() = SkyHanniMod.feature.dev.debug.trackParticlePosition + + private var display: List = emptyList() + private var worldParticles: Map> = emptyMap() + + fun command(args: Array) { + if (args.firstOrNull() == "end") { + if (!isRecording) { + ChatUtils.userError("Nothing to end") + } else { + cutOffTime = SimpleTimeMark.now() + } + return + } + if (isRecording) { + ChatUtils.userError( + "Still tracking particles, wait for the other tracking to complete before starting a new one, " + + "or type §e/shtrackparticles end §cto end it prematurely" + ) + return + } + isRecording = true + particles.clear() + startTime = SimpleTimeMark.now() + cutOffTime = args.firstOrNull()?.toInt()?.seconds?.let { + ChatUtils.chat("Now started tracking particles for ${it.inWholeSeconds} Seconds") + it.fromNow() + } ?: run { + ChatUtils.chat("Now started tracking particles until manually ended") + SimpleTimeMark.farFuture() + } + } + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!isRecording) return + + val particlesToDisplay = particles.takeWhile { startTime.passedSince() - it.first < 3.seconds } + + display = particlesToDisplay + .take(10).reversed().map { + Renderable.string("§3" + it.second.type + " §8c:" + it.second.count + " §7s:" + it.second.speed) + } + worldParticles = particlesToDisplay.map { it.second }.groupBy { it.location } + + // The function must run after cutOffTime has passed to ensure thread safety + if (cutOffTime.passedSince() <= 0.1.seconds) return + val string = particles.reversed().joinToString("\n") { "Time: ${it.first.inWholeMilliseconds} ${it.second}" } + val counter = particles.size + OS.copyToClipboard(string) + ChatUtils.chat("$counter particles copied into the clipboard!") + particles.clear() + isRecording = false + } + + @SubscribeEvent + fun onReceiveParticle(event: ReceiveParticleEvent) { + if (cutOffTime.isInPast()) return + event.distanceToPlayer // Need to call to initialize Lazy + particles.addFirst(startTime.passedSince() to event) + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + if (cutOffTime.isInPast()) return + position.renderRenderables(display, posLabel = "Track particles log") + } + + @SubscribeEvent + fun onWorldRender(event: LorenzRenderWorldEvent) { + if (cutOffTime.isInPast()) return + worldParticles.forEach { (key, value) -> + if (value.size != 1) { + event.drawDynamicText(key, "§e${value.size} particles", 0.8) + + var offset = -0.2 + value.groupBy { it.type }.forEach { (particleType, particles) -> + event.drawDynamicText(key.up(offset), "§7§l$particleType §7(§e${particles.size}§7)", 0.8) + offset -= 0.2 + } + } else { + val particle = value.first() + + event.drawDynamicText(key, "§7§l${particle.type}", 0.8) + event.drawDynamicText( + key.up(-0.2), + "§7C: §e${particle.count} §7S: §a${particle.speed.roundTo(2)}", + scaleMultiplier = 0.8 + ) + } + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt index 2a8a53f16c25..1f09f061aa65 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TrackSoundsCommand.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NumberUtil.roundTo import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -21,8 +22,8 @@ import kotlin.time.Duration.Companion.seconds object TrackSoundsCommand { - private var cutOfTime: SimpleTimeMark = SimpleTimeMark.farPast() - private var startTime: SimpleTimeMark = SimpleTimeMark.farPast() + private var cutOffTime = SimpleTimeMark.farPast() + private var startTime = SimpleTimeMark.farPast() private val sounds = ConcurrentLinkedDeque>() @@ -38,7 +39,7 @@ object TrackSoundsCommand { if (!isRecording) { ChatUtils.userError("Nothing to end") } else { - cutOfTime = SimpleTimeMark.now() + cutOffTime = SimpleTimeMark.now() } return } @@ -52,7 +53,7 @@ object TrackSoundsCommand { isRecording = true sounds.clear() startTime = SimpleTimeMark.now() - cutOfTime = args.firstOrNull()?.toInt()?.seconds?.let { + cutOffTime = args.firstOrNull()?.toInt()?.seconds?.let { ChatUtils.chat("Now started tracking sounds for ${it.inWholeSeconds} Seconds") it.fromNow() } ?: run { @@ -65,7 +66,7 @@ object TrackSoundsCommand { fun onTick(event: LorenzTickEvent) { if (!isRecording) return - val soundsToDisplay = sounds.takeWhile { startTime.passedSince() - it.first < 3.0.seconds } + val soundsToDisplay = sounds.takeWhile { startTime.passedSince() - it.first < 3.seconds } display = soundsToDisplay .take(10).reversed().map { @@ -73,8 +74,8 @@ object TrackSoundsCommand { } worldSounds = soundsToDisplay.map { it.second }.groupBy { it.location } - // The function must run after cutOfTime has passed to ensure thread safety - if (cutOfTime.passedSince() <= 0.1.seconds) return + // The function must run after cutOffTime has passed to ensure thread safety + if (cutOffTime.passedSince() <= 0.1.seconds) return val string = sounds.reversed().joinToString("\n") { "Time: ${it.first.inWholeMilliseconds} ${it.second}" } val counter = sounds.size OS.copyToClipboard(string) @@ -85,7 +86,7 @@ object TrackSoundsCommand { @SubscribeEvent fun onPlaySound(event: PlaySoundEvent) { - if (cutOfTime.isInPast()) return + if (cutOffTime.isInPast()) return if (event.soundName == "game.player.hurt" && event.pitch == 0f && event.volume == 0f) return // remove random useless sound if (event.soundName == "") return // sound with empty name aren't useful event.distanceToPlayer // Need to call to initialize Lazy @@ -94,13 +95,13 @@ object TrackSoundsCommand { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (cutOfTime.isInPast()) return + if (cutOffTime.isInPast()) return position.renderRenderables(display, posLabel = "Track sound log") } @SubscribeEvent fun onWorldRender(event: LorenzRenderWorldEvent) { - if (cutOfTime.isInPast()) return + if (cutOffTime.isInPast()) return worldSounds.forEach { (key, value) -> if (value.size != 1) { event.drawDynamicText(key, "§e${value.size} sounds", 0.8) @@ -121,7 +122,7 @@ object TrackSoundsCommand { event.drawDynamicText(key, "§7§l${sound.soundName}", 0.8) event.drawDynamicText( key.up(-0.2), - "§7P: §e%.2f §7V: $volumeColor%.2f".format(sound.pitch, sound.volume), + "§7P: §e${sound.pitch.roundTo(2)} §7V: $volumeColor${sound.volume.roundTo(2)}", scaleMultiplier = 0.8 ) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index b30e51e689be..36c66abda461 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.chat.Text.url import at.hannibal2.skyhanni.utils.system.OS import net.minecraft.client.Minecraft import net.minecraft.util.ChatComponentText +import net.minecraft.util.ChatStyle import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.LinkedList @@ -238,4 +239,11 @@ object ChatUtils { } ) } + + fun IChatComponent.changeColor(color: LorenzColor): IChatComponent { + chatStyle = ChatStyle().also { + it.color = color.toChatFormatting() + } + return this + } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt index 8962e402e35a..e68af00ca8f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt @@ -401,7 +401,7 @@ object GuiRenderUtils { GlStateManager.disableTexture2D() GlStateManager.enableBlend() GlStateManager.disableAlpha() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.shadeModel(7425) val tessellator = Tessellator.getInstance() val worldRenderer = tessellator.worldRenderer diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index f4910fba1449..93a46f26f837 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.mc.McPlayer @@ -15,7 +16,7 @@ import kotlin.time.Duration.Companion.seconds object InventoryUtils { - var itemInHandId = NEUInternalName.NONE + var itemInHandId = SkyhanniItems.NONE() var recentItemsInHand = mutableMapOf() var latestItemInHand: ItemStack? = null @@ -89,5 +90,6 @@ object InventoryUtils { return getItemsInOpenChest().find { it.slotIndex == slotIndex }?.stack } + // TODO add a method that also can include the amounts in your sacks fun NEUInternalName.getAmountInInventory(): Int = McPlayer.countItems { it.getInternalNameOrNull() == this } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt index d4aa86b50030..c87aba63a114 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -21,7 +23,7 @@ object ItemNameResolver { } if (itemName == "§cmissing repo item") { - return itemNameCache.getOrPut(lowercase) { NEUInternalName.MISSING_ITEM } + return itemNameCache.getOrPut(lowercase) { SkyhanniItems.MISSING_ITEM() } } resolveEnchantmentByName(itemName)?.let { @@ -52,7 +54,7 @@ object ItemNameResolver { } val internalName = when (itemName) { - "SUPERBOOM TNT" -> "SUPERBOOM_TNT".asInternalName() + "SUPERBOOM TNT" -> SkyhanniItems.SUPERBOOM_TNT() else -> { ItemResolutionQuery.findInternalNameByDisplayName(itemName, true)?.let { @@ -89,8 +91,8 @@ object ItemNameResolver { private fun fixEnchantmentName(originalName: String): NEUInternalName { duplexPattern.matchMatcher(originalName) { - val tier = group("tier") - return "ULTIMATE_REITERATE;$tier".asInternalName() + val tier = group("tier").formatInt() + return SkyhanniItems.ULTIMATE_REITERATE(tier) } // TODO USE SH-REPO return originalName.asInternalName() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 0aec096c51b9..94d205fe8245 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.data.PetAPI +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull @@ -92,7 +93,7 @@ object ItemUtils { return false } - fun ItemStack.getInternalName() = getInternalNameOrNull() ?: NEUInternalName.NONE + fun ItemStack.getInternalName() = getInternalNameOrNull() ?: SkyhanniItems.NONE() fun ItemStack.getInternalNameOrNull(): NEUInternalName? { val data = cachedData @@ -106,8 +107,9 @@ object ItemUtils { } private fun ItemStack.grabInternalNameOrNull(): NEUInternalName? { + // TODO neu item repo now has potions, do we still need this? if (name == "§fWisp's Ice-Flavored Water I Splash Potion") { - return NEUInternalName.WISP_POTION + return SkyhanniItems.WISP_POTION() } return NEUItems.getInternalName(this)?.asInternalName() } @@ -237,7 +239,7 @@ object ItemUtils { val data = cachedData data.itemRarityLastCheck = SimpleTimeMark.now().toMillis() val internalName = getInternalName() - if (internalName == NEUInternalName.NONE) { + if (internalName == SkyhanniItems.NONE()) { data.itemRarity = null data.itemCategory = null return @@ -354,14 +356,14 @@ object ItemUtils { val NEUInternalName.itemNameWithoutColor: String get() = itemName.removeColor() private fun NEUInternalName.grabItemName(): String { - if (this == NEUInternalName.WISP_POTION) { + if (this == SkyhanniItems.WISP_POTION()) { return "§fWisp's Ice-Flavored Water" } - if (this == NEUInternalName.SKYBLOCK_COIN) { + if (this == SkyhanniItems.SKYBLOCK_COIN()) { return "§6Coins" } - if (this == NEUInternalName.NONE) { - error("NEUInternalName.NONE has no name!") + if (this == SkyhanniItems.NONE()) { + error("SkyhanniItems.NONE() has no name!") } if (NEUItems.ignoreItemsFilter.match(this.asString())) { return "§cBugged Item" diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index bb9ab0c036c4..8309a8f86466 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.test.command.ErrorManager import net.minecraft.item.EnumDyeColor +import net.minecraft.util.EnumChatFormatting import java.awt.Color enum class LorenzColor(val chatColorCode: Char, private val color: Color, private val coloredLabel: String) { @@ -62,6 +63,9 @@ enum class LorenzColor(val chatColorCode: Char, private val color: Color, privat CHROMA -> EnumDyeColor.WHITE } + fun toChatFormatting(): EnumChatFormatting? = + EnumChatFormatting.entries.firstOrNull { it.toString() == getChatColor() } + companion object { fun EnumDyeColor.toLorenzColor() = when (this) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 9d774c36ba7a..c5ecb2d1373d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -28,8 +28,6 @@ import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.FMLCommonHandler import java.text.DecimalFormat import java.text.SimpleDateFormat -import java.time.LocalDate -import java.time.Month import java.util.Timer import java.util.TimerTask import java.util.regex.Matcher @@ -69,14 +67,6 @@ object LorenzUtils { val lastWorldSwitch get() = HypixelData.joinedWorld - val isAprilFoolsDay: Boolean - get() { - val itsTime = LocalDate.now().let { it.month == Month.APRIL && it.dayOfMonth == 1 } - val always = SkyHanniMod.feature.dev.debug.alwaysFunnyTime - val never = SkyHanniMod.feature.dev.debug.neverFunnyTime - return (!never && (always || itsTime)) - } - val debug: Boolean = onHypixel && SkyHanniMod.feature.dev.debug.enabled fun SimpleDateFormat.formatCurrentTime(): String = this.format(System.currentTimeMillis()) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt index b3605094a3dd..a4fd6d06efa7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt @@ -8,12 +8,6 @@ class NEUInternalName private constructor(private val internalName: String) { private val map = mutableMapOf() - val NONE = "NONE".asInternalName() - val MISSING_ITEM = "MISSING_ITEM".asInternalName() - - val WISP_POTION = "WISP_POTION".asInternalName() - val SKYBLOCK_COIN = "SKYBLOCK_COIN".asInternalName() - fun String.asInternalName(): NEUInternalName { val internalName = uppercase().replace(" ", "_") return map.getOrPut(internalName) { NEUInternalName(internalName) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index dabc86bf03af..1a6f8255fe17 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelApiTrophyFish import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelPlayerApiJson import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson @@ -155,7 +156,7 @@ object NEUItems { fun NEUInternalName.getNpcPrice() = getNpcPriceOrNull() ?: -1.0 fun NEUInternalName.getNpcPriceOrNull(): Double? { - if (this == NEUInternalName.WISP_POTION) { + if (this == SkyhanniItems.WISP_POTION()) { return 20_000.0 } return BazaarDataHolder.getNpcPrice(this) @@ -165,7 +166,7 @@ object NEUItems { manager.auctionManager.transformHypixelBazaarToNEUItemId(hypixelId).asInternalName() fun NEUInternalName.getPriceOrNull(useSellingPrice: Boolean = false): Double? { - if (this == NEUInternalName.WISP_POTION) { + if (this == SkyhanniItems.WISP_POTION()) { return 20_000.0 } @@ -177,7 +178,7 @@ object NEUItems { if (result != -1L) return result.toDouble() if (equals("JACK_O_LANTERN")) { - return "PUMPKIN".asInternalName().getPrice(useSellingPrice) + 1 + return SkyhanniItems.PUMPKIN().getPrice(useSellingPrice) + 1 } if (equals("GOLDEN_CARROT")) { // 6.8 for some players @@ -288,22 +289,22 @@ object NEUItems { val count = ingredient.count.toInt() var internalItemId = ingredient.internalItemId.asInternalName() // ignore cactus green - if (internalName == "ENCHANTED_CACTUS_GREEN".asInternalName() && internalItemId == "INK_SACK-2".asInternalName()) { - internalItemId = "CACTUS".asInternalName() + if (internalName == SkyhanniItems.ENCHANTED_CACTUS_GREEN() && internalItemId == SkyhanniItems.CACTUS_GREEN()) { + internalItemId = SkyhanniItems.CACTUS() } // ignore wheat in enchanted cookie - if (internalName == "ENCHANTED_COOKIE".asInternalName() && internalItemId == "WHEAT".asInternalName()) { + if (internalName == SkyhanniItems.ENCHANTED_COOKIE() && internalItemId == SkyhanniItems.WHEAT()) { continue } // ignore golden carrot in enchanted golden carrot - if (internalName == "ENCHANTED_GOLDEN_CARROT".asInternalName() && internalItemId == "GOLDEN_CARROT".asInternalName()) { + if (internalName == SkyhanniItems.ENCHANTED_GOLDEN_CARROT() && internalItemId == SkyhanniItems.GOLDEN_CARROT()) { continue } // ignore rabbit hide in leather - if (internalName == "LEATHER".asInternalName() && internalItemId == "RABBIT_HIDE".asInternalName()) { + if (internalName == SkyhanniItems.LEATHER() && internalItemId == SkyhanniItems.RABBIT_HIDE()) { continue } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 4eb855568649..8cc015dd9039 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -212,7 +212,7 @@ object RenderUtils { GlStateManager.disableLighting() GlStateManager.enableCull() GlStateManager.enableTexture2D() - GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, 1, 1, 0) GlStateManager.enableBlend() GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) val time = Minecraft.getMinecraft().theWorld.totalWorldTime + partialTicks.toDouble() @@ -429,7 +429,7 @@ object RenderUtils { GlStateManager.scale(finalScale, finalScale, finalScale) GlStateManager.enableBlend() GlStateManager.disableLighting() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableTexture2D() minecraft.fontRendererObj.drawString( finalText, @@ -671,7 +671,7 @@ object RenderUtils { GlStateManager.enableBlend() GlStateManager.depthFunc(GL11.GL_LEQUAL) GlStateManager.disableCull() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableAlpha() GlStateManager.disableTexture2D() @@ -729,7 +729,7 @@ object RenderUtils { GlStateManager.enableBlend() GlStateManager.depthFunc(GL11.GL_LEQUAL) GlStateManager.disableCull() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableAlpha() GlStateManager.disableTexture2D() color.bindColor() @@ -781,7 +781,7 @@ object RenderUtils { GlStateManager.enableBlend() GlStateManager.depthFunc(GL11.GL_LEQUAL) GlStateManager.disableCull() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableAlpha() GlStateManager.disableTexture2D() color.bindColor() @@ -982,7 +982,7 @@ object RenderUtils { } GlStateManager.pushMatrix() GlStateManager.enableBlend() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) val minecraft = Minecraft.getMinecraft() val fontRenderer = minecraft.fontRendererObj @@ -1044,7 +1044,7 @@ object RenderUtils { fun drawFilledBoundingBox(aabb: BoundingBox, c: Color, alphaMultiplier: Float = 1f) { GlStateManager.enableBlend() GlStateManager.disableLighting() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.disableTexture2D() val tessellator = Tessellator.getInstance() val worldRenderer = tessellator.worldRenderer @@ -1528,7 +1528,7 @@ object RenderUtils { GlStateManager.disableTexture2D() GlStateManager.enableBlend() GlStateManager.disableAlpha() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GL11.glLineWidth(lineWidth.toFloat()) if (!depth) { GL11.glDisable(GL11.GL_DEPTH_TEST) @@ -1727,7 +1727,7 @@ object RenderUtils { GlStateManager.disableTexture2D() GlStateManager.enableBlend() GlStateManager.disableAlpha() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.shadeModel(7425) val tessellator = Tessellator.getInstance() val worldrenderer = tessellator.worldRenderer diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt b/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt index f5b4d8a77c53..a04a9c23a7c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt @@ -2,6 +2,9 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.utils.datetime.SkyBlockTime import java.time.Instant +import java.time.LocalDateTime +import java.time.ZoneId +import java.time.format.DateTimeFormatter import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds @@ -35,6 +38,13 @@ value class SimpleTimeMark(private val millis: Long) : Comparable() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt index d709c0276dcc..6393ff492fc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.events.TablistFooterUpdateEvent import at.hannibal2.skyhanni.mixins.hooks.tabListGuard @@ -14,6 +15,7 @@ import com.google.common.collect.ComparisonChain import com.google.common.collect.Ordering import net.minecraft.client.Minecraft import net.minecraft.client.network.NetworkPlayerInfo +import net.minecraft.network.play.server.S38PacketPlayerListItem import net.minecraft.world.WorldSettings import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.relauncher.Side @@ -103,9 +105,19 @@ object TabListData { return result.dropLast(1) } + var dirty = false + + @SubscribeEvent(receiveCanceled = true) + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { + if (event.packet is S38PacketPlayerListItem) { + dirty = true + } + } + @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!event.isMod(2)) return + if (!dirty) return + dirty = false val tabList = readTabList() ?: return if (tablistCache != tabList) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt index d903ada07741..8b4b0c3724be 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt @@ -4,10 +4,15 @@ import com.google.common.cache.CacheBuilder import java.util.concurrent.TimeUnit import kotlin.time.Duration -class TimeLimitedCache(expireAfterWrite: Duration) { +class TimeLimitedCache( + expireAfterWrite: Duration, + private val removalListener: (K?, V?) -> Unit = { _, _ -> }, +) { private val cache = CacheBuilder.newBuilder() - .expireAfterWrite(expireAfterWrite.inWholeMilliseconds, TimeUnit.MILLISECONDS).build() + .expireAfterWrite(expireAfterWrite.inWholeMilliseconds, TimeUnit.MILLISECONDS) + .removalListener { removalListener(it.key, it.value) } + .build() fun put(key: K, value: V) = cache.put(key, value) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt index 39dac5247f5b..5f0ccd4040aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt @@ -2,9 +2,12 @@ package at.hannibal2.skyhanni.utils import kotlin.time.Duration -class TimeLimitedSet(expireAfterWrite: Duration) { +class TimeLimitedSet( + expireAfterWrite: Duration, + private val removalListener: (T) -> Unit = {}, +) { - private val cache = TimeLimitedCache(expireAfterWrite) + private val cache = TimeLimitedCache(expireAfterWrite) { key, _ -> key?.let { removalListener(it) } } fun add(element: T) = cache.put(element, Unit) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/datetime/DateUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/datetime/DateUtils.kt index 3a84826deb38..c84787cffaaa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/datetime/DateUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/datetime/DateUtils.kt @@ -1,7 +1,24 @@ package at.hannibal2.skyhanni.utils.datetime +import at.hannibal2.skyhanni.SkyHanniMod +import java.time.LocalDate import java.time.Month +import java.time.ZoneId object DateUtils { - fun isDecember() = TimeUtils.getCurrentLocalDate().month == Month.DECEMBER + + private const val ZONE = "UTC" + + val now: LocalDate get() = LocalDate.now(ZoneId.of(ZONE)) + + @JvmStatic + fun isDecember() = now.month == Month.DECEMBER + + // TODO change to use either full range ie. from NZ to Kiribati or just use the local time + @JvmStatic + fun isAprilFools() = when { + SkyHanniMod.feature.dev.debug.alwaysFunnyTime -> true + SkyHanniMod.feature.dev.debug.neverFunnyTime -> false + else -> now.month == Month.APRIL && now.dayOfMonth == 1 + } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/datetime/SkyblockSeason.kt b/src/main/java/at/hannibal2/skyhanni/utils/datetime/SkyblockSeason.kt index 4faf614068fc..bda286bb299d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/datetime/SkyblockSeason.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/datetime/SkyblockSeason.kt @@ -1,7 +1,9 @@ package at.hannibal2.skyhanni.utils.datetime +import at.hannibal2.skyhanni.utils.RecalculatingValue import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.UtilsPatterns.seasonPattern +import kotlin.time.Duration.Companion.seconds enum class SkyblockSeason( val season: String, @@ -20,7 +22,11 @@ enum class SkyblockSeason( companion object { - fun getCurrentSeason(): SkyblockSeason? = getSeasonByName(SkyBlockTime.now().monthName) + fun getCurrentSeason(): SkyblockSeason? = currentSeason.getValue() + + private val currentSeason = RecalculatingValue(1.seconds) { + getSeasonByName(SkyBlockTime.now().monthName) + } private fun getSeasonByName(name: String): SkyblockSeason? = seasonPattern.matchMatcher(name) { entries.find { it.season.endsWith(group("season")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/datetime/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/datetime/TimeUtils.kt index a6e1c2d2d8c8..6d5e4a8cf270 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/datetime/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/datetime/TimeUtils.kt @@ -4,8 +4,6 @@ import at.hannibal2.skyhanni.mixins.hooks.tryToReplaceScoreboardLine import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.UtilsPatterns -import java.time.LocalDate -import java.time.ZoneId import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes @@ -138,8 +136,6 @@ object TimeUtils { ) ?: "" } - fun getCurrentLocalDate(): LocalDate = LocalDate.now(ZoneId.of("UTC")) - val Long.ticks get() = (this * 50).milliseconds val Int.ticks get() = (this * 50).milliseconds diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt index 24182d662fd8..4a510bbd5fad 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.features.misc.TrackerConfig.PriceFromEntry import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage import at.hannibal2.skyhanni.data.SlayerAPI +import at.hannibal2.skyhanni.data.item.SkyhanniItems import at.hannibal2.skyhanni.test.PriceSource import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList @@ -26,13 +27,9 @@ class SkyHanniItemTracker( drawDisplay: (Data) -> List>, ) : SkyHanniTracker(name, createNewSession, getStorage, drawDisplay) { - companion object { - - val SKYBLOCK_COIN = NEUInternalName.SKYBLOCK_COIN - } fun addCoins(coins: Int) { - addItem(SKYBLOCK_COIN, coins) + addItem(SkyhanniItems.SKYBLOCK_COIN(), coins) } fun addItem(internalName: NEUInternalName, amount: Int) { @@ -79,7 +76,7 @@ class SkyHanniItemTracker( val amount = itemProfit.totalAmount val pricePer = - if (internalName == SKYBLOCK_COIN) 1.0 else data.getCustomPricePer(internalName) + if (internalName == SkyhanniItems.SKYBLOCK_COIN()) 1.0 else data.getCustomPricePer(internalName) val price = (pricePer * amount).toLong() val hidden = itemProfit.hidden @@ -98,9 +95,9 @@ class SkyHanniItemTracker( val itemProfit = data.items[internalName] ?: error("Item not found for $internalName") val amount = itemProfit.totalAmount - val displayAmount = if (internalName == SKYBLOCK_COIN) itemProfit.timesGained else amount + val displayAmount = if (internalName == SkyhanniItems.SKYBLOCK_COIN()) itemProfit.timesGained else amount - val cleanName = if (internalName == SKYBLOCK_COIN) { + val cleanName = if (internalName == SkyhanniItems.SKYBLOCK_COIN()) { data.getCoinName(itemProfit) } else { internalName.itemName @@ -159,7 +156,7 @@ class SkyHanniItemTracker( newDrop: Boolean, internalName: NEUInternalName, ) = buildList { - if (internalName == SKYBLOCK_COIN) { + if (internalName == SkyhanniItems.SKYBLOCK_COIN()) { addAll(data.getCoinDescription(item)) } else { addAll(data.getDescription(item.timesGained))