diff options
author | Obsidian <108832807+Obsidianninja11@users.noreply.github.com> | 2024-03-04 10:59:15 -0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 20:59:15 +0100 |
commit | 16facf4a91651c709e4c78e7b3f2c9973560feab (patch) | |
tree | a906f9ca75bee7296158c07399348952b1e9ec71 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | e52c3015102bc308f3536c377eb56d99d8f83b20 (diff) | |
download | skyhanni-16facf4a91651c709e4c78e7b3f2c9973560feab.tar.gz skyhanni-16facf4a91651c709e4c78e7b3f2c9973560feab.tar.bz2 skyhanni-16facf4a91651c709e4c78e7b3f2c9973560feab.zip |
Feature: Added option to show some features outside SB. (#603)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
8 files changed, 29 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt index a2369fc38..cfecac7e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange @@ -27,22 +28,22 @@ class CustomTextBox { @SubscribeEvent fun onRenderGUIOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { - if (!config.enabled) return if (!config.onlyInGUI) return - if (!LorenzUtils.inSkyBlock) return + if (!isEnabled()) return config.position.renderStrings(display, posLabel = "Custom Text Box") } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!config.enabled) return if (config.onlyInGUI) return - if (!LorenzUtils.inSkyBlock) return + if (!isEnabled()) return config.position.renderStrings(display, posLabel = "Custom Text Box") } + private fun isEnabled() = config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.CUSTOM_TEXT_BOX.isSelected()) + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.textBox", "gui.customTextBox") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt index ee8f2c37c..8d647c9d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -15,7 +16,6 @@ import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class MarkedPlayerManager { - private val config get() = SkyHanniMod.feature.markedPlayers companion object { @@ -79,7 +79,7 @@ class MarkedPlayerManager { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!isEnabled()) return if (event.repeatSeconds(1)) { findPlayers() @@ -106,6 +106,8 @@ class MarkedPlayerManager { } } + private fun isEnabled() = config.highlightInWorld && (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { if (Minecraft.getMinecraft().thePlayer == null) return @@ -118,6 +120,4 @@ class MarkedPlayerManager { } } } - - private fun isEnabled() = LorenzUtils.inSkyBlock && config.highlightInWorld } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt index dbf76a3dc..0af985c67 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round @@ -41,5 +42,7 @@ class MovementSpeedDisplay { config.playerMovementSpeedPos.renderString(display, posLabel = "Movement Speed") } - fun isEnabled() = LorenzUtils.inSkyBlock && config.playerMovementSpeed + fun isEnabled() = LorenzUtils.onHypixel && + (LorenzUtils.inSkyBlock || OutsideSbFeature.MOVEMENT_SPEED.isSelected()) && + config.playerMovementSpeed } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt index 6de5b8cf7..e90265ef3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.enums.OutsideSbFeature
import at.hannibal2.skyhanni.data.PartyAPI
import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -20,7 +21,8 @@ class PartyMemberOutlines { }
}
- private fun isEnabled() = LorenzUtils.inSkyBlock && !LorenzUtils.inDungeons && config.enabled
+ fun isEnabled() = config.enabled &&
+ (LorenzUtils.inSkyBlock || OutsideSbFeature.HIGHLIGHT_PARTY_MEMBERS.isSelected()) && !LorenzUtils.inDungeons
private fun getEntityOutlineColor(entity: Entity): Int? {
if (entity !is EntityOtherPlayerMP || !PartyAPI.partyMembers.contains(entity.name)) return null
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index 2d241dd9c..a0ce295b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.jsonobjects.repo.ModGuiSwitcherJson +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager @@ -192,7 +193,7 @@ object QuickModMenuSwitch { GlStateManager.popMatrix() } - fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled + fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.QUICK_MOD_MENU_SWITCH.isSelected()) && config.enabled @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index 9c71d3153..edcfec79f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.WinterAPI import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -31,7 +32,7 @@ class TimeFeatures { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.REAL_TIME.isSelected()) return if (config.realTime) { val currentTime = 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 7e70c1c06..92620bf49 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent @@ -31,8 +32,7 @@ class TpsCounter { init { fixedRateTimer(name = "skyhanni-tps-counter-seconds", period = 1000L) { - if (!LorenzUtils.inSkyBlock) return@fixedRateTimer - if (!config.tpsDisplay) return@fixedRateTimer + if (!isEnabled()) return@fixedRateTimer if (packetsFromLastSecond == 0) return@fixedRateTimer if (ignoreFirstTicks > 0) { @@ -61,8 +61,7 @@ class TpsCounter { } } fixedRateTimer(name = "skyhanni-tps-counter-ticks", period = 50L) { - if (!LorenzUtils.inSkyBlock) return@fixedRateTimer - if (!config.tpsDisplay) return@fixedRateTimer + if (!isEnabled()) return@fixedRateTimer if (hasPacketReceived) { hasPacketReceived = false @@ -87,12 +86,14 @@ class TpsCounter { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.tpsDisplay) return + if (!isEnabled()) return config.tpsDisplayPosition.renderString(display, posLabel = "Tps Display") } + private fun isEnabled() = LorenzUtils.onHypixel && config.tpsDisplay && + (LorenzUtils.inSkyBlock || OutsideSbFeature.TPS_DISPLAY.isSelected()) + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.tpsDisplayEnabled", "gui.tpsDisplay") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt index d250311db..9198438aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.visualwords import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.convertToFormatted import at.hannibal2.skyhanni.utils.TimeLimitedCache @@ -17,7 +18,7 @@ object ModifyVisualWords { var modifiedText = originalText ?: return null if (!LorenzUtils.onHypixel) return originalText if (!config.enabled) return originalText - if (!LorenzUtils.inSkyBlock && !config.workOutside) return originalText + if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.MODIFY_VISUAL_WORDS.isSelected()) return originalText if (modifiedWords.isEmpty()) { modifiedWords = SkyHanniMod.feature.storage.modifiedWords |