diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index c6ff098..18b34d3 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -94,7 +94,7 @@ object Configuration { Thread { runBlocking { ClickGui.boxContext { - enabledFeatures.putAll(buttons.map { + enabledFeatures.putAll(buttons.filter { it.info.shouldSave }.map { it.title to it.toggled }) } diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt index 9df7b0f..880b975 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt @@ -18,7 +18,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { ClickGui.clickBoxes.find { box -> it.let { impl -> with(impl) { - if (info.kind == Type.TOGGLE && !info.parent.shouldHide) { + if (info.shouldSave && info.kind == Type.TOGGLE && !info.parent.shouldHide) { Configuration.enabledFeatures[title]?.let { bool -> toggled = bool } @@ -55,7 +55,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { field = value hidden = value } - private val info = this::class.findAnnotation() ?: throw Exception("Missing @ButtonInfo annotaton") + internal val info = this::class.findAnnotation() ?: throw Exception("Missing @ButtonInfo annotaton") override var color = info.parent.categoryColor; get() { return info.parent.box.color.let { if (field == it) field else it diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt index 2227149..47d18a0 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt @@ -12,6 +12,7 @@ import net.minecraft.network.chat.TranslatableComponent annotation class ButtonInfo( val parent: Category, val kind: Type = Type.TOGGLE, + val shouldSave: Boolean = true, /** Whether or not the state of the button should be saved */ val ignored: Boolean = false /** Excludes a class from button collection */ ) { companion object { diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Zoom.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Zoom.kt index 73a0592..5fadb40 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Zoom.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Zoom.kt @@ -3,7 +3,7 @@ package fr.username404.snowygui.gui.feature import fr.username404.snowygui.config.Configuration import net.minecraft.client.Minecraft -@ButtonInfo(Category.MISC) +@ButtonInfo(Category.MISC, shouldSave = false) object Zoom: ButtonImpl() { internal var smoothCameraOnZoom: Boolean by Configuration internal var zoomFactor: Double by Configuration