diff options
Diffstat (limited to 'src/main')
25 files changed, 147 insertions, 77 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt b/src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt new file mode 100644 index 000000000..de4296955 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt @@ -0,0 +1,24 @@ +package at.hannibal2.skyhanni.config.enums + +import at.hannibal2.skyhanni.SkyHanniMod + +enum class OutsideSbFeature(private val displayName: String) { + MODIFY_VISUAL_WORDS("Modify Visual Words"), + CUSTOM_TEXT_BOX("Custom Text Box"), + REAL_TIME("Real Time"), + TPS_DISPLAY("TPS Display"), + MARKED_PLAYERS("Marked Players"), + FARMING_WEIGHT("Farming Weight"), + NEXT_JACOB_CONTEXT("Next Jacobs's Context"), + COMPOSTER_TIME("Composter Time"), + YAW_AND_PITCH("Yaw and Pitch"), + QUICK_MOD_MENU_SWITCH("Quick Mod Menu Switch"), + FOLLOWING_LINE("Following Line"), + ARROW_TRAIL("Arrow Trail"), + HIGHLIGHT_PARTY_MEMBERS("Highlight Party Members"), + MOVEMENT_SPEED("Movement Speed"); + + override fun toString() = displayName + + fun isSelected() = SkyHanniMod.feature.misc.showOutsideSB.contains(this) +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/WaypointsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/WaypointsConfig.java index 863f91476..2063bd20d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/WaypointsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/WaypointsConfig.java @@ -23,4 +23,8 @@ public class WaypointsConfig { @ConfigEditorBoolean public boolean showPlatformNumber = false; + @Expose + @ConfigOption(name = "Show Outside SB", desc = "Make parkour waypoints outside of SkyBlock too.") + @ConfigEditorBoolean + public boolean parkourOutsideSB = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/EliteFarmingWeightConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/EliteFarmingWeightConfig.java index 7adec6c56..b949df6f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/EliteFarmingWeightConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/EliteFarmingWeightConfig.java @@ -50,4 +50,9 @@ public class EliteFarmingWeightConfig { @ConfigOption(name = "Show below 200", desc = "Show the farming weight data even if you are below 200 weight.") @ConfigEditorBoolean public boolean ignoreLow = false; + + @Expose + @ConfigOption(name = "Show Outside Garden", desc = "Show the farming weight outside of the garden.") + @ConfigEditorBoolean + public boolean showOutsideGarden = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java index 19b2ee1bb..c54659ae3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java @@ -24,7 +24,7 @@ public class NextJacobContestConfig { @Expose @ConfigOption(name = "Outside Garden", desc = "Show the timer not only in the Garden but everywhere in SkyBlock.") @ConfigEditorBoolean - public boolean everywhere = false; + public boolean showOutsideGarden = false; @Expose @ConfigOption(name = "In Other Guis", desc = "Mark the current or next Farming Contest crops in other farming GUIs as underlined.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/YawPitchDisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/YawPitchDisplayConfig.java index dd7997fba..88c9f626e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/YawPitchDisplayConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/YawPitchDisplayConfig.java @@ -50,7 +50,7 @@ public class YawPitchDisplayConfig { @Expose @ConfigOption(name = "Show Outside Garden", desc = "The overlay will work outside of the Garden.") @ConfigEditorBoolean - public boolean showEverywhere = false; + public boolean showOutsideGarden = false; @Expose @ConfigOption(name = "Ignore Timeout", desc = "Ignore the timeout after not moving mouse.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java index 498dba83d..d6206bcc4 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java @@ -15,12 +15,6 @@ public class ModifyWordsConfig { @FeatureToggle public boolean enabled = true; - @Expose - @ConfigOption(name = "Work Outside SkyBlock", desc = "Allows modifying visual words anywhere on Hypixel.") - @ConfigEditorBoolean - @FeatureToggle - public boolean workOutside = false; - @ConfigOption(name = "Open Config", desc = "Opens the menu to setup the visual words.\n§eCommand: /shwords") @ConfigEditorButton(buttonText = "Open") public Runnable open = Commands::openVisualWords; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java index 499514e2f..0532d9424 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.config.features.misc; import at.hannibal2.skyhanni.config.FeatureToggle; import at.hannibal2.skyhanni.config.core.config.Position; +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature; import at.hannibal2.skyhanni.config.features.misc.compacttablist.CompactTabListConfig; import at.hannibal2.skyhanni.config.features.misc.cosmetic.CosmeticConfig; import at.hannibal2.skyhanni.config.features.misc.pets.PetConfig; @@ -9,8 +10,12 @@ import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; import io.github.moulberry.moulconfig.annotations.Category; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import java.util.ArrayList; +import java.util.List; + public class MiscConfig { @Expose @@ -99,6 +104,11 @@ public class MiscConfig { public PetCandyDisplayConfig petCandy = new PetCandyDisplayConfig(); @Expose + @ConfigOption(name = "Show Outside SB", desc = "Show these features outside of SkyBlock.") + @ConfigEditorDraggableList + public List<OutsideSbFeature> showOutsideSB = new ArrayList<>(); + + @Expose @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience orbs lying on the ground.") @ConfigEditorBoolean @FeatureToggle @@ -166,6 +176,12 @@ public class MiscConfig { public Position playerMovementSpeedPos = new Position(394, 124, false, true); @Expose + @ConfigOption(name = "Pet Candy Used", desc = "Show the number of Pet Candy used on a pet.") + @ConfigEditorBoolean + @FeatureToggle + public boolean petCandyUsed = true; + + @Expose @ConfigOption(name = "Server Restart Title", desc = "Show a title with seconds remaining until the server restarts after a Game Update or Scheduled Restart.") @ConfigEditorBoolean @FeatureToggle diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 9c50b1c09..77f334fc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -31,7 +31,6 @@ class GuiEditManager { @SubscribeEvent fun onKeyClick(event: LorenzKeyPressEvent) { - if (!LorenzUtils.onHypixel) return if (event.keyCode != SkyHanniMod.feature.gui.keyBindOpen) return if (isInGui()) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index 2ca07b16c..f8e8f37da 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -21,6 +21,7 @@ class RenderData { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) { if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return + if (!canRender()) return if (!SkyHanniDebugsAndTests.globalRender) return if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return @@ -31,6 +32,7 @@ class RenderData { @SubscribeEvent fun onBackgroundDraw(event: GuiScreenEvent.BackgroundDrawnEvent) { + if (!canRender()) return if (!SkyHanniDebugsAndTests.globalRender) return if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return val currentScreen = Minecraft.getMinecraft().currentScreen ?: return @@ -50,6 +52,8 @@ class RenderData { GlStateManager.popMatrix() } + private fun canRender(): Boolean = Minecraft.getMinecraft()?.renderManager?.fontRenderer != null + @SubscribeEvent fun onRenderWorld(event: RenderWorldLastEvent) { if (!SkyHanniDebugsAndTests.globalRender) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt index 482799d27..90ec54196 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.cosmetics import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -30,8 +31,7 @@ class ArrowTrail { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return val secondsAlive = config.secondsAlive.toDouble().toDuration(DurationUnit.SECONDS) val time = SimpleTimeMark.now() val deathTime = time.plus(secondsAlive) @@ -51,8 +51,7 @@ class ArrowTrail { @SubscribeEvent fun onWorldRender(event: LorenzRenderWorldEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return val color = if (config.handlePlayerArrowsDifferently) config.playerArrowColor else config.arrowColor val playerArrowColor = color.toChromaColor() listYourArrow.forEach { @@ -66,6 +65,8 @@ class ArrowTrail { } } + private fun isEnabled() = config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.ARROW_TRAIL.isSelected()) + @SubscribeEvent fun onIslandChange(event: IslandChangeEvent) { listAllArrow.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 7f617fc64..1515e9a11 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.cosmetics import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -35,8 +36,7 @@ class CosmeticFollowingLine { @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return updateClose(event) @@ -99,8 +99,7 @@ class CosmeticFollowingLine { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!isEnabled()) return if (event.isMod(5)) { locations = locations.editCopy { values.removeIf { it.time.passedSince() > config.secondsAlive.seconds } } @@ -124,6 +123,8 @@ class CosmeticFollowingLine { } } + private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.FOLLOWING_LINE.isSelected()) && config.enabled + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(9, "misc.cosmeticConfig", "misc.cosmetic") 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 8b38e801b..b114d5ab4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.config.features.garden.NextJacobContestConfig.ShareContestsEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent @@ -512,8 +513,9 @@ object GardenNextJacobContest { } } - private fun isEnabled() = LorenzUtils.inSkyBlock && config.display - && (GardenAPI.inGarden() || config.everywhere) + private fun isEnabled() = + config.display && ((LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden)) || + (OutsideSbFeature.NEXT_JACOB_CONTEXT.isSelected() && !LorenzUtils.inSkyBlock)) private fun isFetchEnabled() = isEnabled() && config.fetchAutomatically private fun isSendEnabled() = @@ -642,6 +644,7 @@ object GardenNextJacobContest { event.transform(15, "garden.nextJacobContests.shareAutomatically") { element -> ConfigUtils.migrateIntToEnum(element, ShareContestsEntry::class.java) } + event.move(18, "garden.nextJacobContests.everywhere", "garden.nextJacobContests.showOutsideGarden") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt index e93d7ce67..32f4cafdf 100755 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt @@ -1,5 +1,7 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils @@ -19,10 +21,9 @@ class GardenYawAndPitch { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return - if (!config.enabled) return + if (!LorenzUtils.onHypixel) return + if (!isEnabled()) return if (GardenAPI.hideExtraGuis()) return - if (!GardenAPI.inGarden() && !config.showEverywhere) return if (GardenAPI.toolInHand == null && !config.showWithoutTool) return val player = Minecraft.getMinecraft().thePlayer @@ -57,4 +58,13 @@ class GardenYawAndPitch { fun onGardenToolChange(event: GardenToolChangeEvent) { lastChange = SimpleTimeMark.farPast() } + + private fun isEnabled() = + config.enabled && ((OutsideSbFeature.YAW_AND_PITCH.isSelected() && !LorenzUtils.inSkyBlock) || + (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))) + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(18, "garden.yawPitchDisplay.showEverywhere", "garden.yawPitchDisplay.showOutsideGarden") + } } 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 e55bbb833..c7a6b8f8b 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils @@ -8,7 +9,8 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.TimeUtils @@ -25,6 +27,7 @@ class ComposterDisplay { private var display = emptyList<List<Any>>() private var composterEmptyTime: Duration? = null + private val bucket by lazy { "BUCKET".asInternalName().getItemStack() } private var tabListData by ComposterAPI::tabListData enum class DataType(rawPattern: String, val icon: String) { @@ -33,9 +36,7 @@ class ComposterDisplay { TIME_LEFT(" Time Left: §r(.*)", "WATCH"), STORED_COMPOST(" Stored Compost: §r(.*)", "COMPOST"); - val displayItem by lazy { - NEUItems.getItemStack(icon) - } + val displayItem by lazy { icon.asInternalName().getItemStack() } val pattern by lazy { rawPattern.toPattern() } @@ -80,7 +81,7 @@ class ComposterDisplay { return if (emptyTime != null) { GardenAPI.storage?.composterEmptyTime = System.currentTimeMillis() + emptyTime.inWholeMilliseconds val format = emptyTime.format() - listOf(NEUItems.getItemStack("BUCKET"), "§b$format") + listOf(bucket, "§b$format") } else { listOf("§cOpen Composter Upgrades!") } @@ -142,7 +143,7 @@ class ComposterDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.COMPOSTER_TIME.isSelected()) return if (GardenAPI.inGarden() && config.displayEnabled) { config.displayPos.renderStringsAndItems(display, posLabel = "Composter Display") @@ -152,23 +153,25 @@ class ComposterDisplay { } private fun checkWarningsAndOutsideGarden() { - val storage = GardenAPI.storage ?: return - - val format = if (storage.composterEmptyTime != 0L) { - val duration = storage.composterEmptyTime - System.currentTimeMillis() - if (duration > 0) { - if (duration < 1000 * 60 * 20) { - warn("Your composter in the garden is soon empty!") + val format = GardenAPI.storage?.let { + if (it.composterEmptyTime != 0L) { + val duration = it.composterEmptyTime - System.currentTimeMillis() + if (duration > 0) { + if (duration < 1000 * 60 * 20) { + warn("Your composter in the garden is almost empty!") + } + TimeUtils.formatDuration(duration, maxUnits = 3) + } else { + warn("Your composter is empty!") + "§cComposter is empty!" } - TimeUtils.formatDuration(duration, maxUnits = 3) - } else { - warn("Your composter is empty!") - "§cComposter is empty!" - } - } else "?" + } else "?" + } ?: "§cJoin SkyBlock to show composter timer." - if (!GardenAPI.inGarden() && config.displayOutsideGarden) { - val list = Collections.singletonList(listOf(NEUItems.getItemStack("BUCKET"), "§b$format")) + val inSb = LorenzUtils.inSkyBlock && config.displayOutsideGarden + val outsideSb = !LorenzUtils.inSkyBlock && OutsideSbFeature.COMPOSTER_TIME.isSelected() + if (!GardenAPI.inGarden() && (inSb || outsideSb)) { + val list = Collections.singletonList(listOf(bucket, "§b$format")) config.outsideGardenPos.renderStringsAndItems(list, posLabel = "Composter Outside Garden Display") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index ebf444535..6baa0970f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.jsonobjects.other.EliteLeaderboardJson @@ -144,7 +145,7 @@ class FarmingWeightDisplay { private var lastOpenWebsite = SimpleTimeMark.farPast() private fun update() { - if (!GardenAPI.inGarden()) return + if (!isEnabled()) return if (apiError) { display = errorMessage return @@ -153,10 +154,6 @@ class FarmingWeightDisplay { if (weight == -1.0) { if (!isLoadingWeight) { val localProfile = HypixelData.profileName - if (localProfile == "") { - display = Renderable.singeltonString("§cError: profileName is empty!") - return - } isLoadingWeight = true if (display.isEmpty()) { @@ -338,7 +335,9 @@ class FarmingWeightDisplay { ) } - private fun isEnabled() = GardenAPI.inGarden() && config.display + private fun isEnabled() = ((OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock) || + (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))) && config.display + private fun isEtaEnabled() = config.overtakeETA fun addCrop(crop: CropType, addedCounter: Int) { @@ -452,7 +451,7 @@ class FarmingWeightDisplay { val selectedProfileId = apiData.selectedProfileId var selectedProfileEntry = apiData.profiles.find { it.profileId == selectedProfileId } - if (selectedProfileEntry == null || selectedProfileEntry.profileName.lowercase() != localProfile) { + if (selectedProfileEntry == null || (selectedProfileEntry.profileName.lowercase() != localProfile && localProfile != "")) { selectedProfileEntry = apiData.profiles.find { it.profileName.lowercase() == localProfile } } 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 diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt index 4ad8d51e6..0c12c6d4e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt @@ -25,7 +25,7 @@ class ParkourWaypointSaver { @SubscribeEvent fun onKeyClick(event: LorenzKeyPressEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!LorenzUtils.inSkyBlock && !config.parkourOutsideSB) return if (Minecraft.getMinecraft().currentScreen != null) return if (NEUItems.neuHasFocus()) return if (timeLastSaved.passedSince() < 250.milliseconds) return @@ -67,7 +67,7 @@ class ParkourWaypointSaver { @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!LorenzUtils.inSkyBlock && !config.parkourOutsideSB) return if (locations.size > 1) { parkourHelper?.render(event) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt index fea82caf7..86486fd45 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent import at.hannibal2.skyhanni.mixins.transformers.CustomRenderGlobal @@ -220,14 +221,10 @@ object EntityOutlineRenderer { @JvmStatic fun shouldRenderEntityOutlines(): Boolean { // SkyBlock Conditions - if (!LorenzUtils.inSkyBlock) { - return false - } + if (!LorenzUtils.inSkyBlock && !OutsideSbFeature.HIGHLIGHT_PARTY_MEMBERS.isSelected()) return false // Main toggle for outlines features - if (!isEnabled()) { - return false - } + if (!isEnabled()) return false // Vanilla Conditions val renderGlobal = mc.renderGlobal as CustomRenderGlobal |