Skip to content

Commit 352e6d8

Browse files
Wulian233TexBlock
andcommitted
init
Co-authored-by: TexTrue <65154269+TexBlock@users.noreply.github.com>
1 parent 7900d7b commit 352e6d8

56 files changed

Lines changed: 3791 additions & 401 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

.github/workflows/build.yml

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,35 @@
11
name: Build
2-
3-
on: [ pull_request, push, workflow_dispatch ]
2+
on: [ pull_request, push ]
43

54
jobs:
6-
Build:
5+
build:
6+
strategy:
7+
matrix:
8+
java: [ 25 ]
79
runs-on: ubuntu-latest
8-
910
steps:
10-
- uses: actions/checkout@v4
11+
- name: checkout repository
12+
uses: actions/checkout@v6
1113

12-
- name: Set up JDK 21
13-
uses: actions/setup-java@v4
14+
- name: setup Gradle wrapper
15+
uses: gradle/actions/setup-gradle@v4
1416
with:
15-
distribution: 'temurin'
16-
java-version: 21
17+
gradle-version: 9.2.0
1718

18-
- name: Cache
19-
uses: actions/cache@v4
19+
- name: setup Java ${{ matrix.java }}
20+
uses: actions/setup-java@v5
2021
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: Merge Fabric & Neoforge JARs
33-
run: |
34-
chmod +x gradlew
35-
./gradlew fusejars
22+
java-version: ${{ matrix.java }}
23+
distribution: 'zulu'
3624

37-
- name: Upload fabric artifacts
38-
uses: actions/upload-artifact@v4
39-
with:
40-
name: fabric-artifacts
41-
path: ${{ github.workspace }}/fabric/build/libs
25+
- name: make gradle wrapper executable
26+
run: chmod +x ./gradlew
4227

43-
- name: Upload neoforge artifacts
44-
uses: actions/upload-artifact@v4
45-
with:
46-
name: neoforge-artifacts
47-
path: ${{ github.workspace }}/neoforge/build/libs
28+
- name: build
29+
run: ./gradlew buildAndCollect
4830

