summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/dungeon
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-10-15 12:50:14 +0100
committerGitHub <noreply@github.com>2023-10-15 13:50:14 +0200
commit0bdfaab9e486f0c6adc576e3a939838ef1827c80 (patch)
tree9bb2f1bd50b62590220440b94f2cad0fda7f9e9b /src/main/java/at/hannibal2/skyhanni/features/dungeon
parent202759b6752741e32c3b2d3e022ea8d71400188f (diff)
downloadskyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.gz
skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.bz2
skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.zip
Internal Change: Config deprecations (#542)
migrate the config, removed id system entirely #542
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt35
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt8
4 files changed, 57 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
index 6d0afd651..31e8c611e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
@@ -18,6 +19,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DungeonCleanEnd {
+ private val config get() = SkyHanniMod.feature.dungeon.cleanEnd
+
private var bossDone = false
private var chestsSpawned = false
private var lastBossId: Int = -1
@@ -25,7 +28,7 @@ class DungeonCleanEnd {
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
if (!LorenzUtils.inDungeons) return
- if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return
+ if (!config.toggle) return
val message = event.message
@@ -36,7 +39,7 @@ class DungeonCleanEnd {
private fun shouldBlock(): Boolean {
if (!LorenzUtils.inDungeons) return false
- if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return false
+ if (!config.toggle) return false
if (!bossDone) return false
@@ -63,7 +66,7 @@ class DungeonCleanEnd {
@SubscribeEvent
fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) {
if (!LorenzUtils.inDungeons) return
- if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return
+ if (!config.toggle) return
if (bossDone) return
if (lastBossId == -1) return
if (event.entity.entityId != lastBossId) return
@@ -83,7 +86,7 @@ class DungeonCleanEnd {
if (entity == Minecraft.getMinecraft().thePlayer) return
- if (SkyHanniMod.feature.dungeon.cleanEndF3IgnoreGuardians
+ if (config.F3IgnoreGuardians
&& DungeonAPI.isOneOf("F3", "M3")
&& entity is EntityGuardian
&& entity.entityId != lastBossId
@@ -111,4 +114,11 @@ class DungeonCleanEnd {
event.isCanceled = true
}
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(3, "dungeon.cleanEndToggle", "dungeon.cleanEnd.toggle")
+ event.move(3, "dungeon.cleanEndF3IgnoreGuardians", "dungeon.cleanEnd.F3IgnoreGuardians")
+ }
+
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
index 7b423af28..ddfd622a7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.DungeonBossRoomEnterEvent
import at.hannibal2.skyhanni.events.DungeonEnterEvent
@@ -64,7 +65,7 @@ class DungeonCopilot {
foundKeyOrDoor = true
}
- if (foundKeyOrDoor && SkyHanniMod.feature.dungeon.messageFilterKeysAndDoors) {
+ if (foundKeyOrDoor && SkyHanniMod.feature.dungeon.messageFilter.keysAndDoors) {
event.blockedReason = "dungeon_keys_and_doors"
}
@@ -125,13 +126,20 @@ class DungeonCopilot {
}
private fun isEnabled(): Boolean {
- return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.copilotEnabled
+ return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.dungeonCopilot.enabled
}
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isEnabled()) return
- SkyHanniMod.feature.dungeon.copilotPos.renderString(nextStep, posLabel = "Dungeon Copilot")
+ SkyHanniMod.feature.dungeon.dungeonCopilot.pos.renderString(nextStep, posLabel = "Dungeon Copilot")
+ }
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){
+ event.move(3, "dungeon.messageFilterKeysAndDoors", "dungeon.messageFilter.keysAndDoors")
+ event.move(3,"dungeon.copilotEnabled", "dungeon.dungeonCopilot.enabled")
+ event.move(3,"dungeon.copilotPos", "dungeon.dungeonCopilot.pos")
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
index 1428a120a..dd086cf2f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.EntityMovementData
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.EntityMoveEvent
@@ -21,6 +22,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DungeonHideItems {
+ private val config get() = SkyHanniMod.feature.dungeon.objectHider
+
private val hideParticles = mutableMapOf<EntityArmorStand, Long>()
private val movingSkeletonSkulls = mutableMapOf<EntityArmorStand, Long>()
@@ -61,18 +64,18 @@ class DungeonHideItems {
if (entity is EntityItem) {
val stack = entity.entityItem
- if (SkyHanniMod.feature.dungeon.hideReviveStone && stack.cleanName() == "Revive Stone") {
+ if (config.hideReviveStone && stack.cleanName() == "Revive Stone") {
event.isCanceled = true
}
- if (SkyHanniMod.feature.dungeon.hideJournalEntry && stack.cleanName() == "Journal Entry") {
+ if (config.hideJournalEntry && stack.cleanName() == "Journal Entry") {
event.isCanceled = true
}
}
if (entity !is EntityArmorStand) return
- if (SkyHanniMod.feature.dungeon.hideSuperboomTNT) {
+ if (config.hideSuperboomTNT) {
if (entity.name.startsWith("§9Superboom TNT")) {
event.isCanceled = true
}
@@ -84,7 +87,7 @@ class DungeonHideItems {
}
}
- if (SkyHanniMod.feature.dungeon.hideBlessing) {
+ if (config.hideBlessing) {
if (entity.name.startsWith("§dBlessing of ")) {
event.isCanceled = true
}
@@ -95,7 +98,7 @@ class DungeonHideItems {
}
}
- if (SkyHanniMod.feature.dungeon.hideReviveStone) {
+ if (config.hideReviveStone) {
if (entity.name == "§6Revive Stone") {
event.isCanceled = true
}
@@ -107,7 +110,7 @@ class DungeonHideItems {
}
}
- if (SkyHanniMod.feature.dungeon.hidePremiumFlesh) {
+ if (config.hidePremiumFlesh) {
if (entity.name == "§9Premium Flesh") {
event.isCanceled = true
hideParticles[entity] = System.currentTimeMillis()
@@ -121,7 +124,7 @@ class DungeonHideItems {
if (isSkeletonSkull(entity)) {
EntityMovementData.addToTrack(entity)
- if (SkyHanniMod.feature.dungeon.hideSkeletonSkull) {
+ if (config.hideSkeletonSkull) {
val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0)
if (lastMove + 100 > System.currentTimeMillis()) {
return
@@ -130,7 +133,7 @@ class DungeonHideItems {
}
}
- if (SkyHanniMod.feature.dungeon.hideHealerOrbs) {
+ if (config.hideHealerOrbs) {
when {
entity.name.startsWith("§c§lDAMAGE §e") -> event.isCanceled = true
entity.name.startsWith("§c§lABILITY DAMAGE §e") -> event.isCanceled = true
@@ -152,7 +155,7 @@ class DungeonHideItems {
}
}
- if (SkyHanniMod.feature.dungeon.hideHealerFairy) {
+ if (config.hideHealerFairy) {
val itemStack = entity.inventory[0]
if (itemStack != null && itemStack.getSkullTexture() == healerFairyTexture) {
event.isCanceled = true
@@ -164,7 +167,7 @@ class DungeonHideItems {
@SubscribeEvent
fun onReceivePacket(event: ReceiveParticleEvent) {
if (!LorenzUtils.inDungeons) return
- if (!SkyHanniMod.feature.dungeon.hideSuperboomTNT && !SkyHanniMod.feature.dungeon.hideReviveStone) return
+ if (!config.hideSuperboomTNT && !config.hideReviveStone) return
val packetLocation = event.location
for (armorStand in hideParticles.filter { it.value + 100 > System.currentTimeMillis() }.map { it.key }) {
@@ -223,4 +226,16 @@ class DungeonHideItems {
hideParticles.clear()
movingSkeletonSkulls.clear()
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(3, "dungeon.hideSuperboomTNT", "dungeon.objectHider.hideSuperboomTNT")
+ event.move(3, "dungeon.hideBlessing", "dungeon.objectHider.hideBlessing")
+ event.move(3, "dungeon.hideReviveStone", "dungeon.objectHider.hideReviveStone")
+ event.move(3, "dungeon.hidePremiumFlesh", "dungeon.objectHider.hidePremiumFlesh")
+ event.move(3, "dungeon.hideJournalEntry", "dungeon.objectHider.hideJournalEntry")
+ event.move(3, "dungeon.hideSkeletonSkull", "dungeon.objectHider.hideSkeletonSkull")
+ event.move(3, "dungeon.hideHealerOrbs", "dungeon.objectHider.hideHealerOrbs")
+ event.move(3, "dungeon.hideHealerFairy", "dungeon.objectHider.hideHealerFairy")
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
index 2a044adef..776a11a14 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -14,7 +15,7 @@ class DungeonLevelColor {
@SubscribeEvent
fun onItemTooltip(event: ItemTooltipEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.dungeon.partyFinderColoredClassLevel) return
+ if (!SkyHanniMod.feature.dungeon.partyFinder.coloredClassLevel) return
if (event.toolTip == null) return
val chestName = InventoryUtils.openInventoryName()
@@ -34,6 +35,11 @@ class DungeonLevelColor {
}
}
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){
+ event.move(3, "dungeon.partyFinderColoredClassLevel", "dungeon.partyFinder.coloredClassLevel")
+ }
}
fun getColor(level: Int): String {