Make info public in ButtonImpl.kt and call execAction in ConfigScreen.kt to update the smoothCamera option of Minecraft
This commit is contained in:
		
							parent
							
								
									7612921bc2
								
							
						
					
					
						commit
						019d0798d7
					
				| @ -59,6 +59,7 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) { | |||||||
|                             }.setMin(1.1).build(), |                             }.setMin(1.1).build(), | ||||||
|                             startBooleanToggle(TranslatableComponent("$confPrefix.behavior.zoom.smoothcamera"), Zoom.smoothCameraOnZoom).setSaveConsumer { |                             startBooleanToggle(TranslatableComponent("$confPrefix.behavior.zoom.smoothcamera"), Zoom.smoothCameraOnZoom).setSaveConsumer { | ||||||
|                                 Zoom.smoothCameraOnZoom = it |                                 Zoom.smoothCameraOnZoom = it | ||||||
|  |                                 Zoom.execAction() | ||||||
|                             }.build() |                             }.build() | ||||||
|                         ) |                         ) | ||||||
|                     ) |                     ) | ||||||
|  | |||||||
| @ -55,7 +55,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { | |||||||
|         field = value |         field = value | ||||||
|         hidden = 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() { |     override var color = info.parent.categoryColor; get() { | ||||||
|         return info.parent.box.color.let { |         return info.parent.box.color.let { | ||||||
|             if (field == it) field else it |             if (field == it) field else it | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ object Zoom: ButtonImpl() { | |||||||
|     internal var zoomFactor: Double by Configuration |     internal var zoomFactor: Double by Configuration | ||||||
|     @JvmStatic |     @JvmStatic | ||||||
|     fun getNewZoom(fov: Double): Double = fov / zoomFactor |     fun getNewZoom(fov: Double): Double = fov / zoomFactor | ||||||
|     override fun execAction() { |     public override fun execAction() { | ||||||
|         Minecraft.getInstance().options.smoothCamera = toggled && smoothCameraOnZoom |         Minecraft.getInstance().options.smoothCamera = toggled && smoothCameraOnZoom | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user