Skip to content

Commit 7672743

Browse files
committed
更新GitHub仓库链接
1 parent b55a450 commit 7672743

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v4
10+
- 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
@@ -6,6 +6,7 @@
66
import dev.ftb.mods.ftbquests.quest.ChapterImage;
77
import me.fallenbreath.conditionalmixin.api.annotation.Condition;
88
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
9+
import net.minecraft.util.Identifier;
910
import org.spongepowered.asm.mixin.Mixin;
1011
import org.spongepowered.asm.mixin.injection.At;
1112
import org.spongepowered.asm.mixin.injection.ModifyVariable;
@@ -26,26 +27,28 @@ private Icon injectLocalizedImage(Icon image) {
2627
return image;
2728
}
2829

29-
String originalPath = image.toString();
30+
Identifier id = Identifier.of(image.toString());
31+
String path = id.getPath();
32+
3033
String texturePrefix = "textures/";
31-
String textureInsert = currentLang + "/";
34+
int index = path.indexOf(texturePrefix);
35+
if (index == -1) return image;
3236

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

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/Wulian233/LocalizedMC",
12+
"issues": "https://github.com/Wulian233/LocalizedMC/issues"
1313
},
1414
"icon": "assets/texturelocaleredirector/icon.png",
1515
"license": "MIT",

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ yarn_mappings=1.21.1+build.3
77
yarn_patch=1.21+build.4
88

99
archives_base_name=Texture-Locale-Redirector
10-
mod_version=1.2.0
10+
mod_version=1.3.0
1111
maven_group=com.wulian.texturelocaleredirector
1212

1313
forge_version=52.1.3
14-
neoforge_version=21.1.197
14+
neoforge_version=21.1.206
1515
conditional_mixin_version=0.6.4
1616

1717
fabric_loader_version=0.17.2
18-
fabric_api_version=0.116.5+1.21.1
18+
fabric_api_version=0.116.6+1.21.1
1919

2020
ftb_quests_version=2101.1.14

neoforge/src/main/resources/META-INF/neoforge.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"

settings.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ pluginManagement {
22
repositories {
33
maven { url "https://maven.architectury.dev/" }
44
maven { url "https://maven.fabricmc.net/" }
5-
maven { url "https://maven.minecraftforge.net/" }
65
maven { url "https://maven.neoforged.net/releases/" }
7-
maven { url "https://maven.firstdarkdev.xyz/releases/" }
86
gradlePluginPortal()
97
}
108
}
119

1210
include("common")
1311
include("fabric")
14-
//include("forge")
1512
include("neoforge")
1613

1714
rootProject.name = "TextureLocaleRedirector"

0 commit comments

Comments
 (0)