Skip to content

Commit f140749

Browse files
authored
一些修复和清理 (#1)
* 项目整理 GitHub工作流构建 中文翻译 gradle仿VMTU优化并消除警告 提取gradle依赖版本 排序import * 修复fabric错误依赖无法启动 修复语言条目丢失 * 升级gradle
1 parent 99579ab commit f140749

File tree

16 files changed

+118
-79
lines changed

16 files changed

+118
-79
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build
2+
3+
on: [ pull_request, push, workflow_dispatch ]
4+
5+
jobs:
6+
Build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Set up JDK 21
13+
uses: actions/setup-java@v4
14+
with:
15+
distribution: 'temurin'
16+
java-version: 21
17+
18+
- name: Cache
19+
uses: actions/cache@v4
20+
with:
21+
path: |
22+
~/.gradle/caches
23+
~/.gradle/wrapper
24+
.gradle
25+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }}
26+
27+
- name: Build with Gradle
28+
run: |
29+
chmod +x gradlew
30+
./gradlew build
31+
32+
- name: Upload fabric artifacts
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: fabric-artifacts
36+
path: ${{ github.workspace }}/fabric/build/libs
37+
38+
- name: Upload neoforge artifacts
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: neoforge-artifacts
42+
path: ${{ github.workspace }}/neoforge/build/libs

build.gradle

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
plugins {
22
id 'dev.architectury.loom' version '1.10-SNAPSHOT' apply false
33
id 'architectury-plugin' version '3.4-SNAPSHOT'
4-
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
4+
id 'com.gradleup.shadow' version '9.+' apply false
55
}
66

77
architectury {
88
minecraft = project.minecraft_version
99
}
1010

1111
allprojects {
12+
apply plugin: 'architectury-plugin'
13+
1214
group = rootProject.maven_group
1315
version = rootProject.mod_version
16+
17+
tasks.withType(JavaCompile).configureEach {
18+
options.encoding = "UTF-8"
19+
options.release = 21
20+
}
1421
}
1522

