Use a receiver for the list in AddKeyMaps.kt
This commit is contained in:
parent
439a6e6574
commit
3c37ffcb81
|
@ -9,18 +9,20 @@ import net.minecraft.client.Minecraft
|
|||
import org.lwjgl.glfw.GLFW.GLFW_KEY_U
|
||||
import org.lwjgl.glfw.GLFW.GLFW_KEY_Y
|
||||
|
||||
private typealias privLambda = (() -> Unit)?
|
||||
private typealias privateLambda = (() -> Unit)?
|
||||
object AddKeyMaps {
|
||||
private const val prefix = "snowy"
|
||||
@JvmOverloads
|
||||
internal fun mkMap(translationSuffix: String, key: Int, category: String = "keycategory", lambda: privLambda = null): Pair<KeyMapping, privLambda> {
|
||||
internal fun mkMap(translationSuffix: String, key: Int, category: String = "keycategory", lambda: privateLambda = null): Pair<KeyMapping, privateLambda> {
|
||||
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) { Minecraft.getInstance().setScreen(ClickGui) },
|
||||
mkMap("configkey", GLFW_KEY_U) { Minecraft.getInstance().setScreen(run { configScreenParent = null; SnowyConfigScreen }) }
|
||||
)
|
||||
val list: MutableMap<KeyMapping, privateLambda> = with(Minecraft.getInstance()) {
|
||||
mutableMapOf(
|
||||
mkMap("opengui", GLFW_KEY_Y) { setScreen(ClickGui) },
|
||||
mkMap("configkey", GLFW_KEY_U) { setScreen(run { configScreenParent = null; SnowyConfigScreen }) }
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue