Skip to content

Commit e87c1b2

Browse files
committed
修复潜在的问题
1 parent ac6ba9a commit e87c1b2

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ ResourcePackName/
5353
└── diamond_sword.png # Replaced diamond sword texture
5454
```
5555

56+
## FTB Quests Support
57+
58+
This mod also provides optional support for [FTB Quests](https://github.com/FTBTeam/FTB-Quests).
59+
When FTB Quests is installed, images in the quest interface (`ChapterImage`) will
60+
also switch to the corresponding localized textures based on the current language.
61+
62+
* Any images or icons used in quests can be replaced via resource packs.
63+
* If no localized texture is found, it will fall back to the default texture.
64+
* Implemented via a **Mixin plugin**, so this mod does not have a hard dependency on FTB Quests.
65+
5666
## Performance
5767

5868
This mod is heavily optimized and should have negligible performance impact:

README_CN.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ Texture Locale Redirector 为 Minecraft 资源包提供了原生的多语言纹
5454
└── diamond_sword.png # 替换的钻石剑纹理
5555
```
5656

57+
## FTB Quests 支持
58+
59+
本模组同时对 [FTB Quests](https://github.com/FTBTeam/FTB-Quests) 提供了可选支持。
60+
当 FTB Quests 存在时,任务界面中的图片(`ChapterImage`)同样会根据当前语言切换到对应的本地化纹理。
61+
62+
* 任务中使用到的所有的图片和图标都可以在资源包中指定替换
63+
* 如果未找到对应语言的贴图,则会回退到默认的贴图
64+
* 通过 **Mixin 插件**实现,模组本体不会强制依赖 FTB Quests
65+
5766
## 性能
5867

5968
本模组进行了大量的优化,对性能不应造成明显影响
@@ -67,4 +76,4 @@ Texture Locale Redirector 为 Minecraft 资源包提供了原生的多语言纹
6776

6877
本项目采用 [MIT 许可证](LICENSE) 开源。
6978

70-
欢迎提交 Issue 反馈问题或提出建议,欢迎贡献 PR 。翻译英语。添加语言切换的文字|竖线
79+
欢迎提交 Issue 反馈问题或提出建议,欢迎贡献 PR 。

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
import dev.ftb.mods.ftblibrary.icon.Icon;
66
import dev.ftb.mods.ftbquests.quest.ChapterImage;
77
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.Shadow;
89
import org.spongepowered.asm.mixin.injection.At;
910
import org.spongepowered.asm.mixin.injection.Inject;
1011
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1112

1213
@Mixin(value = ChapterImage.class, remap = false)
1314
public abstract class ChapterImageMixin {
15+
@Shadow private Icon image;
1416
@Inject(method = "setImage(Ldev/ftb/mods/ftblibrary/icon/Icon;)Ldev/ftb/mods/ftbquests/quest/ChapterImage;", at = @At("HEAD"), cancellable = true)
1517
private void injectLocalizedImage(Icon image, CallbackInfoReturnable<ChapterImage> cir) {
1618
String currentLang = LangTextureCache.getCurrentLanguage();
@@ -23,8 +25,9 @@ private void injectLocalizedImage(Icon image, CallbackInfoReturnable<ChapterImag
2325
Icon localizedIcon = Icon.getIcon(localizedPath);
2426

2527
if (!localizedIcon.isEmpty()) {
28+
this.image = localizedIcon;
2629
TextureLocaleRedirector.LOGGER.info("Redirected ChapterImage icon {} -> {}", originalPath, localizedPath);
27-
cir.setReturnValue(((ChapterImage) (Object) this).setImage(localizedIcon));
30+
cir.setReturnValue((ChapterImage) (Object) this);
2831
}
2932
}
3033
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": "texturelocaleredirector",
44
"version": "${version}",
55
"name": "Texture Locale Redirector",
6-
"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.",
6+
"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": [
88
"Wulian233"
99
],

0 commit comments

Comments
 (0)