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_U
|
||||||
import org.lwjgl.glfw.GLFW.GLFW_KEY_Y
|
import org.lwjgl.glfw.GLFW.GLFW_KEY_Y
|
||||||
|
|
||||||
private typealias privLambda = (() -> Unit)?
|
private typealias privateLambda = (() -> Unit)?
|
||||||
object AddKeyMaps {
|
object AddKeyMaps {
|
||||||
private const val prefix = "snowy"
|
private const val prefix = "snowy"
|
||||||
@JvmOverloads
|
@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(
|
return KeyMapping(
|
||||||
"key.$prefix.$translationSuffix", InputConstants.Type.KEYSYM,
|
"key.$prefix.$translationSuffix", InputConstants.Type.KEYSYM,
|
||||||
key, "category.$prefix.$category"
|
key, "category.$prefix.$category"
|
||||||
) to lambda
|
) to lambda
|
||||||
}
|
}
|
||||||
val list: MutableMap<KeyMapping, (() -> Unit)?> = mutableMapOf(
|
val list: MutableMap<KeyMapping, privateLambda> = with(Minecraft.getInstance()) {
|
||||||
mkMap("opengui", GLFW_KEY_Y) { Minecraft.getInstance().setScreen(ClickGui) },
|
mutableMapOf(
|
||||||
mkMap("configkey", GLFW_KEY_U) { Minecraft.getInstance().setScreen(run { configScreenParent = null; SnowyConfigScreen }) }
|
mkMap("opengui", GLFW_KEY_Y) { setScreen(ClickGui) },
|
||||||
)
|
mkMap("configkey", GLFW_KEY_U) { setScreen(run { configScreenParent = null; SnowyConfigScreen }) }
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user