mirror of
https://codeberg.org/moonleay/Gimbal.git
synced 2024-11-25 22:22:10 +00:00
feat: added TranslatableText support
This commit is contained in:
parent
05db012b85
commit
7be72ac9d9
6 changed files with 57 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,6 +3,7 @@ build/
|
|||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
generated/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/
|
||||
|
|
|
@ -53,6 +53,10 @@ repositories {
|
|||
}
|
||||
}
|
||||
|
||||
fabricApi {
|
||||
configureDataGeneration()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// To change the versions see the gradle.properties file
|
||||
minecraft("com.mojang:minecraft:$minecraftVersion")
|
||||
|
@ -98,6 +102,7 @@ tasks {
|
|||
withType<ProcessResources> {
|
||||
filteringCharset = "UTF-8"
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
inputs.properties(templateProps)
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(templateProps)
|
||||
|
@ -117,13 +122,11 @@ tasks {
|
|||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) {
|
||||
options.release.set(targetJavaVersion)
|
||||
}
|
||||
|
||||
dependsOn("generateTemplates", "processResources")
|
||||
}
|
||||
|
||||
withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = targetJavaVersion.toString()
|
||||
|
||||
dependsOn("generateTemplates", "processResources")
|
||||
}
|
||||
withType<Jar> {
|
||||
|
@ -132,7 +135,7 @@ tasks {
|
|||
}
|
||||
|
||||
archiveBaseName.set(mavenArtifact)
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
dependsOn("generateTemplates", "processResources")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,25 +33,25 @@ object KeybindingRegistrar {
|
|||
"gimble.key.editor.modifier.bulldozer",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_B,
|
||||
"category.gimble.editormodifier"
|
||||
"gimble.category.editormodifier"
|
||||
)
|
||||
val toggleForcePlaceModifierShortcut = KeyBinding(
|
||||
"gimble.key.editor.modifier.forceplace",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_F,
|
||||
"category.gimble.editormodifier"
|
||||
"gimble.category.editormodifier"
|
||||
)
|
||||
val toggleNoUpdatesModifierShortcut = KeyBinding(
|
||||
"gimble.key.editor.modifier.noupdates",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_N,
|
||||
"category.gimble.editormodifier"
|
||||
"gimble.category.editormodifier"
|
||||
)
|
||||
val toggleNoClipModifierShortcut = KeyBinding(
|
||||
"gimble.key.editor.modifier.noclip",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_C,
|
||||
"category.gimble.editormodifier"
|
||||
"gimble.category.editormodifier"
|
||||
)
|
||||
|
||||
KeybindingManager.registerShortcut(ToggleBulldozerModifierShortcut(toggleBulldozerModifierShortcut))
|
||||
|
@ -65,19 +65,19 @@ object KeybindingRegistrar {
|
|||
"gimble.key.editor.mode.insert",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_I,
|
||||
"category.gimble.editormode"
|
||||
"gimble.category.editormode"
|
||||
)
|
||||
val replaceKeyBinding = KeyBinding(
|
||||
"gimble.key.editor.mode.replace",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_R,
|
||||
"category.gimble.editormode"
|
||||
"gimble.category.editormode"
|
||||
)
|
||||
val visualKeyBinding = KeyBinding(
|
||||
"gimble.key.editor.mode.visual",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_V,
|
||||
"category.gimble.editormode"
|
||||
"gimble.category.editormode"
|
||||
)
|
||||
KeybindingManager.registerShortcut(EnableInsertModeShortcut(insertKeyBinding))
|
||||
KeybindingManager.registerShortcut(EnableReplaceModeShortcut(replaceKeyBinding))
|
||||
|
@ -89,19 +89,19 @@ object KeybindingRegistrar {
|
|||
"gimble.key.game.mode.survival",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_UNKNOWN,
|
||||
"category.gimble.gamemode"
|
||||
"gimble.category.gamemode"
|
||||
)
|
||||
val creativeKeyBinding = KeyBinding(
|
||||
"gimble.key.game.mode.creative",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_UNKNOWN,
|
||||
"category.gimble.gamemode"
|
||||
"gimble.category.gamemode"
|
||||
)
|
||||
val spectatorKeyBinding = KeyBinding(
|
||||
"gimble.key.game.mode.spectator",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_UNKNOWN,
|
||||
"category.gimble.gamemode"
|
||||
"gimble.category.gamemode"
|
||||
)
|
||||
KeybindingManager.registerShortcut(SurvivalModeShortcut(survivalKeyBinding))
|
||||
KeybindingManager.registerShortcut(CreativeModeShortcut(creativeKeyBinding))
|
||||
|
|
|
@ -10,5 +10,6 @@ internal class DataGenerator : DataGeneratorEntrypoint {
|
|||
|
||||
override fun onInitializeDataGenerator(fabricDataGenerator: FabricDataGenerator) {
|
||||
LOGGER.info("Starting Data Generation")
|
||||
fabricDataGenerator.addProvider(En_us_GimbleLanguageProvider(fabricDataGenerator))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package net.moonleay.mods.gimble.datagen
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider
|
||||
|
||||
class En_us_GimbleLanguageProvider(dataGenerator: FabricDataGenerator?) :
|
||||
FabricLanguageProvider(dataGenerator, "en_us") {
|
||||
|
||||
override fun generateTranslations(translationBuilder: TranslationBuilder?) {
|
||||
if (translationBuilder == null) return
|
||||
// Editor modes
|
||||
translationBuilder.add("gimble.category.editormode", "Editor Modes")
|
||||
translationBuilder.add("gimble.key.editor.mode.insert", "Enter Insert Mode")
|
||||
translationBuilder.add("gimble.key.editor.mode.replace", "Enter Replace Mode")
|
||||
translationBuilder.add("gimble.key.editor.mode.visual", "Enter Visual Mode")
|
||||
|
||||
|
||||
// Editor mode modifiers
|
||||
translationBuilder.add("gimble.category.editormodifier", "Editor Mode Modifiers")
|
||||
translationBuilder.add("gimble.key.editor.modifier.bulldozer", "Toggle Bulldozer Modifier")
|
||||
translationBuilder.add("gimble.key.editor.modifier.forceplace", "Toggle Force Place Modifier")
|
||||
translationBuilder.add("gimble.key.editor.modifier.noupdates", "Toggle No Updates Modifier")
|
||||
translationBuilder.add("gimble.key.editor.modifier.noclip", "Toggle No Clip Modifier")
|
||||
|
||||
// Game mode
|
||||
translationBuilder.add("gimble.category.gamemode", "Game Mode")
|
||||
translationBuilder.add("gimble.key.game.mode.survival", "Enable Survival Mode")
|
||||
translationBuilder.add("gimble.key.game.mode.creative", "Enable Creative Mode")
|
||||
translationBuilder.add("gimble.key.game.mode.spectator", "Enable Spectator Mode")
|
||||
|
||||
}
|
||||
}
|
|
@ -22,6 +22,12 @@
|
|||
"adapter": "kotlin",
|
||||
"value": "net.moonleay.mods.gimble.Main"
|
||||
}
|
||||
],
|
||||
"fabric-datagen": [
|
||||
{
|
||||
"adapter": "kotlin",
|
||||
"value": "net.moonleay.mods.gimble.datagen.DataGenerator"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
|
|
Loading…
Reference in a new issue