diff --git a/common/src/main/java/fr/username404/snowygui/mixins/KeyMappings.java b/common/src/main/java/fr/username404/snowygui/mixins/KeyMappings.java index 9834630..f262abb 100644 --- a/common/src/main/java/fr/username404/snowygui/mixins/KeyMappings.java +++ b/common/src/main/java/fr/username404/snowygui/mixins/KeyMappings.java @@ -14,13 +14,11 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.io.File; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; @Mixin(Options.class) class KeyMappings { - private static final List keysToAdd = AddKeyMaps.INSTANCE.getList(); + private static final Collection keysToAdd = AddKeyMaps.INSTANCE.getList().keySet(); @Mutable @Shadow @Final public KeyMapping[] keyMappings; diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/AddKeyMaps.kt b/common/src/main/kotlin/fr/username404/snowygui/config/AddKeyMaps.kt index 91fb706..d0ad691 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/AddKeyMaps.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/AddKeyMaps.kt @@ -5,18 +5,17 @@ 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"): KeyMapping { + private fun mkMap(translationSuffix: String, key: Int, category: String = "keycategory", lambda: privLambda = null): Pair { return KeyMapping( "key.$prefix.$translationSuffix", InputConstants.Type.KEYSYM, key, "category.$prefix.$category" - ) - } - fun getList(): List { - return listOf( - mkMap("opengui", GLFW_KEY_Y), - mkMap("configkey", GLFW_KEY_U) - ) + ) to lambda } + val list: Map Unit)?> = mutableMapOf( + mkMap("opengui", GLFW_KEY_Y), + mkMap("configkey", GLFW_KEY_U) + ) } \ No newline at end of file