mirror of
https://codeberg.org/moonleay/Gimble.git
synced 2024-11-22 23:02:53 +00:00
feat: added TranslatableText support
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
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
!**/src/main/**/build/
|
!**/src/main/**/build/
|
||||||
!**/src/test/**/build/
|
!**/src/test/**/build/
|
||||||
|
generated/
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea/
|
.idea/
|
||||||
|
|
|
@ -53,6 +53,10 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fabricApi {
|
||||||
|
configureDataGeneration()
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// To change the versions see the gradle.properties file
|
// To change the versions see the gradle.properties file
|
||||||
minecraft("com.mojang:minecraft:$minecraftVersion")
|
minecraft("com.mojang:minecraft:$minecraftVersion")
|
||||||
|
@ -98,6 +102,7 @@ tasks {
|
||||||
withType<ProcessResources> {
|
withType<ProcessResources> {
|
||||||
filteringCharset = "UTF-8"
|
filteringCharset = "UTF-8"
|
||||||
|
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
inputs.properties(templateProps)
|
inputs.properties(templateProps)
|
||||||
filesMatching("fabric.mod.json") {
|
filesMatching("fabric.mod.json") {
|
||||||
expand(templateProps)
|
expand(templateProps)
|
||||||
|
@ -117,13 +122,11 @@ tasks {
|
||||||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) {
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) {
|
||||||
options.release.set(targetJavaVersion)
|
options.release.set(targetJavaVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependsOn("generateTemplates", "processResources")
|
dependsOn("generateTemplates", "processResources")
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<KotlinCompile> {
|
withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = targetJavaVersion.toString()
|
kotlinOptions.jvmTarget = targetJavaVersion.toString()
|
||||||
|
|
||||||
dependsOn("generateTemplates", "processResources")
|
dependsOn("generateTemplates", "processResources")
|
||||||
}
|
}
|
||||||
withType<Jar> {
|
withType<Jar> {
|
||||||
|
@ -132,7 +135,7 @@ tasks {
|
||||||
}
|
}
|
||||||
|
|
||||||
archiveBaseName.set(mavenArtifact)
|
archiveBaseName.set(mavenArtifact)
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
dependsOn("generateTemplates", "processResources")
|
dependsOn("generateTemplates", "processResources")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,25 +33,25 @@ object KeybindingRegistrar {
|
||||||
"gimble.key.editor.modifier.bulldozer",
|
"gimble.key.editor.modifier.bulldozer",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_B,
|
GLFW.GLFW_KEY_B,
|
||||||
"category.gimble.editormodifier"
|
"gimble.category.editormodifier"
|
||||||
)
|
)
|
||||||
val toggleForcePlaceModifierShortcut = KeyBinding(
|
val toggleForcePlaceModifierShortcut = KeyBinding(
|
||||||
"gimble.key.editor.modifier.forceplace",
|
"gimble.key.editor.modifier.forceplace",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_F,
|
GLFW.GLFW_KEY_F,
|
||||||
"category.gimble.editormodifier"
|
"gimble.category.editormodifier"
|
||||||
)
|
)
|
||||||
val toggleNoUpdatesModifierShortcut = KeyBinding(
|
val toggleNoUpdatesModifierShortcut = KeyBinding(
|
||||||
"gimble.key.editor.modifier.noupdates",
|
"gimble.key.editor.modifier.noupdates",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_N,
|
GLFW.GLFW_KEY_N,
|
||||||
"category.gimble.editormodifier"
|
"gimble.category.editormodifier"
|
||||||
)
|
)
|
||||||
val toggleNoClipModifierShortcut = KeyBinding(
|
val toggleNoClipModifierShortcut = KeyBinding(
|
||||||
"gimble.key.editor.modifier.noclip",
|
"gimble.key.editor.modifier.noclip",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_C,
|
GLFW.GLFW_KEY_C,
|
||||||
"category.gimble.editormodifier"
|
"gimble.category.editormodifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
KeybindingManager.registerShortcut(ToggleBulldozerModifierShortcut(toggleBulldozerModifierShortcut))
|
KeybindingManager.registerShortcut(ToggleBulldozerModifierShortcut(toggleBulldozerModifierShortcut))
|
||||||
|
@ -65,19 +65,19 @@ object KeybindingRegistrar {
|
||||||
"gimble.key.editor.mode.insert",
|
"gimble.key.editor.mode.insert",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_I,
|
GLFW.GLFW_KEY_I,
|
||||||
"category.gimble.editormode"
|
"gimble.category.editormode"
|
||||||
)
|
)
|
||||||
val replaceKeyBinding = KeyBinding(
|
val replaceKeyBinding = KeyBinding(
|
||||||
"gimble.key.editor.mode.replace",
|
"gimble.key.editor.mode.replace",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_R,
|
GLFW.GLFW_KEY_R,
|
||||||
"category.gimble.editormode"
|
"gimble.category.editormode"
|
||||||
)
|
)
|
||||||
val visualKeyBinding = KeyBinding(
|
val visualKeyBinding = KeyBinding(
|
||||||
"gimble.key.editor.mode.visual",
|
"gimble.key.editor.mode.visual",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_V,
|
GLFW.GLFW_KEY_V,
|
||||||
"category.gimble.editormode"
|
"gimble.category.editormode"
|
||||||
)
|
)
|
||||||
KeybindingManager.registerShortcut(EnableInsertModeShortcut(insertKeyBinding))
|
KeybindingManager.registerShortcut(EnableInsertModeShortcut(insertKeyBinding))
|
||||||
KeybindingManager.registerShortcut(EnableReplaceModeShortcut(replaceKeyBinding))
|
KeybindingManager.registerShortcut(EnableReplaceModeShortcut(replaceKeyBinding))
|
||||||
|
@ -89,19 +89,19 @@ object KeybindingRegistrar {
|
||||||
"gimble.key.game.mode.survival",
|
"gimble.key.game.mode.survival",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_UNKNOWN,
|
GLFW.GLFW_KEY_UNKNOWN,
|
||||||
"category.gimble.gamemode"
|
"gimble.category.gamemode"
|
||||||
)
|
)
|
||||||
val creativeKeyBinding = KeyBinding(
|
val creativeKeyBinding = KeyBinding(
|
||||||
"gimble.key.game.mode.creative",
|
"gimble.key.game.mode.creative",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_UNKNOWN,
|
GLFW.GLFW_KEY_UNKNOWN,
|
||||||
"category.gimble.gamemode"
|
"gimble.category.gamemode"
|
||||||
)
|
)
|
||||||
val spectatorKeyBinding = KeyBinding(
|
val spectatorKeyBinding = KeyBinding(
|
||||||
"gimble.key.game.mode.spectator",
|
"gimble.key.game.mode.spectator",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_UNKNOWN,
|
GLFW.GLFW_KEY_UNKNOWN,
|
||||||
"category.gimble.gamemode"
|
"gimble.category.gamemode"
|
||||||
)
|
)
|
||||||
KeybindingManager.registerShortcut(SurvivalModeShortcut(survivalKeyBinding))
|
KeybindingManager.registerShortcut(SurvivalModeShortcut(survivalKeyBinding))
|
||||||
KeybindingManager.registerShortcut(CreativeModeShortcut(creativeKeyBinding))
|
KeybindingManager.registerShortcut(CreativeModeShortcut(creativeKeyBinding))
|
||||||
|
|
|
@ -10,5 +10,6 @@ internal class DataGenerator : DataGeneratorEntrypoint {
|
||||||
|
|
||||||
override fun onInitializeDataGenerator(fabricDataGenerator: FabricDataGenerator) {
|
override fun onInitializeDataGenerator(fabricDataGenerator: FabricDataGenerator) {
|
||||||
LOGGER.info("Starting Data Generation")
|
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",
|
"adapter": "kotlin",
|
||||||
"value": "net.moonleay.mods.gimble.Main"
|
"value": "net.moonleay.mods.gimble.Main"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"fabric-datagen": [
|
||||||
|
{
|
||||||
|
"adapter": "kotlin",
|
||||||
|
"value": "net.moonleay.mods.gimble.datagen.DataGenerator"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|
Loading…
Reference in a new issue