feat: MoulConfig config gui

This commit is contained in:
Linnea Gräf
2024-11-12 17:02:08 +01:00
parent 9763a4caa4
commit b774daef5b
14 changed files with 691 additions and 22 deletions

View File

@@ -234,6 +234,19 @@ object MoulConfigUtils {
// TODO: move this utility into moulconfig (also rework guicontext into an interface so i can make this mesh better into vanilla)
fun GuiContext.adopt(element: GuiComponent) = element.foldRecursive(Unit, { comp, unit -> comp.context = this })
inline fun <T, R> GetSetter<T>.xmap(crossinline fromT: (T) -> R, crossinline toT: (R) -> T): GetSetter<R> {
val outer = this
return object : GetSetter<R> {
override fun get(): R {
return fromT(outer.get())
}
override fun set(newValue: R) {
outer.set(toT(newValue))
}
}
}
fun clickMCComponentInPlace(
component: GuiComponent,
x: Int,