21 lines
787 B
Kotlin
21 lines
787 B
Kotlin
package fr.username404.snowygui.config
|
|
|
|
import com.mojang.blaze3d.platform.InputConstants
|
|
import net.minecraft.client.KeyMapping
|
|
import org.lwjgl.glfw.GLFW.GLFW_KEY_U
|
|
import org.lwjgl.glfw.GLFW.GLFW_KEY_Y
|
|
|
|
private typealias privLambda = (() -> Unit)?
|
|
object AddKeyMaps {
|
|
private const val prefix = "snowy"
|
|
private fun mkMap(translationSuffix: String, key: Int, category: String = "keycategory", lambda: privLambda = null): Pair<KeyMapping, privLambda> {
|
|
return KeyMapping(
|
|
"key.$prefix.$translationSuffix", InputConstants.Type.KEYSYM,
|
|
key, "category.$prefix.$category"
|
|
) to lambda
|
|
}
|
|
val list: MutableMap<KeyMapping, (() -> Unit)?> = mutableMapOf(
|
|
mkMap("opengui", GLFW_KEY_Y),
|
|
mkMap("configkey", GLFW_KEY_U)
|
|
)
|
|
} |