49-
- name: Upload merged artifacts
31+
- name: capture build artifacts
5032
uses: actions/upload-artifact@v4
5133
with:
52-
name: merged
53-
path: ${{ github.workspace }}/build/merged/*
34+
name: Artifacts
35+
path: build/libs/

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Release
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
Build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v6
18+
- name: Set up JDK 25
19+
uses: actions/setup-java@v5
20+
with:
21+
distribution: 'zulu'
22+
java-version: 25
23+
24+
- name: build
25+
run: ./gradlew buildAndCollect
26+
27+
- uses: gradle/actions/wrapper-validation@v4
28+
- run: |
29+
chmod +x gradlew
30+
./gradlew publishMod --stacktrace -Porg.gradle.parallel.threads=4
31+
env:
32+
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}

.gitignore

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
1+
# gradle
2+
3+
.gradle/
14
build/
2-
*.ipr
3-
run/
4-
*.iws
55
out/
6+
classes/
7+
8+
# eclipse
9+
10+
*.launch
11+
12+
# idea
13+
14+
.idea/
615
*.iml
7-
.gradle/
8-
output/
9-
bin/
10-
libs/
16+
*.ipr
17+
*.iws
1118

19+
# vscode
20+
21+
.settings/
22+
.vscode/
23+
bin/
1224
.classpath
1325
.project
14-
.idea/
15-
classes/
16-
.metadata
17-
.vscode
18-
.settings
19-
*.launch
26+
27+
# macos
28+
29+
*.DS_Store
30+
31+
# fabric
32+
33+
run/
34+
35+
# java
36+
37+
hs_err_*.log
38+
replay_*.log
39+
*.hprof
40+
*.jfr
2041
/.architectury-transformer/

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 代码
2+
3+
- 迁移项目结构到 Stonecutter
4+
- 迁移映射至 Mojmap

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023-2025 VM Chinese translate group | VM汉化组
3+
Copyright (c) 2025 LocalizedMC
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,71 @@
11
<div align="center">
2-
<img height="100px" width="100px" alt="logo" src="./common/src/main/resources/assets/vmtranslationupdate/icon.png"/>
3-
<h1>VM Translation Update</h1>
2+
<img height="128px" width="128px" alt="logo" src="./common/src/main/resources/assets/texturelocaleredirector/icon.png"/>
3+
<h1>Texture Locale Redirector</h1>
44

5-
<a href="https://modrinth.com/project/vmupdate/">
5+
<a href="README_CN.md">中文</a> | English
6+
7+
<a href="https://modrinth.com/project/texture-locale-redirector">
68
<img alt="modrinth" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg">
79
</a>
8-
<a href="https://www.curseforge.com/minecraft/mc-mods/vmtranslationupdate">
10+
<a href="https://www.curseforge.com/minecraft/mc-mods/texture-locale-redirector">
911
<img alt="curseforge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/curseforge_vector.svg">
1012
</a>
11-
<a href="https://www.mcmod.cn/class/11203.html">
12-
<img alt="mcmod.cn" height="56" src="https://raw.githubusercontent.com/KessokuTeaTime/Badges-Extra/main/assets/cozy/available/mcmodcn_vector.svg">
13-
</a>
1413

15-
<img alt="forge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/forge_vector.svg"> (1.12.2、1.16.5、1.18-1.20.1)
16-
<img alt="neoforge" height="56" src="https://raw.githubusercontent.com/KessokuTeaTime/Badges-Extra/main/assets/cozy/supported/neoforge_vector.svg"> (≥1.20.1)
17-
<img alt="fabric" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/fabric_vector.svg"> (≥1.16.5)
14+
<img alt="forge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/forge_vector.svg">
15+
<img alt="neoforge" height="56" src="https://raw.githubusercontent.com/KessokuTeaTime/Badges-Extra/main/assets/cozy/supported/neoforge_vector.svg">
16+
<img alt="fabric" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/fabric_vector.svg">
1817
</div>
18+
19+
**Texture Locale Redirector** adds native multi-language texture support to Minecraft resource packs.
20+
21+
By extending vanilla resource loading mechanism, this mod allows you to provide language-specific textures within a single resource pack.
22+
It solves the problem where localized textures (with text or symbols) for one language may negatively affect players in other languages.
23+
24+
## Usage
25+
26+
Follow these three simple steps to enable multi-language textures:
27+
28+
1. **Install the mod**: Place this mod in your `mods` folder.
29+
2. **Create a resource pack**: Organize your localized textures according to the required folder structure.
30+
3. **Start the game**: Enable the resource pack and switch to the corresponding language in Minecraft.
31+
32+
## Resource Pack Structure Example
33+
34+
Inside your resource pack, store localized textures under `assets/<namespace>/textures/<language>/`.
35+
36+
- `<namespace>` is the namespace — `minecraft` for vanilla, or the modid for mods.
37+
- `<language>` is the language code, such as `zh_cn` (Simplified Chinese) or `ja_jp` (Japanese).
38+
39+
**Note:** The relative path of the texture to be replaced must match the original texture path.
40+
41+
```
42+
ResourcePackName/
43+
└── assets/
44+
└── minecraft (namespace)/
45+
└── textures/
46+
├── zh_cn/ # Simplified Chinese textures
47+
│ ├── block/
48+
│ │ └── dirt.png # Replaced dirt texture
49+
│ └── item/
50+
│ └── diamond_sword.png # Replaced diamond sword texture
51+
└── ja_jp/ # Japanese textures
52+
└── item/
53+
└── diamond_sword.png # Replaced diamond sword texture
54+
```
55+
56+
## Performance
57+
58+
This mod is heavily optimized and should have negligible performance impact:
59+
60+
* Works **only** when the current language is not `en_us`, meaning no effect for English players.
61+
* Implements an **advanced caching system** to drastically reduce unnecessary disk I/O.
62+
* Clears cache upon language change or resource reload, ensuring textures are updated immediately.
63+
* Automatically releases cache memory when system memory is low to prevent lag.
64+
* If a resource pack has no language-specific texture folder, no replacement scan is performed — avoiding unnecessary work.
65+
* Does not interfere with the normal operation of other resource packs.
66+
67+
## License
68+
69+
This project is open-sourced under the [MIT License](LICENSE).
70+
71+
Contributions and PRs are welcome! Feel free to submit issues for bug reports or feature requests.

README_CN.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<div align="center">
2+
<img height="128px" width="128px" alt="logo" src="./common/src/main/resources/assets/texturelocaleredirector/icon.png"/>
3+
<h1>Texture Locale Redirector</h1>
4+
5+
中文 | <a href="README.md">English</a>
6+
7+
<a href="https://modrinth.com/project/texture-locale-redirector">
8+
<img alt="modrinth" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg">
9+
</a>
10+
<a href="https://www.curseforge.com/minecraft/mc-mods/texture-locale-redirector">
11+
<img alt="curseforge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/curseforge_vector.svg">
12+
</a>
13+
14+
<img alt="forge" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/forge_vector.svg">
15+
<img alt="neoforge" height="56" src="https://raw.githubusercontent.com/KessokuTeaTime/Badges-Extra/main/assets/cozy/supported/neoforge_vector.svg">
16+
<img alt="fabric" height="56" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/supported/fabric_vector.svg">
17+
</div>
18+
19+
Texture Locale Redirector 为 Minecraft 资源包提供了原生的多语言纹理支持。
20+
21+
它通过扩展原版的资源加载机制,让你可以在一个资源包中为不同语言提供专门的纹理。
22+
这解决了本地化过程中,因纹理上的文字或图标需要替换而影响其他语言玩家体验的问题。
23+
24+
## 使用说明
25+
26+
只需简单三步,即可让你的资源包支持多语言纹理:
27+
28+
1. **安装模组**:将本模组放入你的 `mods` 文件夹。
29+
2. **创建资源包**:在资源包中,按照特定的文件夹结构组织你的本地化纹理。
30+
3. **开始游戏**:在游戏中启用资源包并切换到对应语言即可。
31+
32+
## 资源包结构示例
33+
34+
在你的资源包中,按照 `assets/<namespace>/textures/<language>/` 的结构来存放本地化纹理。
35+
36+
`<namespace>` 是命名空间,原版为 `minecraft`,模组一般为它们的 modid。
37+
38+
`<language>` 是语言代码,如 `zh_cn`(简体中文)或 `ja_jp`(日文)。
39+
40+
注意:需要替换的纹理的相对路径需与原纹理保持一致。
41+
42+
```
43+
资源包名称/
44+
└── assets/
45+
└── minecraft(命名空间)/
46+
└── textures/
47+
├── zh_cn/ # 简体中文纹理
48+
│ ├── block/
49+
│ │ └── dirt.png # 替换的泥土纹理
50+
│ └── item/
51+
│ └── diamond_sword.png # 替换的钻石剑纹理
52+
└── ja_jp/ # 日文纹理
53+
└── item/
54+
└── diamond_sword.png # 替换的钻石剑纹理
55+
```
56+
57+
## 性能
58+
59+
本模组进行了大量的优化,对性能不应造成明显影响
60+
61+
* 模组只在非 `en_us` 环境下工作,对英语玩家没有任何影响。
62+
* 本模组为需要替换的纹理建立了**先进的缓存机制**,极大地减少了不必要的磁盘读写操作。
63+
* 在语言切换和游戏资源重载时会清空缓存,立即更新纹理。内存不足时会智能释放缓存,保证游戏正常运行。
64+
* 如果资源包没有定义特定语言纹理文件夹,则不会扫描替换以减少性能影响。且不会影响其他任何资源包的正常工作。
65+
66+
## 许可证
67+
68+
本项目采用 [MIT 许可证](LICENSE) 开源。
69+
70+
欢迎提交 Issue 反馈问题或提出建议,欢迎贡献 PR 。

0 commit comments

Comments
 (0)