diff options
author | inglettronald <inglettronald@gmail.com> | 2023-04-07 18:40:31 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-04-07 18:40:31 -0500 |
commit | e933913ebe88f6b465ee862374bbd26c57906cae (patch) | |
tree | ffe446d296da81ce545bb9833e11194fae832985 /src/main/kotlin | |
parent | 08848974d8ea83d692ce1c215fd0d4f30bf72ab5 (diff) | |
download | DulkirMod-e933913ebe88f6b465ee862374bbd26c57906cae.tar.gz DulkirMod-e933913ebe88f6b465ee862374bbd26c57906cae.tar.bz2 DulkirMod-e933913ebe88f6b465ee862374bbd26c57906cae.zip |
i don't even remember
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/dulkirmod/DulkirMod.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt | 28 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/Huds/KeyHud.kt (renamed from src/main/kotlin/dulkirmod/config/KeyHud.kt) | 2 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt | 29 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/config/DulkirConfig.kt | 61 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/chat/Bridge.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/TablistUtils.kt | 53 |
8 files changed, 157 insertions, 30 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 1c46e08..b685b2d 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -1,8 +1,8 @@ package dulkirmod +import dulkirmod.Huds.KeyHud import dulkirmod.command.* import dulkirmod.config.DulkirConfig -import dulkirmod.config.KeyHud import dulkirmod.events.ChatEvent import dulkirmod.features.* import dulkirmod.features.chat.AbiphoneDND diff --git a/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt b/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt new file mode 100644 index 0000000..f4d1afb --- /dev/null +++ b/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt @@ -0,0 +1,28 @@ +package dulkirmod.Huds + +import cc.polyfrost.oneconfig.hud.TextHud +import dulkirmod.config.DulkirConfig +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.Utils + +class GardenInfoHud : TextHud(true) { + override fun getLines(lines: MutableList<String>?, example: Boolean) { + if (!Utils.isInSkyblock()) return + if (TabListUtils.area != "Garden") return + var i = 0 + if (DulkirConfig.gardenMilestoneDisplay) { + lines?.add(i, TabListUtils.gardenMilestone) + ++i + } + if (DulkirConfig.visitorInfo) { + lines?.add(i, "Visitors: ${TabListUtils.numVisitors} - ${TabListUtils.timeTillNextVisitor}") + ++i + } + if (DulkirConfig.composterAlert) { + if (TabListUtils.emptyComposter) { + lines?.add(i, "Empty Composter!") + ++i + } + } + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/config/KeyHud.kt b/src/main/kotlin/dulkirmod/Huds/KeyHud.kt index ca7b2e4..5b0c1df 100644 --- a/src/main/kotlin/dulkirmod/config/KeyHud.kt +++ b/src/main/kotlin/dulkirmod/Huds/KeyHud.kt @@ -1,4 +1,4 @@ -package dulkirmod.config +package dulkirmod.Huds import cc.polyfrost.oneconfig.hud.TextHud import dulkirmod.features.chat.DungeonKeyDisplay diff --git a/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt b/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt new file mode 100644 index 0000000..610ee08 --- /dev/null +++ b/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt @@ -0,0 +1,29 @@ +package dulkirmod.Huds + +import cc.polyfrost.oneconfig.hud.TextHud +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.DulkirConfig +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.Utils + +class YawDisplayHud : TextHud(true) { + override fun getLines(lines: MutableList<String>?, example: Boolean) { + if (!Utils.isInSkyblock()) return + if (TabListUtils.area != "Garden") return + val pitch = mc.thePlayer.rotationPitch + var yaw = mc.thePlayer.rotationYaw % 360f + + if (yaw < -180.0f) { + yaw += 360.0f; + } else if (yaw > 180.0f) { + yaw -= 360.0f; + } + if (DulkirConfig.yaw3Decimals) { + lines?.add(0, String.format("Yaw: %.3f", yaw)) + } else { + lines?.add(0, String.format("Yaw: %.2f", yaw)) + } + if (DulkirConfig.showPitch) + lines?.add(1, String.format("Pitch: %.2f", pitch)) + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt index d5e58c4..2470d99 100644 --- a/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt +++ b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt @@ -8,12 +8,12 @@ import net.minecraft.command.ICommandSender class JoinDungeonCommand : ClientCommandBase("joindungeon") { @Throws(CommandException::class) override fun processCommand(sender: ICommandSender, args: Array<String>) { - var arguments = args.contentToString().replace("[", "").replace("]", "").replace(",", "") + val arguments = args.contentToString().replace("[", "").replace("]", "").replace(",", "") var type = "" var num = "" - if (args[0] == "master_catacombs") { + if (args[0].lowercase() == "master_catacombs") { type = "M" - } else if (args[0] == "catacombs") { + } else if (args[0].lowercase() == "catacombs") { type = "F" } diff --git a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt index 6af452b..cd914ff 100644 --- a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt +++ b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt @@ -5,6 +5,9 @@ import cc.polyfrost.oneconfig.config.annotations.* import cc.polyfrost.oneconfig.config.data.Mod import cc.polyfrost.oneconfig.config.data.ModType import dulkirmod.DulkirMod +import dulkirmod.Huds.GardenInfoHud +import dulkirmod.Huds.KeyHud +import dulkirmod.Huds.YawDisplayHud import dulkirmod.utils.Utils @@ -175,7 +178,7 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf name = "Size", description = "Scales the size of your currently held item. Default: 0", category = "Animations", - subcategory = "Dungeons", + subcategory = "Animations", min = -1.5f, max = 1.5f, step = 0 @@ -601,6 +604,62 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf ) var witherKeyDisplayHUD: KeyHud = KeyHud() + @HUD( + name = "Pitch/Yaw Display", + category = "HUD", + subcategory = "Farming" + ) + var YawDisplayHud: YawDisplayHud = YawDisplayHud() + + @Switch( + name = "Display Pitch as well", + description = "useful for some slime launcher stuff", + category = "HUD", + subcategory = "Farming" + ) + var showPitch = false + + @Switch( + name = "3 Decimals on Yaw", + description = "are u ok bro", + category = "HUD", + subcategory = "Farming" + ) + var yaw3Decimals = false + + @HUD( + name = "Garden Info Display", + category = "HUD", + subcategory = "Garden" + ) + var GardenInfoHud: GardenInfoHud = GardenInfoHud() + + @Switch( + name = "Empty Composter Notif", + description = "Will display in HUD instead of giga-alert", + category = "HUD", + subcategory = "Garden" + ) + var composterAlert = true + + @Switch( + name = "Farming Milestone Display", + description = "Increasing number go brr", + category = "HUD", + subcategory = "Garden" + ) + var gardenMilestoneDisplay = true + + @Switch( + name = "Visitor Info", + description = "Show number present and time until next", + category = "HUD", + subcategory = "Garden" + ) + var visitorInfo = true + + + fun init() { initialize() addDependency("customMessage", "throttleNotifier") diff --git a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt index 1c4e288..245fe22 100644 --- a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt +++ b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt @@ -8,11 +8,11 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent object Bridge { private val guildFormat = - "^(§2Guild|§3Officer|§2G|§3O) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^>]+) > .+".toRegex() + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^>]+) > .+".toRegex() private val alternateFormat = - "^(§2Guild|§3Officer|§2G|§3O) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^:]+): .+".toRegex() + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^:]+): .+".toRegex() private val otherAltFormat = - "^(§2Guild|§3Officer|§2G|§3O) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^»]+) » .+".toRegex() + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^»]+) » .+".toRegex() fun handle(event: ClientChatReceivedEvent) { val message = event.message.unformattedText diff --git a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt index da07f0b..af4512b 100644 --- a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt @@ -15,6 +15,10 @@ object TabListUtils { var explosivity: Boolean = false var isInDungeons: Boolean = false var maxVisitors: Boolean = false + var emptyComposter: Boolean = false + var gardenMilestone: String = "" + var timeTillNextVisitor: String = "" + var numVisitors: Int = 0 private val playerInfoOrdering = object : Ordering<NetworkPlayerInfo>() { override fun compare(p_compare_1_: NetworkPlayerInfo?, p_compare_2_: NetworkPlayerInfo?): Int { @@ -55,33 +59,40 @@ object TabListUtils { it.displayName?.unformattedText } + for (line in scoreboardList) { - if (line.startsWith("Area: ")) - area = line.substring(6) - else if (line == "Volcano Explosivity:") { - exploFlag = true - } - else if (exploFlag) { - explosivity = line != " INACTIVE" - exploFlag = false - } - else if (line == " Dungeon Stats") { - isInDungeons = true - dungeonFlag = true + when { + line.startsWith("Area: ") -> area = line.substring(6) + line == "Volcano Explosivity:" -> exploFlag = true + exploFlag -> { + exploFlag = false + if (line != " INACTIVE") { + explosivity = true + } + } + line == " Dungeon Stats" -> { + isInDungeons = true + } + line == " Time Left: INACTIVE" -> emptyComposter = true + line.startsWith(" Milestone") -> gardenMilestone = line.substring(1) + line.startsWith(" Next Visitor:") -> { + timeTillNextVisitor = line.substring(15) + maxVisitors = (timeTillNextVisitor == "Queue Full!") + } + line.startsWith("Visitors:") -> { + numVisitors = line.substring(11, 12).toInt() // TODO: FIX WHEN THEY ADD THE TENTH VISITOR + } } - // Here is some scuffed code that basically makes sure maxVisitors is assigned appropriately. - // It's awful and I do not care to fix it lol. - else if (line == " Next Visitor: Queue Full!") - maxVisitors = true - else if (line.startsWith(" Next Visitor:")) - maxVisitors = false } - if (area != "Crimson Isle") + if (area != "Crimson Isle") { explosivity = false - if (area != "Garden") + } + if (area != "Garden") { maxVisitors = false - if (!dungeonFlag) + } + if (!isInDungeons) { isInDungeons = false + } } }
\ No newline at end of file |