Make info public in ButtonImpl.kt and call execAction in ConfigScreen.kt to update the smoothCamera option of Minecraft

This commit is contained in:
Username404-59 2021-06-28 16:56:02 +02:00
parent 7612921bc2
commit 019d0798d7
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
3 changed files with 3 additions and 2 deletions

View File

@ -59,6 +59,7 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
}.setMin(1.1).build(),
startBooleanToggle(TranslatableComponent("$confPrefix.behavior.zoom.smoothcamera"), Zoom.smoothCameraOnZoom).setSaveConsumer {
Zoom.smoothCameraOnZoom = it
Zoom.execAction()
}.build()
)
)

View File

@ -55,7 +55,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
field = value
hidden = value
}
internal val info = this::class.findAnnotation<ButtonInfo>() ?: throw Exception("Missing @ButtonInfo annotaton")
val info = this::class.findAnnotation<ButtonInfo>() ?: throw Exception("Missing @ButtonInfo annotaton")
override var color = info.parent.categoryColor; get() {
return info.parent.box.color.let {
if (field == it) field else it

View File

@ -9,7 +9,7 @@ object Zoom: ButtonImpl() {
internal var zoomFactor: Double by Configuration
@JvmStatic
fun getNewZoom(fov: Double): Double = fov / zoomFactor
override fun execAction() {
public override fun execAction() {
Minecraft.getInstance().options.smoothCamera = toggled && smoothCameraOnZoom
}
}