1623
subprojects {
1724
apply plugin: 'dev.architectury.loom'
18-
apply plugin: 'architectury-plugin'
19-
apply plugin: 'maven-publish'
25+
apply plugin: "com.gradleup.shadow"
2026

2127
base {
22-
// Set up a suffixed format for the mod jar names, e.g. `example-fabric`.
2328
archivesName = "$rootProject.archives_name-$project.name"
2429
}
2530

26-
repositories {
27-
// Add repositories to retrieve artifacts from in here.
28-
// You should only use this when depending on other mods because
29-
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
30-
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
31-
// for more information about repositories.
32-
}
33-
3431
dependencies {
3532
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
3633
mappings loom.layered {
@@ -40,34 +37,9 @@ subprojects {
4037
}
4138

4239
java {
43-
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
44-
// if it is present.
45-
// If you remove this line, sources will not be generated.
4640
withSourcesJar()
4741

4842
sourceCompatibility = JavaVersion.VERSION_21
4943
targetCompatibility = JavaVersion.VERSION_21
5044
}
51-
52-
tasks.withType(JavaCompile).configureEach {
53-
it.options.release = 21
54-
}
55-
56-
// Configure Maven publishing.
57-
publishing {
58-
publications {
59-
mavenJava(MavenPublication) {
60-
artifactId = base.archivesName.get()
61-
from components.java
62-
}
63-
}
64-
65-
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
66-
repositories {
67-
// Add repositories to publish to here.
68-
// Notice: This block does NOT have the same function as the block in the top level.
69-
// The repositories here will be used for publishing your artifact, not for
70-
// retrieving dependencies.
71-
}
72-
}
7345
}

common/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ dependencies {
88
// Do NOT use other classes from Fabric Loader.
99
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
1010

11-
modImplementation "me.shedaniel.cloth:cloth-config:17.0.144"
11+
modImplementation "me.shedaniel.cloth:cloth-config:${rootProject.clothconfig_version}"
1212
}

common/src/main/java/org/localizedmc/sublangview/helper/TranslationHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import net.minecraft.registry.Registries;
77
import net.minecraft.text.Text;
88
import net.minecraft.text.TranslatableTextContent;
9-
import net.minecraft.util.Formatting;
109

1110
public class TranslationHelper {
1211
public static TranslationStorage subTranslationStorage;

common/src/main/resources/assets/sublangview/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"gui.sublangview.namespace": "Namespace: %s",
55
"text.autoconfig.sublangview.title": "SubLangView Config",
66
"text.autoconfig.sublangview.option.subLanguageCode": "Sub-language Code",
7+
"text.autoconfig.sublangview.option.textColor": "Text Color",
78
"text.autoconfig.sublangview.option.itemTooltipDisplayMode": "Tooltip Display Mode",
89
"config.sublangview.option.original": "Original Text",
910
"config.sublangview.option.translation_key": "Translation Key",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"gui.sublangview.original": "原文(%s):%s",
3+
"gui.sublangview.translation_key": "翻译键:%s",
4+
"gui.sublangview.namespace": "命名空间:%s",
5+
"text.autoconfig.sublangview.title": "副语言视图配置",
6+
"text.autoconfig.sublangview.option.subLanguageCode": "副语言语言代码",
7+
"text.autoconfig.sublangview.option.textColor": "文本颜色",
8+
"text.autoconfig.sublangview.option.itemTooltipDisplayMode": "工具提示显示模式",
9+
"config.sublangview.option.original": "原文",
10+
"config.sublangview.option.translation_key": "翻译键",
11+
"config.sublangview.option.all": "全部",
12+
"config.sublangview.option.off": "关闭",
13+
"config.sublangview.option.color_white": "白色",
14+
"config.sublangview.option.color_black": "黑色",
15+
"config.sublangview.option.color_yellow": "黄色",
16+
"config.sublangview.option.color_gold": "金色",
17+
"config.sublangview.option.color_gray": "灰色",
18+
"config.sublangview.option.color_dark_gray": "深灰色",
19+
"config.sublangview.option.color_blue": "蓝色",
20+
"config.sublangview.option.color_dark_blue": "深蓝色",
21+
"config.sublangview.option.color_green": "绿色",
22+
"config.sublangview.option.color_dark_green": "深绿色",
23+
"config.sublangview.option.color_aqua": "水色",
24+
"config.sublangview.option.color_dark_aqua": "深水色",
25+
"config.sublangview.option.color_red": "红色",
26+
"config.sublangview.option.color_dark_red": "深红色",
27+
"config.sublangview.option.color_light_purple": "淡紫色",
28+
"config.sublangview.option.color_dark_purple": "深紫色"
29+
}

fabric/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow'
2+
id 'com.gradleup.shadow'
33
}
44

55
architectury {
@@ -37,10 +37,8 @@ dependencies {
3737
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
3838

3939
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"
40-
modImplementation "com.terraformersmc:modmenu:13.0.3"
41-
modImplementation "me.shedaniel.cloth:cloth-config-fabric:17.0.144"
42-
43-
modImplementation("maven.modrinth:sublanguage:1.2-SNAPSHOT")
40+
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") { transitive false }
41+
modImplementation "me.shedaniel.cloth:cloth-config-fabric:${rootProject.clothconfig_version}"
4442

4543
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
4644
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
@@ -60,5 +58,7 @@ shadowJar {
6058
}
6159

6260
remapJar {
63-
input.set shadowJar.archiveFile
61+
inputFile.set shadowJar.archiveFile
62+
dependsOn shadowJar
63+
archiveClassifier.set(null)
6464
}

fabric/src/main/resources/fabric.mod.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "SubLangView",
66
"description": "",
77
"authors": [
8-
"LocalizedMC, TexTrue"
8+
"TexTrue, Wulian233"
99
],
1010
"contact": {
1111
"sources": "https://github.com/LocalizedMC/SubLangView"
@@ -25,9 +25,7 @@
2525
"sublangview.mixins.json"
2626
],
2727
"depends": {
28-
"fabricloader": ">=0.16.12",
29-
"minecraft": "~1.21.4",
30-
"java": ">=21",
28+
"minecraft": ">=1.21.4",
3129
"fabric-api": "*"
3230
}
3331
}

gradle.properties

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# Done to increase the memory available to Gradle.
22
org.gradle.jvmargs=-Xmx2G
33
org.gradle.parallel=true
4+
45
# Mod properties
5-
mod_version=1.0-SNAPSHOT
6+
mod_version=1.0
67
maven_group=org.localizedmc.sublangview
78
archives_name=sublangview
89
enabled_platforms=fabric,neoforge
10+
911
# Minecraft properties
1012
minecraft_version=1.21.4
1113
yarn_mappings = 1.21.4+build.8
14+
yarn_mappings_patch_neoforge_version=1.21+build.4
15+
1216
# Dependencies
13-
fabric_loader_version=0.16.12
14-
fabric_api_version=0.119.2+1.21.4
15-
neoforge_version=21.4.124
16-
yarn_mappings_patch_neoforge_version = 1.21+build.4
17+
fabric_loader_version=0.17.2
18+
fabric_api_version=0.119.4+1.21.4
19+
neoforge_version=21.4.151
20+
21+
clothconfig_version=17.0.144
22+
modmenu_version=13.0.3

gradle/wrapper/gradle-wrapper.jar

1.83 KB
Binary file not shown.

0 commit comments

Comments
 (0)