diff --git a/src/main/java/net/moonleay/gimbal/client/config/ClientConfigHolder.kt b/src/main/java/net/moonleay/gimbal/client/config/ClientConfigHolder.kt
index c385f49..b4d38ba 100644
--- a/src/main/java/net/moonleay/gimbal/client/config/ClientConfigHolder.kt
+++ b/src/main/java/net/moonleay/gimbal/client/config/ClientConfigHolder.kt
@@ -47,6 +47,7 @@ class ClientConfigHolder(private val path: Path) {
}
}
+ // TODO: Support incomplete config files
@OptIn(ExperimentalSerializationApi::class)
fun save(conf: GimbalClientConfig) {
if (!path.isWritable()) {
diff --git a/src/main/java/net/moonleay/gimbal/client/config/GimbalClientConfig.kt b/src/main/java/net/moonleay/gimbal/client/config/GimbalClientConfig.kt
index b0184d7..f673f28 100644
--- a/src/main/java/net/moonleay/gimbal/client/config/GimbalClientConfig.kt
+++ b/src/main/java/net/moonleay/gimbal/client/config/GimbalClientConfig.kt
@@ -19,9 +19,10 @@
package net.moonleay.gimbal.client.config
import kotlinx.serialization.Serializable
+import net.moonleay.gimbal.client.config.enums.ToastSettings
@Serializable
data class GimbalClientConfig(
val guiSettings: GimbalGuiSettings = GimbalGuiSettings(),
- val showToasts: Boolean = true,
+ val toastSettings: ToastSettings = ToastSettings.ALL,
)
diff --git a/src/main/java/net/moonleay/gimbal/client/config/GimbalGuiSettings.kt b/src/main/java/net/moonleay/gimbal/client/config/GimbalGuiSettings.kt
index 7c24608..06755a1 100644
--- a/src/main/java/net/moonleay/gimbal/client/config/GimbalGuiSettings.kt
+++ b/src/main/java/net/moonleay/gimbal/client/config/GimbalGuiSettings.kt
@@ -19,6 +19,9 @@
package net.moonleay.gimbal.client.config
import kotlinx.serialization.Serializable
+import net.moonleay.gimbal.client.config.enums.HorizontalAnchor
+import net.moonleay.gimbal.client.config.enums.HudOptions
+import net.moonleay.gimbal.client.config.enums.VerticalAnchor
@Serializable
data class GimbalGuiSettings(
@@ -26,4 +29,5 @@ data class GimbalGuiSettings(
val offset: ScaledRes = ScaledRes(4.0, 4.0),
val horizontalAnchor: HorizontalAnchor = HorizontalAnchor.LEFT,
val verticalAnchor: VerticalAnchor = VerticalAnchor.TOP,
+ val hudOptions: HudOptions = HudOptions.ALL,
)
diff --git a/src/main/java/net/moonleay/gimbal/client/config/Centerpoint.kt b/src/main/java/net/moonleay/gimbal/client/config/enums/Centerpoint.kt
similarity index 94%
rename from src/main/java/net/moonleay/gimbal/client/config/Centerpoint.kt
rename to src/main/java/net/moonleay/gimbal/client/config/enums/Centerpoint.kt
index 2cb8029..a9cecc4 100644
--- a/src/main/java/net/moonleay/gimbal/client/config/Centerpoint.kt
+++ b/src/main/java/net/moonleay/gimbal/client/config/enums/Centerpoint.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package net.moonleay.gimbal.client.config
+package net.moonleay.gimbal.client.config.enums
enum class Centerpoint {
TOP_LEFT,
diff --git a/src/main/java/net/moonleay/gimbal/client/config/HorizontalAnchor.kt b/src/main/java/net/moonleay/gimbal/client/config/enums/HorizontalAnchor.kt
similarity index 94%
rename from src/main/java/net/moonleay/gimbal/client/config/HorizontalAnchor.kt
rename to src/main/java/net/moonleay/gimbal/client/config/enums/HorizontalAnchor.kt
index fa4dc4f..439a56f 100644
--- a/src/main/java/net/moonleay/gimbal/client/config/HorizontalAnchor.kt
+++ b/src/main/java/net/moonleay/gimbal/client/config/enums/HorizontalAnchor.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package net.moonleay.gimbal.client.config
+package net.moonleay.gimbal.client.config.enums
import kotlinx.serialization.Serializable
diff --git a/src/main/java/net/moonleay/gimbal/client/config/enums/HudOptions.kt b/src/main/java/net/moonleay/gimbal/client/config/enums/HudOptions.kt
new file mode 100644
index 0000000..e57f8c0
--- /dev/null
+++ b/src/main/java/net/moonleay/gimbal/client/config/enums/HudOptions.kt
@@ -0,0 +1,31 @@
+/*
+ * Gimbal
+ * Copyright (C) 2024 moonleay
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.moonleay.gimbal.client.config.enums
+
+import kotlinx.serialization.Serializable
+import net.minecraft.text.Text
+import net.moonleay.gimbal.constants.TranslationKeys
+
+@Serializable
+enum class HudOptions(val translatableText: Text) {
+ ALL(Text.translatable(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_ALL)),
+ NUMBER(Text.translatable(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_NUMBER)),
+ INITIAL(Text.translatable(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_INITIALS)),
+ ONLY_MODE(Text.translatable(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_MODE_ONLY)),
+}
diff --git a/src/main/java/net/moonleay/gimbal/client/config/enums/ToastSettings.kt b/src/main/java/net/moonleay/gimbal/client/config/enums/ToastSettings.kt
new file mode 100644
index 0000000..e581500
--- /dev/null
+++ b/src/main/java/net/moonleay/gimbal/client/config/enums/ToastSettings.kt
@@ -0,0 +1,32 @@
+/*
+ * Gimbal
+ * Copyright (C) 2024 moonleay
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.moonleay.gimbal.client.config.enums
+
+import kotlinx.serialization.Serializable
+import net.minecraft.text.Text
+import net.moonleay.gimbal.client.util.ToastType
+import net.moonleay.gimbal.constants.TranslationKeys
+
+@Serializable
+enum class ToastSettings(val translatableText: Text, val allowedTypes: List) {
+ ALL(Text.translatable(TranslationKeys.Gui.Config.Toasts.SHOW_ALL), listOf(ToastType.SYSTEM, ToastType.TOGGLE)),
+ ONLY_TOGGLE(Text.translatable(TranslationKeys.Gui.Config.Toasts.SHOW_TOGGLE), listOf(ToastType.TOGGLE)),
+ ONLY_SYSTEM(Text.translatable(TranslationKeys.Gui.Config.Toasts.SHOW_SYSTEM), listOf(ToastType.SYSTEM)),
+ NONE(Text.translatable(TranslationKeys.Gui.Config.Toasts.SHOW_NONE), listOf())
+}
diff --git a/src/main/java/net/moonleay/gimbal/client/config/VerticalAnchor.kt b/src/main/java/net/moonleay/gimbal/client/config/enums/VerticalAnchor.kt
similarity index 94%
rename from src/main/java/net/moonleay/gimbal/client/config/VerticalAnchor.kt
rename to src/main/java/net/moonleay/gimbal/client/config/enums/VerticalAnchor.kt
index 7fd660a..d3ae146 100644
--- a/src/main/java/net/moonleay/gimbal/client/config/VerticalAnchor.kt
+++ b/src/main/java/net/moonleay/gimbal/client/config/enums/VerticalAnchor.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package net.moonleay.gimbal.client.config
+package net.moonleay.gimbal.client.config.enums
import kotlinx.serialization.Serializable
diff --git a/src/main/java/net/moonleay/gimbal/client/editor/ClientEditor.kt b/src/main/java/net/moonleay/gimbal/client/editor/ClientEditor.kt
index dde4c56..2982db4 100644
--- a/src/main/java/net/moonleay/gimbal/client/editor/ClientEditor.kt
+++ b/src/main/java/net/moonleay/gimbal/client/editor/ClientEditor.kt
@@ -21,7 +21,11 @@ package net.moonleay.gimbal.client.editor
import net.minecraft.client.MinecraftClient
import net.minecraft.text.Text
import net.moonleay.gimbal.build.BuildConstants
+import net.moonleay.gimbal.client.ClientMain
+import net.moonleay.gimbal.client.config.GimbalClientConfig
+import net.moonleay.gimbal.client.config.enums.HudOptions
import net.moonleay.gimbal.client.util.ChatUtil
+import net.moonleay.gimbal.client.util.ToastType
import net.moonleay.gimbal.editor.ServerEditorManager
import net.moonleay.gimbal.editor.state.EditorState
import net.moonleay.gimbal.editor.state.GimbalPolicyType
@@ -121,7 +125,13 @@ object ClientEditor {
* */
fun setMode(mode: Mode) {
if (!isAllowed()) {
- ChatUtil.showToastToSelf("Gimbal is disabled", "You cannot change modes", MinecraftClient.getInstance())
+ ChatUtil.showToastToSelf(
+ "Gimbal is disabled",
+ "You cannot change modes",
+ ToastType.SYSTEM,
+ ClientMain.CONFIG.config,
+ MinecraftClient.getInstance()
+ )
return
}
if (!MinecraftClient.getInstance().player!!.isCreative)
@@ -136,23 +146,44 @@ object ClientEditor {
* */
fun toggleModifier(mod: ModeModifier) {
if (!isAllowed()) {
- ChatUtil.showToastToSelf("Gimbal is disabled", "You cannot change modifiers", MinecraftClient.getInstance())
+ ChatUtil.showToastToSelf(
+ "Gimbal is disabled",
+ "You cannot change modifiers",
+ ToastType.SYSTEM,
+ ClientMain.CONFIG.config,
+ MinecraftClient.getInstance()
+ )
return
}
if (!MinecraftClient.getInstance().player!!.isCreative)
return
if (CURRENT_MODE.incompatibleModifiers.contains(mod)){
- if (TEMP_DISABLED_MODIFIERS.contains(mod))
+ if (TEMP_DISABLED_MODIFIERS.contains(mod)) {
TEMP_DISABLED_MODIFIERS.remove(mod)
- else
+ } else {
TEMP_DISABLED_MODIFIERS.add(mod)
+ }
}
else {
- if (CURRENT_MODE_MODIFIER.contains(mod))
+ if (CURRENT_MODE_MODIFIER.contains(mod)) {
CURRENT_MODE_MODIFIER.remove(mod)
- else
+ ChatUtil.showToastToSelf(
+ "Disabled ${mod.displayName}",
+ "[${this.getDisplayNameListAsString(CURRENT_MODE_MODIFIER)}]",
+ ToastType.TOGGLE, ClientMain.CONFIG.config,
+ MinecraftClient.getInstance()
+ )
+
+ } else {
CURRENT_MODE_MODIFIER.add(mod)
+ ChatUtil.showToastToSelf(
+ "Enabled ${mod.displayName}",
+ "[${this.getDisplayNameListAsString(CURRENT_MODE_MODIFIER)}]",
+ ToastType.TOGGLE, ClientMain.CONFIG.config,
+ MinecraftClient.getInstance()
+ )
+ }
}
onUpdated()
@@ -199,14 +230,17 @@ object ClientEditor {
if(TEMP_DISABLED_MODIFIERS.isNotEmpty()) {
ChatUtil.showToastToSelf(
"${CURRENT_MODE.displayName} Mode disabled",
- getListAsString(TEMP_DISABLED_MODIFIERS), MinecraftClient.getInstance()
+ getDisplayNameListAsString(TEMP_DISABLED_MODIFIERS),
+ ToastType.SYSTEM,
+ ClientMain.CONFIG.config,
+ MinecraftClient.getInstance()
)
}
}
- private fun getListAsString(list: List): String{
+ private fun getDisplayNameListAsString(list: List): String {
if(list.isEmpty())
- return "Empty list"
+ return ""
val sb = StringBuilder()
for (mod in list) {
sb.append(mod.displayName)
@@ -215,25 +249,53 @@ object ClientEditor {
return sb.toString().dropLast(2)
}
+ private fun getShortNameListAsString(list: List): String {
+ if (list.isEmpty())
+ return ""
+ val sb = StringBuilder()
+ for (mod in list) {
+ sb.append(mod.shortName)
+ sb.append(", ")
+ }
+ return sb.toString().dropLast(2)
+ }
+
/*
* Get the display text to display in the HUD
* */
- fun getModeDisplayText(): Text {
+ fun getModeDisplayText(config: GimbalClientConfig): Text {
val displayText = StringBuilder(CURRENT_MODE.displayName)
- if (CURRENT_MODE_MODIFIER.isNotEmpty() && isAllowed() && MinecraftClient.getInstance().player?.isCreative == true) {
- displayText.append(" [")
- for (i in CURRENT_MODE_MODIFIER.indices) {
- displayText.append(CURRENT_MODE_MODIFIER[i].displayName)
- if (i != CURRENT_MODE_MODIFIER.size - 1) {
- displayText.append(", ")
+ if (isAllowed() && MinecraftClient.getInstance().player?.isCreative == true) {
+ when (config.guiSettings.hudOptions) {
+ HudOptions.ALL -> {
+ if (CURRENT_MODE_MODIFIER.size > 0) {
+ displayText.append(" [")
+ displayText.append(this.getDisplayNameListAsString(CURRENT_MODE_MODIFIER))
+ displayText.append("]")
+ }
+ return Text.of(displayText.toString())
}
+
+ HudOptions.NUMBER -> {
+ displayText.append(" (")
+ displayText.append(CURRENT_MODE_MODIFIER.size)
+ displayText.append(")")
+ return Text.of(displayText.toString())
+ }
+
+ HudOptions.INITIAL -> {
+ if (CURRENT_MODE_MODIFIER.size > 0) {
+ displayText.append(" [")
+ displayText.append(this.getShortNameListAsString(CURRENT_MODE_MODIFIER))
+ displayText.append("]")
+ }
+ return Text.of(displayText.toString())
+ }
+
+ HudOptions.ONLY_MODE -> return Text.of(displayText.toString())
}
- displayText.append("]")
- } else if (!isAllowed() || !MinecraftClient.getInstance().player?.isCreative!!) {
- displayText.clear()
- displayText.append("[GIMBAL DISABLED]")
}
- return Text.of(displayText.toString())
+ return Text.of("[GIMBAL DISABLED]")
}
fun getCurrentColor(): Int {
diff --git a/src/main/java/net/moonleay/gimbal/client/keybindings/KeybindingRegistrar.kt b/src/main/java/net/moonleay/gimbal/client/keybindings/KeybindingRegistrar.kt
index 83a0e6d..fd37f7d 100644
--- a/src/main/java/net/moonleay/gimbal/client/keybindings/KeybindingRegistrar.kt
+++ b/src/main/java/net/moonleay/gimbal/client/keybindings/KeybindingRegistrar.kt
@@ -30,6 +30,7 @@ import net.moonleay.gimbal.client.keybindings.impl.editormodemodifier.ToggleNoUp
import net.moonleay.gimbal.client.keybindings.impl.gamemode.CreativeModeShortcut
import net.moonleay.gimbal.client.keybindings.impl.gamemode.SpectatorModeShortcut
import net.moonleay.gimbal.client.keybindings.impl.gamemode.SurvivalModeShortcut
+import net.moonleay.gimbal.constants.TranslationKeys
import org.apache.logging.log4j.LogManager
import org.lwjgl.glfw.GLFW
@@ -47,28 +48,28 @@ object KeybindingRegistrar {
private fun registerSetEditorModeModifierKeybindings() {
val toggleBulldozerModifierShortcut = KeyBinding(
- "gimbal.key.editor.modifier.bulldozer",
+ TranslationKeys.Keybindings.Binding.Editor.Modifier.BULLDOZER,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
- "gimbal.category.editormodifier"
+ TranslationKeys.Keybindings.Category.Editor.MODIFIER
)
val toggleForcePlaceModifierShortcut = KeyBinding(
- "gimbal.key.editor.modifier.forceplace",
+ TranslationKeys.Keybindings.Binding.Editor.Modifier.FORCE_PLACE,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
- "gimbal.category.editormodifier"
+ TranslationKeys.Keybindings.Category.Editor.MODIFIER
)
val toggleNoUpdatesModifierShortcut = KeyBinding(
- "gimbal.key.editor.modifier.noupdates",
+ TranslationKeys.Keybindings.Binding.Editor.Modifier.NO_UPDATES,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
- "gimbal.category.editormodifier"
+ TranslationKeys.Keybindings.Category.Editor.MODIFIER
)
val toggleNoClipModifierShortcut = KeyBinding(
- "gimbal.key.editor.modifier.noclip",
+ TranslationKeys.Keybindings.Binding.Editor.Modifier.NO_CLIP,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
- "gimbal.category.editormodifier"
+ TranslationKeys.Keybindings.Category.Editor.MODIFIER
)
KeybindingManager.registerShortcut(ToggleBulldozerModifierShortcut(toggleBulldozerModifierShortcut))
@@ -79,16 +80,16 @@ object KeybindingRegistrar {
private fun registerSetEditorModeKeybindings() {
val insertKeyBinding = KeyBinding(
- "gimbal.key.editor.mode.insert",
+ TranslationKeys.Keybindings.Binding.Editor.Mode.INSERT,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_I,
- "gimbal.category.editormode"
+ TranslationKeys.Keybindings.Category.Editor.MODE
)
val replaceKeyBinding = KeyBinding(
- "gimbal.key.editor.mode.replace",
+ TranslationKeys.Keybindings.Binding.Editor.Mode.REPLACE,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_R,
- "gimbal.category.editormode"
+ TranslationKeys.Keybindings.Category.Editor.MODE
)
// val visualKeyBinding = KeyBinding(
// "gimbal.key.editor.mode.visual",
@@ -103,22 +104,22 @@ object KeybindingRegistrar {
private fun registerSetGameModeKeybindings() {
val survivalKeyBinding = KeyBinding(
- "gimbal.key.game.mode.survival",
+ TranslationKeys.Keybindings.Binding.Game.Mode.SURVIVAL,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
- "gimbal.category.gamemode"
+ TranslationKeys.Keybindings.Category.Game.GAMEMODE
)
val creativeKeyBinding = KeyBinding(
- "gimbal.key.game.mode.creative",
+ TranslationKeys.Keybindings.Binding.Game.Mode.CREATIVE,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
- "gimbal.category.gamemode"
+ TranslationKeys.Keybindings.Category.Game.GAMEMODE
)
val spectatorKeyBinding = KeyBinding(
- "gimbal.key.game.mode.spectator",
+ TranslationKeys.Keybindings.Binding.Game.Mode.SPECTATOR,
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
- "gimbal.category.gamemode"
+ TranslationKeys.Keybindings.Category.Game.GAMEMODE
)
KeybindingManager.registerShortcut(SurvivalModeShortcut(survivalKeyBinding))
KeybindingManager.registerShortcut(CreativeModeShortcut(creativeKeyBinding))
diff --git a/src/main/java/net/moonleay/gimbal/client/screen/GimbalEditHudGui.kt b/src/main/java/net/moonleay/gimbal/client/screen/GimbalEditHudGui.kt
index 6af484e..b7682d7 100644
--- a/src/main/java/net/moonleay/gimbal/client/screen/GimbalEditHudGui.kt
+++ b/src/main/java/net/moonleay/gimbal/client/screen/GimbalEditHudGui.kt
@@ -29,10 +29,11 @@ import net.moonleay.gimbal.client.config.GimbalClientConfig
import net.moonleay.gimbal.client.config.GimbalGuiSettings
import net.moonleay.gimbal.client.config.ScaledRes
import net.moonleay.gimbal.client.util.screen.ScreenUtil
+import net.moonleay.gimbal.constants.TranslationKeys
import org.apache.logging.log4j.LogManager
class GimbalEditHudGui(private val parent: Screen, private val cfg: ClientConfigHolder) :
- Screen(Text.translatable("gimbal.gui.edithud")) {
+ Screen(Text.translatable(TranslationKeys.Gui.Config.Hud.EDIT_HUD)) {
private val LOGGER = LogManager.getLogger(BuildConstants.modName)
private var tempXOffset = 4.0
@@ -47,7 +48,7 @@ class GimbalEditHudGui(private val parent: Screen, private val cfg: ClientConfig
override fun init() {
super.init()
this.addDrawableChild(ButtonWidget(
- this.width / 2 + 10, this.height - 27, 90, 20, Text.translatable("gimbal.gui.resethud")
+ this.width / 2 + 10, this.height - 27, 90, 20, Text.translatable(TranslationKeys.Gui.Config.Hud.RESET_HUD)
) { _: ButtonWidget? ->
tempXOffset = 4.0
tempYOffset = 4.0
@@ -75,7 +76,6 @@ class GimbalEditHudGui(private val parent: Screen, private val cfg: ClientConfig
val anchor = ScreenUtil.getAnchor(this.tempXOffset, this.tempYOffset)
val newConf = GimbalClientConfig(
- showToasts = oldConf.showToasts,
guiSettings = GimbalGuiSettings(
showHud = oldConf.guiSettings.showHud,
offset = ScaledRes(
@@ -83,8 +83,10 @@ class GimbalEditHudGui(private val parent: Screen, private val cfg: ClientConfig
scaledY = this.tempYOffset,
),
horizontalAnchor = anchor.first,
- verticalAnchor = anchor.second
- )
+ verticalAnchor = anchor.second,
+ hudOptions = oldConf.guiSettings.hudOptions
+ ),
+ toastSettings = oldConf.toastSettings
)
cfg.updateConfig(newConf)
@@ -104,8 +106,6 @@ class GimbalEditHudGui(private val parent: Screen, private val cfg: ClientConfig
if (!ScreenUtil.isPositionOutOfBounds(wantedX, wantedY)) {
this.tempXOffset = wantedX
this.tempYOffset = wantedY
- } else {
- LOGGER.info("Text is oob. wantedX: ${wantedX}, wantedY: ${wantedY}, width: ${this.client!!.window.width}, height: ${this.client!!.window.height}")
}
}
}
@@ -130,11 +130,11 @@ class GimbalEditHudGui(private val parent: Screen, private val cfg: ClientConfig
val anchor = ScreenUtil.getAnchor(this.tempXOffset, this.tempYOffset)
this.textRenderer.drawWithShadow(
matrices,
- Text.translatable("gimbal.gui.examplehud"),
+ Text.translatable(TranslationKeys.Gui.Config.Hud.EXAMPLE_HUD_TEXT),
ScreenUtil.getXForAnchor(
ScreenUtil.getReal(this.client!!.window.width, this.tempXOffset) / scaleFactor,
anchor.first,
- this.textRenderer.getWidth(Text.translatable("gimbal.gui.examplehud"))
+ this.textRenderer.getWidth(Text.translatable(TranslationKeys.Gui.Config.Hud.EXAMPLE_HUD_TEXT))
),
ScreenUtil.getYForAnchor(
ScreenUtil.getReal(this.client!!.window.height, this.tempYOffset) / scaleFactor,
@@ -142,11 +142,7 @@ class GimbalEditHudGui(private val parent: Screen, private val cfg: ClientConfig
this.textRenderer.fontHeight
),
0xFFFFFF
- ) // TODO: improve placement when changing the scaling
-// LOGGER.info("width: ${this.width}, height: ${this.height}," +
-// " posX: ${ScreenUtil.getReal(this.width, this.tempXOffset)}," +
-// " posY: ${ScreenUtil.getReal(this.height, this.tempYOffset)}," +
-// " scaleX: ${this.tempXOffset}, scaleY: ${this.tempYOffset}")
+ )
super.render(matrices, mouseX, mouseY, delta)
}
}
diff --git a/src/main/java/net/moonleay/gimbal/client/screen/GimbalSettingsGui.kt b/src/main/java/net/moonleay/gimbal/client/screen/GimbalSettingsGui.kt
index 0885102..c2cd5c0 100644
--- a/src/main/java/net/moonleay/gimbal/client/screen/GimbalSettingsGui.kt
+++ b/src/main/java/net/moonleay/gimbal/client/screen/GimbalSettingsGui.kt
@@ -27,9 +27,21 @@ import net.minecraft.text.Text
import net.moonleay.gimbal.client.config.ClientConfigHolder
import net.moonleay.gimbal.client.config.GimbalClientConfig
import net.moonleay.gimbal.client.config.GimbalGuiSettings
+import net.moonleay.gimbal.client.config.enums.HudOptions
+import net.moonleay.gimbal.client.config.enums.ToastSettings
+import net.moonleay.gimbal.constants.TranslationKeys
class GimbalSettingsGui(private val parent: Screen, private val cfg: ClientConfigHolder) :
- Screen(Text.translatable("gimbal.gui.settings")) {
+ Screen(Text.translatable(TranslationKeys.Gui.Config.SCREEN_NAME)) {
+
+ private var hudOptions: HudOptions
+ private var toastSettings: ToastSettings
+
+ init {
+ this.hudOptions = cfg.config.guiSettings.hudOptions
+ this.toastSettings = cfg.config.toastSettings
+ }
+
override fun init() {
this.addDrawableChild(CyclingButtonWidget.onOffBuilder(
// Text.translatable("gimbal.gui.enabled"),
@@ -41,7 +53,7 @@ class GimbalSettingsGui(private val parent: Screen, private val cfg: ClientConfi
this.height / 6 + 24 * 0,
150,
20,
- Text.translatable("gimbal.gui.hud")
+ Text.translatable(TranslationKeys.Gui.Config.Hud.SHOW_HUD)
) { _: CyclingButtonWidget?, isEnabled: Boolean? ->
val oldGui = cfg.config.guiSettings
val newGui = GimbalGuiSettings(
@@ -49,24 +61,120 @@ class GimbalSettingsGui(private val parent: Screen, private val cfg: ClientConfi
offset = oldGui.offset,
horizontalAnchor = oldGui.horizontalAnchor,
verticalAnchor = oldGui.verticalAnchor,
+ hudOptions = oldGui.hudOptions
)
val newConf = GimbalClientConfig(
guiSettings = newGui,
- showToasts = cfg.config.showToasts
+ toastSettings = cfg.config.toastSettings
)
cfg.updateConfig(newConf)
})
+
this.addDrawableChild(ButtonWidget(
this.width / 2 - 155 + 160,
this.height / 6 + 24 * 0,
150,
20,
- Text.translatable("gimbal.gui.edithud")
+ Text.translatable(TranslationKeys.Gui.Config.Hud.EDIT_HUD)
) { _: ButtonWidget? ->
this.client!!.setScreen(GimbalEditHudGui(this, cfg))
- }
+ })
+
+ this.addDrawableChild>(
+ CyclingButtonWidget.builder { value: HudOptions? ->
+ when (value) {
+ HudOptions.ALL -> {
+ return@builder HudOptions.ALL.translatableText
+ }
+
+ HudOptions.NUMBER -> {
+ return@builder HudOptions.NUMBER.translatableText
+ }
+
+ HudOptions.INITIAL -> {
+ return@builder HudOptions.INITIAL.translatableText
+ }
+
+ HudOptions.ONLY_MODE -> {
+ return@builder HudOptions.ONLY_MODE.translatableText
+ }
+
+ else -> return@builder Text.translatable(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_ALL)
+ }
+ }
+ .values(HudOptions.entries)
+ .initially(this.hudOptions)
+ .build(
+ this.width / 2 - 155,
+ this.height / 6 + 24 * 1,
+ 150,
+ 20,
+ Text.translatable(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_MODIFIERS)
+ ) { _: CyclingButtonWidget?, hudDO: HudOptions ->
+ this.hudOptions = hudDO
+
+ val oldConfig = cfg.config
+ val oldGuiConfig = oldConfig.guiSettings
+ val newConfig = GimbalClientConfig(
+ guiSettings = GimbalGuiSettings(
+ horizontalAnchor = oldGuiConfig.horizontalAnchor,
+ verticalAnchor = oldGuiConfig.verticalAnchor,
+ showHud = oldGuiConfig.showHud,
+ offset = oldGuiConfig.offset,
+ hudOptions = this.hudOptions
+ ),
+ toastSettings = oldConfig.toastSettings
+ )
+ cfg.updateConfig(newConfig)
+ }
)
+
+ this.addDrawableChild>(
+ CyclingButtonWidget.builder { value: ToastSettings? ->
+ when (value) {
+ ToastSettings.ALL -> {
+ return@builder ToastSettings.ALL.translatableText
+ }
+
+ ToastSettings.ONLY_TOGGLE -> {
+ return@builder ToastSettings.ONLY_TOGGLE.translatableText
+ }
+
+ ToastSettings.ONLY_SYSTEM -> {
+ return@builder ToastSettings.ONLY_SYSTEM.translatableText
+ }
+
+ ToastSettings.NONE -> {
+ return@builder ToastSettings.NONE.translatableText
+ }
+
+ else -> return@builder Text.translatable(TranslationKeys.Gui.Config.Toasts.SHOW_ALL)
+ }
+ }
+ .values(ToastSettings.entries)
+ .initially(this.toastSettings)
+ .build(
+ this.width / 2 - 155 + 160,
+ this.height / 6 + 24 * 1,
+ 150,
+ 20,
+ Text.translatable(TranslationKeys.Gui.Config.Toasts.SHOW_TOASTS)
+ ) { _: CyclingButtonWidget?, toastStng: ToastSettings ->
+ this.toastSettings = toastStng
+
+ val oldConfig = cfg.config
+ val newConfig = GimbalClientConfig(
+ guiSettings = oldConfig.guiSettings,
+ toastSettings = this.toastSettings
+ )
+ cfg.updateConfig(newConfig)
+ }
+ )
+
+
+
+
// Done button
this.addDrawableChild(ButtonWidget(
this.width / 2 - 100, this.height / 6 + 168, 200, 20, ScreenTexts.DONE
diff --git a/src/main/java/net/moonleay/gimbal/client/util/ChatUtil.kt b/src/main/java/net/moonleay/gimbal/client/util/ChatUtil.kt
index 9fd2b18..b53d959 100644
--- a/src/main/java/net/moonleay/gimbal/client/util/ChatUtil.kt
+++ b/src/main/java/net/moonleay/gimbal/client/util/ChatUtil.kt
@@ -21,6 +21,7 @@ package net.moonleay.gimbal.client.util
import net.minecraft.client.MinecraftClient
import net.minecraft.client.toast.SystemToast
import net.minecraft.text.Text
+import net.moonleay.gimbal.client.config.GimbalClientConfig
object ChatUtil {
/**
@@ -37,7 +38,16 @@ object ChatUtil {
client.inGameHud.chatHud.addMessage(Text.of(message))
}
- fun showToastToSelf(title: String, description: String, client: MinecraftClient) {
+ fun showToastToSelf(
+ title: String,
+ description: String,
+ type: ToastType,
+ config: GimbalClientConfig,
+ client: MinecraftClient,
+ ) {
+ if (!config.toastSettings.allowedTypes.contains(type))
+ return
+
val toast = SystemToast(SystemToast.Type.PERIODIC_NOTIFICATION, Text.of(title), Text.of(description))
client.toastManager.add(toast)
}
diff --git a/src/main/java/net/moonleay/gimbal/client/util/ToastType.kt b/src/main/java/net/moonleay/gimbal/client/util/ToastType.kt
new file mode 100644
index 0000000..4dc9312
--- /dev/null
+++ b/src/main/java/net/moonleay/gimbal/client/util/ToastType.kt
@@ -0,0 +1,24 @@
+/*
+ * Gimbal
+ * Copyright (C) 2024 moonleay
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.moonleay.gimbal.client.util
+
+enum class ToastType {
+ TOGGLE,
+ SYSTEM,
+}
diff --git a/src/main/java/net/moonleay/gimbal/client/util/screen/ScreenUtil.kt b/src/main/java/net/moonleay/gimbal/client/util/screen/ScreenUtil.kt
index 9c0c130..5a5d4f7 100644
--- a/src/main/java/net/moonleay/gimbal/client/util/screen/ScreenUtil.kt
+++ b/src/main/java/net/moonleay/gimbal/client/util/screen/ScreenUtil.kt
@@ -18,8 +18,8 @@
package net.moonleay.gimbal.client.util.screen
-import net.moonleay.gimbal.client.config.HorizontalAnchor
-import net.moonleay.gimbal.client.config.VerticalAnchor
+import net.moonleay.gimbal.client.config.enums.HorizontalAnchor
+import net.moonleay.gimbal.client.config.enums.VerticalAnchor
object ScreenUtil {
diff --git a/src/main/java/net/moonleay/gimbal/constants/TranslationKeys.kt b/src/main/java/net/moonleay/gimbal/constants/TranslationKeys.kt
new file mode 100644
index 0000000..6d4c355
--- /dev/null
+++ b/src/main/java/net/moonleay/gimbal/constants/TranslationKeys.kt
@@ -0,0 +1,123 @@
+/*
+ * Gimbal
+ * Copyright (C) 2024 moonleay
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.moonleay.gimbal.constants
+
+import net.moonleay.gimbal.build.BuildConstants
+
+object TranslationKeys {
+ object Gui {
+ const val BASE = "gui.${BuildConstants.modId}."
+
+ object Config {
+ const val BASE = "${TranslationKeys.Gui.BASE}conf."
+
+ const val SCREEN_NAME = "${BASE}settings"
+ const val GENERIC_ENABLED = "${BASE}enabled"
+ const val GENERIC_DISABLED = "${BASE}disabled"
+
+ object Hud {
+ const val BASE = "${TranslationKeys.Gui.Config.BASE}hud."
+
+ const val SHOW_HUD = "${BASE}show"
+ const val EDIT_HUD = "${BASE}edit"
+ const val RESET_HUD = "${BASE}reset"
+ const val EXAMPLE_HUD_TEXT = "${BASE}example"
+
+ object Modifiers {
+ const val BASE = "${TranslationKeys.Gui.Config.Hud.BASE}modifiers."
+
+ const val SHOW_MODIFIERS = "${BASE}show"
+ const val SHOW_ALL = "${BASE}all"
+ const val SHOW_NUMBER = "${BASE}number"
+ const val SHOW_INITIALS = "${BASE}initials"
+ const val SHOW_MODE_ONLY = "${BASE}modeOnly"
+ }
+ }
+
+ object Toasts {
+ const val BASE = "${TranslationKeys.Gui.Config.BASE}toasts."
+
+ const val SHOW_TOASTS = "${BASE}show"
+ const val SHOW_ALL = "${BASE}all"
+ const val SHOW_TOGGLE = "${BASE}toggle"
+ const val SHOW_SYSTEM = "${BASE}system"
+ const val SHOW_NONE = "${BASE}none"
+ }
+ }
+ }
+
+ object Keybindings {
+ // No base here, Categories and Bindings have separate BASEs
+ object Category {
+ const val BASE = "category.${BuildConstants.modId}."
+
+ object Editor {
+ const val BASE = "${TranslationKeys.Keybindings.Category.BASE}editor."
+
+ const val MODE = "${BASE}mode"
+ const val MODIFIER = "${BASE}modifier"
+ }
+
+ object Game {
+ const val BASE = "${TranslationKeys.Keybindings.Category.BASE}game."
+
+ const val GAMEMODE = "${BASE}mode"
+ }
+ }
+
+ object Binding {
+ const val BASE = "key.${BuildConstants.modId}."
+
+ object Editor {
+ const val BASE = "${TranslationKeys.Keybindings.Binding.BASE}editor."
+
+ object Mode {
+ const val BASE = "${TranslationKeys.Keybindings.Binding.Editor.BASE}mode."
+
+ const val INSERT = "${BASE}insert"
+ const val REPLACE = "${BASE}replace"
+ const val VISUAL = "${BASE}visual"
+ }
+
+ object Modifier {
+ const val BASE = "${TranslationKeys.Keybindings.Binding.Editor.BASE}modifier."
+
+ const val BULLDOZER = "${BASE}autoClicker"
+ const val FORCE_PLACE = "${BASE}forcePlace"
+ const val NO_UPDATES = "${BASE}noUpdates"
+ const val NO_CLIP = "${BASE}noClip"
+ }
+ }
+
+ object Game {
+ const val BASE = "${TranslationKeys.Keybindings.Binding.BASE}game."
+
+ object Mode {
+ const val BASE = "${TranslationKeys.Keybindings.Binding.Game.BASE}mode."
+
+ const val SURVIVAL = "${BASE}survival"
+ const val CREATIVE = "${BASE}creative"
+ const val SPECTATOR = "${BASE}spectator"
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/src/main/java/net/moonleay/gimbal/datagen/En_us_GimbalLanguageProvider.kt b/src/main/java/net/moonleay/gimbal/datagen/En_us_GimbalLanguageProvider.kt
index 0082df9..666e1fe 100644
--- a/src/main/java/net/moonleay/gimbal/datagen/En_us_GimbalLanguageProvider.kt
+++ b/src/main/java/net/moonleay/gimbal/datagen/En_us_GimbalLanguageProvider.kt
@@ -20,6 +20,7 @@ package net.moonleay.gimbal.datagen
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider
+import net.moonleay.gimbal.constants.TranslationKeys
class En_us_GimbalLanguageProvider(dataGenerator: FabricDataGenerator?) :
FabricLanguageProvider(dataGenerator, "en_us") {
@@ -28,35 +29,63 @@ class En_us_GimbalLanguageProvider(dataGenerator: FabricDataGenerator?) :
if (translationBuilder == null) return
/// Screens
// Gimbal settings screen
- translationBuilder.add("gimbal.gui.settings", "Gimbal Settings")
- translationBuilder.add("gimbal.gui.hud", "Show HUD")
- translationBuilder.add("gimbal.gui.edithud", "Edit HUD Layout...")
- translationBuilder.add("gimbal.gui.resethud", "Reset Layout")
- translationBuilder.add("gimbal.gui.examplehud", "EXAMPLE [No Clip, Force]")
+ translationBuilder.add(TranslationKeys.Gui.Config.SCREEN_NAME, "Gimbal Settings")
+
+ // Hud
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.SHOW_HUD, "Show HUD")
- translationBuilder.add("gimbal.gui.enabled", "Enabled")
- translationBuilder.add("gimbal.gui.disabled", "Disabled")
+ //Gimbal HUD pos edit
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.EDIT_HUD, "Edit HUD Layout...")
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.RESET_HUD, "Reset Layout")
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.EXAMPLE_HUD_TEXT, "EXAMPLE [No Clip, Force]")
+
+ //Gimbal HUD Content
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_MODIFIERS, "Show Modifiers")
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_ALL, "All")
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_NUMBER, "Number")
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_INITIALS, "Short")
+ translationBuilder.add(TranslationKeys.Gui.Config.Hud.Modifiers.SHOW_MODE_ONLY, "None")
+
+ //Gimbal Toasts
+ translationBuilder.add(TranslationKeys.Gui.Config.Toasts.SHOW_TOASTS, "Show Toasts")
+ translationBuilder.add(TranslationKeys.Gui.Config.Toasts.SHOW_ALL, "All")
+ translationBuilder.add(TranslationKeys.Gui.Config.Toasts.SHOW_TOGGLE, "Only toggle")
+ translationBuilder.add(TranslationKeys.Gui.Config.Toasts.SHOW_SYSTEM, "Only system")
+ translationBuilder.add(TranslationKeys.Gui.Config.Toasts.SHOW_NONE, "None")
+
+ // Gimbal Generic Gui
+ translationBuilder.add(TranslationKeys.Gui.Config.GENERIC_ENABLED, "Enabled")
+ translationBuilder.add(TranslationKeys.Gui.Config.GENERIC_DISABLED, "Disabled")
/// Options
// Editor modes
- translationBuilder.add("gimbal.category.editormode", "Editor Modes")
- translationBuilder.add("gimbal.key.editor.mode.insert", "Enter Insert Mode")
- translationBuilder.add("gimbal.key.editor.mode.replace", "Enter Replace Mode")
- translationBuilder.add("gimbal.key.editor.mode.visual", "Enter Visual Mode")
+ translationBuilder.add(TranslationKeys.Keybindings.Category.Editor.MODE, "Editor Modes")
+ translationBuilder.add(TranslationKeys.Keybindings.Binding.Editor.Mode.INSERT, "Enter Insert Mode")
+ translationBuilder.add(TranslationKeys.Keybindings.Binding.Editor.Mode.REPLACE, "Enter Replace Mode")
+ translationBuilder.add(TranslationKeys.Keybindings.Binding.Editor.Mode.VISUAL, "Enter Visual Mode")
// Editor mode modifiers
- translationBuilder.add("gimbal.category.editormodifier", "Editor Mode Modifiers")
- translationBuilder.add("gimbal.key.editor.modifier.bulldozer", "Toggle Bulldozer Modifier")
- translationBuilder.add("gimbal.key.editor.modifier.forceplace", "Toggle Force Place Modifier")
- translationBuilder.add("gimbal.key.editor.modifier.noupdates", "Toggle No Updates Modifier")
- translationBuilder.add("gimbal.key.editor.modifier.noclip", "Toggle No Clip Modifier")
+ translationBuilder.add(TranslationKeys.Keybindings.Category.Editor.MODIFIER, "Editor Mode Modifiers")
+ translationBuilder.add(
+ TranslationKeys.Keybindings.Binding.Editor.Modifier.BULLDOZER,
+ "Toggle Bulldozer Modifier"
+ )
+ translationBuilder.add(
+ TranslationKeys.Keybindings.Binding.Editor.Modifier.FORCE_PLACE,
+ "Toggle Force Place Modifier"
+ )
+ translationBuilder.add(
+ TranslationKeys.Keybindings.Binding.Editor.Modifier.NO_UPDATES,
+ "Toggle No Updates Modifier"
+ )
+ translationBuilder.add(TranslationKeys.Keybindings.Binding.Editor.Modifier.NO_CLIP, "Toggle No Clip Modifier")
// Game mode
- translationBuilder.add("gimbal.category.gamemode", "Game Mode")
- translationBuilder.add("gimbal.key.game.mode.survival", "Enable Survival Mode")
- translationBuilder.add("gimbal.key.game.mode.creative", "Enable Creative Mode")
- translationBuilder.add("gimbal.key.game.mode.spectator", "Enable Spectator Mode")
+ translationBuilder.add(TranslationKeys.Keybindings.Category.Game.GAMEMODE, "Game Mode")
+ translationBuilder.add(TranslationKeys.Keybindings.Binding.Game.Mode.SURVIVAL, "Enable Survival Mode")
+ translationBuilder.add(TranslationKeys.Keybindings.Binding.Game.Mode.CREATIVE, "Enable Creative Mode")
+ translationBuilder.add(TranslationKeys.Keybindings.Binding.Game.Mode.SPECTATOR, "Enable Spectator Mode")
}
}
diff --git a/src/main/java/net/moonleay/gimbal/editor/state/mode/ModeModifier.kt b/src/main/java/net/moonleay/gimbal/editor/state/mode/ModeModifier.kt
index 221941f..da99041 100644
--- a/src/main/java/net/moonleay/gimbal/editor/state/mode/ModeModifier.kt
+++ b/src/main/java/net/moonleay/gimbal/editor/state/mode/ModeModifier.kt
@@ -18,10 +18,10 @@
package net.moonleay.gimbal.editor.state.mode
-enum class ModeModifier(val displayName: String) {
+enum class ModeModifier(val displayName: String, val shortName: String) {
// NONE("None"), // No Modifiers - default behavior
- NO_UPDATES("NO UPDATES"), // Do not update blocks when placing
- BULLDOZER("BULLDOZER"), // Break blocks fast
- FORCE_PLACE("FORCE"), // Ignore block placement restrictions
- NO_CLIP("NO CLIP"), // Do not collide with blocks
+NO_UPDATES("NO UPDATES", "NU"), // Do not update blocks when placing
+ BULLDOZER("BULLDOZER", "BLR"), // Break blocks fast
+ FORCE_PLACE("FORCE", "FP"), // Ignore block placement restrictions
+ NO_CLIP("NO CLIP", "NC"), // Do not collide with blocks
}
diff --git a/src/main/java/net/moonleay/gimbal/mixin/HudMixin.java b/src/main/java/net/moonleay/gimbal/mixin/HudMixin.java
index 607c7f2..5c0f58f 100644
--- a/src/main/java/net/moonleay/gimbal/mixin/HudMixin.java
+++ b/src/main/java/net/moonleay/gimbal/mixin/HudMixin.java
@@ -50,7 +50,7 @@ public abstract class HudMixin {
this.client.options.getGuiScale().getValue(),
this.client.forcesUnicodeFont()
);
- Text displayText = ClientEditor.INSTANCE.getModeDisplayText();
+ Text displayText = ClientEditor.INSTANCE.getModeDisplayText(ClientMain.CONFIG.getConfig());
tr.drawWithShadow(
matrices,
displayText,
diff --git a/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin.java b/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin.java
index 861ecd3..f86f610 100644
--- a/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin.java
+++ b/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin.java
@@ -26,6 +26,7 @@ import net.minecraft.util.Identifier;
import net.moonleay.gimbal.build.BuildConstants;
import net.moonleay.gimbal.client.ClientMain;
import net.moonleay.gimbal.client.screen.GimbalSettingsGui;
+import net.moonleay.gimbal.constants.TranslationKeys;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -59,7 +60,7 @@ public class YouInjectButtonMixin extends Screen {
20,
40,
button -> this.client.setScreen(new GimbalSettingsGui(this, ClientMain.CONFIG)),
- Text.translatable("gimbal.gui.settings")
+ Text.translatable(TranslationKeys.Gui.Config.SCREEN_NAME)
)
);
}
diff --git a/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin2.java b/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin2.java
index 70af1f4..b25789d 100644
--- a/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin2.java
+++ b/src/main/java/net/moonleay/gimbal/mixin/YouInjectButtonMixin2.java
@@ -26,6 +26,7 @@ import net.minecraft.util.Identifier;
import net.moonleay.gimbal.build.BuildConstants;
import net.moonleay.gimbal.client.ClientMain;
import net.moonleay.gimbal.client.screen.GimbalSettingsGui;
+import net.moonleay.gimbal.constants.TranslationKeys;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -58,7 +59,7 @@ public class YouInjectButtonMixin2 extends Screen {
20,
40,
button -> this.client.setScreen(new GimbalSettingsGui(this, ClientMain.CONFIG)),
- Text.translatable("gimbal.gui.settings")
+ Text.translatable(TranslationKeys.Gui.Config.SCREEN_NAME)
)
);
}