summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorObsidian <108832807+Obsidianninja11@users.noreply.github.com>2024-03-04 10:59:15 -0900
committerGitHub <noreply@github.com>2024-03-04 20:59:15 +0100
commit16facf4a91651c709e4c78e7b3f2c9973560feab (patch)
treea906f9ca75bee7296158c07399348952b1e9ec71 /src/main/java
parente52c3015102bc308f3536c377eb56d99d8f83b20 (diff)
downloadskyhanni-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')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/dev/WaypointsConfig.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/EliteFarmingWeightConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/YawPitchDisplayConfig.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/RenderData.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/cosmetics/ArrowTrail.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt7
-rwxr-xr-xsrc/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt45
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PartyMemberOutlines.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt9
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