aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/chroma
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-12-11 13:59:52 -0800
committerGitHub <noreply@github.com>2023-12-11 22:59:52 +0100
commitd5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f (patch)
treebc07923686b77da759b3f12ea535f2e3c02deead /src/main/java/at/hannibal2/skyhanni/features/chroma
parentb8ec689ce9bd6fe89e4b825a988edb63fb51b5ab (diff)
downloadskyhanni-d5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f.tar.gz
skyhanni-d5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f.tar.bz2
skyhanni-d5b4a817e2b9e7e5c88eb0c8212b9a6e678bd92f.zip
Internal: Migrate Deprecated Config Values to Enums (#790)
Migrate Deprecated Config Values to Enums. #790
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chroma')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt
index 8afd758a7..dfa187c0d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt
@@ -1,17 +1,22 @@
package at.hannibal2.skyhanni.features.chroma
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.config.features.chroma.ChromaConfig.Direction
import at.hannibal2.skyhanni.data.MinecraftData
import at.hannibal2.skyhanni.mixins.transformers.AccessorMinecraft
+import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.shader.Shader
import at.hannibal2.skyhanni.utils.shader.Uniform
import net.minecraft.client.Minecraft
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
/**
* Modified from SkyblockAddons
*
* Credit: [ChromaShader.java](https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/shader/chroma/ChromaShader.java)
*/
+
object ChromaShader : Shader("chroma", "chroma") {
val config get() = SkyHanniMod.feature.chroma
val INSTANCE: ChromaShader
@@ -26,8 +31,8 @@ object ChromaShader : Shader("chroma", "chroma") {
(MinecraftData.totalTicks / 2) + (Minecraft.getMinecraft() as AccessorMinecraft).timer.renderPartialTicks
ticks = when (config.chromaDirection) {
- 0, 2 -> ticks
- 1, 3 -> -ticks
+ Direction.FORWARD_RIGHT, Direction.BACKWARD_RIGHT -> ticks
+ Direction.FORWARD_LEFT, Direction.BACKWARD_LEFT -> -ticks
else -> ticks
}
@@ -39,10 +44,17 @@ object ChromaShader : Shader("chroma", "chroma") {
}
registerUniform(Uniform.UniformType.BOOL, "forwardDirection") {
when (config.chromaDirection) {
- 0, 1 -> true
- 2, 3 -> false
+ Direction.FORWARD_RIGHT, Direction.FORWARD_LEFT -> true
+ Direction.BACKWARD_RIGHT, Direction.BACKWARD_LEFT -> false
else -> true
}
}
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.transform(14, "config.chromaDirection") { element ->
+ ConfigUtils.migrateIntToEnum(element, Direction::class.java)
+ }
+ }
}