Skip to content

Commit 0ce5389

Browse files
committed
更新GitHub仓库链接
1 parent 2676d24 commit 0ce5389

File tree

6 files changed

+31
-34
lines changed

6 files changed

+31
-34
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v5
1111

1212
- name: Set up JDK 21
13-
uses: actions/setup-java@v4
13+
uses: actions/setup-java@v5
1414
with:
1515
distribution: 'temurin'
1616
java-version: 21

common/src/main/java/com/wulian/texturelocaleredirector/mixin/ftbquests/ChapterImageMixin.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.wulian.texturelocaleredirector.TextureLocaleRedirector;
55
import dev.ftb.mods.ftblibrary.icon.Icon;
66
import dev.ftb.mods.ftbquests.quest.ChapterImage;
7+
import net.minecraft.util.Identifier;
78
import org.spongepowered.asm.mixin.Mixin;
89
import org.spongepowered.asm.mixin.injection.At;
910
import org.spongepowered.asm.mixin.injection.ModifyVariable;
@@ -23,26 +24,28 @@ private Icon injectLocalizedImage(Icon image) {
2324
return image;
2425
}
2526

26-
String originalPath = image.toString();
27+
Identifier id = new Identifier(image.toString());
28+
String path = id.getPath();
29+
2730
String texturePrefix = "textures/";
28-
String textureInsert = currentLang + "/";
31+
int index = path.indexOf(texturePrefix);
32+
if (index == -1) return image;
2933

30-
if (originalPath.contains(texturePrefix + currentLang)) {
31-
TextureLocaleRedirector.LOGGER.warn("{} already exists in {} path.", currentLang, originalPath);
32-
TextureLocaleRedirector.LOGGER.info("ChapterImage icon {}", originalPath);
33-
return image;
34-
} else {
35-
int index = originalPath.indexOf(texturePrefix) + texturePrefix.length();
36-
String localizedPath = originalPath.substring(0, index) + textureInsert + originalPath.substring(index);
37-
38-
Icon localizedIcon = Icon.getIcon(localizedPath);
39-
40-
if (!localizedIcon.isEmpty()) {
41-
TextureLocaleRedirector.LOGGER.info("Redirected ChapterImage icon {} -> {}", originalPath, localizedPath);
42-
return localizedIcon;
43-
} else {
44-
return Icon.getIcon(originalPath.substring(0, index) + originalPath.substring(index));
45-
}
34+
String before = path.substring(0, index + texturePrefix.length());
35+
String after = path.substring(index + texturePrefix.length());
36+
37+
if (after.startsWith(currentLang + "/")) {
38+
return image; // 已经带有语言前缀
39+
}
40+
41+
String localizedPath = before + currentLang + "/" + after;
42+
Identifier localizedId = new Identifier(id.getNamespace(), localizedPath);
43+
44+
Icon localizedIcon = Icon.getIcon(localizedId.toString());
45+
if (!localizedIcon.isEmpty()) {
46+
TextureLocaleRedirector.LOGGER.info("Redirected ChapterImage icon {} -> {}", id, localizedId);
47+
return localizedIcon;
4648
}
49+
return image;
4750
}
4851
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"name": "Texture Locale Redirector",
66
"description": "Support redirecting resource paths based on the game language to achieve multi-language texture loading. By extending the vanilla resource loading mechanism, it provides native multi-language texture support for resource packs, enabling localization of texture assets.",
77
"authors": [
8-
"Wulian233"
8+
"Wulian233", "TexTrue"
99
],
1010
"contact": {
11-
"sources": "https://github.com/Wulian233/TextureLocaleRedirector",
12-
"issues": "https://github.com/Wulian233/TextureLocaleRedirector/issues"
11+
"sources": "https://github.com/LocalizedMC/TextureLocaleRedirector",
12+
"issues": "https://github.com/LocalizedMC/TextureLocaleRedirector/issues"
1313
},
1414
"icon": "assets/texturelocaleredirector/icon.png",
1515
"license": "MIT",

forge/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,3 @@ sourcesJar {
6969
dependsOn commonSources
7070
from commonSources.archiveFile.map { zipTree(it) }
7171
}
72-
73-
components.java {
74-
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
75-
skip()
76-
}
77-
}

forge/src/main/resources/META-INF/mods.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
modLoader = "javafml"
22
loaderVersion = "[38,)"
3-
issueTrackerURL = "https://github.com/Wulian233/TextureLocaleRedirector/issues"
3+
issueTrackerURL = "https://github.com/LocalizedMC/TextureLocaleRedirector/issues"
44
license = "MIT"
55

66
[[mods]]
77
modId = "texturelocaleredirector"
88
version = "${version}"
99
displayName = "Texture Locale Redirector"
10-
displayURL = "https://github.com/Wulian233/TextureLocaleRedirector"
11-
authors = "Wulian233"
10+
displayURL = "https://github.com/LocalizedMC/TextureLocaleRedirector"
11+
authors = "Wulian233, TexTrue"
1212
description = '''
1313
By extending the vanilla resource loading mechanism, it provides native multi-language texture support for resource packs, enabling localization of texture assets.
1414
'''

neoforge/src/main/resources/META-INF/mods.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
modLoader = "javafml"
22
loaderVersion = "[1,)"
3-
issueTrackerURL = "https://github.com/Wulian233/TextureLocaleRedirector/issues"
3+
issueTrackerURL = "https://github.com/LocalizedMC/TextureLocaleRedirector/issues"
44
license = "MIT"
55

66
[[mods]]
77
modId = "texturelocaleredirector"
88
version = "${version}"
99
displayName = "Texture Locale Redirector"
10-
displayURL = "https://github.com/Wulian233/TextureLocaleRedirector"
11-
authors = "Wulian233"
10+
displayURL = "https://github.com/LocalizedMC/TextureLocaleRedirector"
11+
authors = "Wulian233, TexTrue"
1212
description = '''
1313
By extending the vanilla resource loading mechanism, it provides native multi-language texture support for resource packs, enabling localization of texture assets.'''
1414
logoFile = "assets/texturelocaleredirector/icon.png"

0 commit comments

Comments
 (0)