Compare commits

...

2 Commits

Author SHA1 Message Date
ca47028e7e
Fix controls category name
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
2026-02-09 00:11:56 +01:00
21c53e496a
Use entries instead of values() in ButtonInfo.kt
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
2026-02-09 00:03:58 +01:00
4 changed files with 8 additions and 5 deletions

View File

@ -28,7 +28,7 @@ annotation class ButtonInfo(
HUD("snowy.clickbox.hud", Colors.DARK_PURPLE), HUD("snowy.clickbox.hud", Colors.DARK_PURPLE),
MACROS("snowy.clickbox.macros", Colors.GREEN); MACROS("snowy.clickbox.macros", Colors.GREEN);
companion object { companion object {
fun fromBox(box: ClickBox): Category? = values().find { fun fromBox(box: ClickBox): Category? = entries.find {
box.isCategory(it) box.isCategory(it)
} }
} }

View File

@ -6,6 +6,7 @@ import fr.username404.snowygui.config.SnowyConfigScreen
import fr.username404.snowygui.config.configScreenParent import fr.username404.snowygui.config.configScreenParent
import net.minecraft.client.KeyMapping import net.minecraft.client.KeyMapping
import net.minecraft.client.Minecraft import net.minecraft.client.Minecraft
import net.minecraft.resources.Identifier
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
@ -16,12 +17,14 @@ object AddKeyMaps {
@JvmOverloads @JvmOverloads
internal fun mkMap( internal fun mkMap(
translationSuffix: String, translationSuffix: String,
key: Int, category: String = "keycategory", key: Int, category: String = "controls",
lambda: privateLambda = null lambda: privateLambda = null
): Pair<KeyMapping, privateLambda> = KeyMapping( ): Pair<KeyMapping, privateLambda> = KeyMapping(
"key.$prefix.$translationSuffix", InputConstants.Type.KEYSYM, "key.$prefix.$translationSuffix", InputConstants.Type.KEYSYM,
key, this.category ?: run { key, this.category ?: run {
this.category = KeyMapping.Category.register("category.$prefix.$category"); this.category this.category = KeyMapping.Category.register(
Identifier.fromNamespaceAndPath("snowygui", category)
); this.category
}!! }!!
) to lambda ) to lambda
val list: MutableMap<KeyMapping, privateLambda> = with(Minecraft.getInstance()) { val list: MutableMap<KeyMapping, privateLambda> = with(Minecraft.getInstance()) {

View File

@ -13,7 +13,7 @@
"screen.snowy.config.behavior.zoom.factor": "Zoom factor", "screen.snowy.config.behavior.zoom.factor": "Zoom factor",
"screen.snowy.config.behavior.zoom.smoothcamera": "Smooth camera on zoom", "screen.snowy.config.behavior.zoom.smoothcamera": "Smooth camera on zoom",
"screen.snowy.config.behavior.keystrokes.position": "Position of the keystrokes HUD element", "screen.snowy.config.behavior.keystrokes.position": "Position of the keystrokes HUD element",
"category.snowy.keycategory": "SnowyGUI", "key.category.snowygui.controls": "SnowyGUI",
"key.snowy.opengui": "Open the snowy gui", "key.snowy.opengui": "Open the snowy gui",
"key.snowy.configkey": "Open the snowy configuration screen", "key.snowy.configkey": "Open the snowy configuration screen",
"snowy.clickbox.misc": "Miscellaneous", "snowy.clickbox.misc": "Miscellaneous",

View File

@ -13,7 +13,7 @@
"screen.snowy.config.behavior.zoom.factor": "Facteur de zoom", "screen.snowy.config.behavior.zoom.factor": "Facteur de zoom",
"screen.snowy.config.behavior.zoom.smoothcamera": "Caméra fluide pendant le zoom", "screen.snowy.config.behavior.zoom.smoothcamera": "Caméra fluide pendant le zoom",
"screen.snowy.config.behavior.keystrokes.position": "Position de l'élément keystrokes de l'ATH", "screen.snowy.config.behavior.keystrokes.position": "Position de l'élément keystrokes de l'ATH",
"category.snowy.keycategory": "SnowyGUI", "key.category.snowygui.controls": "SnowyGUI",
"key.snowy.opengui": "Ouvrir l'interface de snowy", "key.snowy.opengui": "Ouvrir l'interface de snowy",
"key.snowy.configkey": "Ouvrir l'écran de configuration de snowy", "key.snowy.configkey": "Ouvrir l'écran de configuration de snowy",
"snowy.clickbox.misc": "Divers", "snowy.clickbox.misc": "Divers",