@@ -25,7 +25,7 @@ private void onFindResources(String startingPath, Predicate<Identifier> allowedP
2525
2626 String currentLang = LangTextureCache .getCurrentLanguage ();
2727
28- if ("en_us" .equals (currentLang ) || ! startingPath . startsWith ( "textures/" ) ) {
28+ if ("en_us" .equals (currentLang )) {
2929 return ;
3030 }
3131
@@ -34,16 +34,26 @@ private void onFindResources(String startingPath, Predicate<Identifier> allowedP
3434
3535 Map <Identifier , Resource > langSpecificResources = new HashMap <>();
3636 String texturePrefix = "textures/" ;
37- int prefixLength = texturePrefix .length ();
3837
3938 for (Map .Entry <Identifier , Resource > entry : originalResources .entrySet ()) {
4039 Identifier originalId = entry .getKey ();
4140
42- if (originalId . getPath (). endsWith ( ".mcmeta" ) || !allowedPathPredicate .test (originalId )) {
41+ if (!allowedPathPredicate .test (originalId )) {
4342 continue ;
4443 }
4544
46- String langSpecificPath = texturePrefix + currentLang + '/' + originalId .getPath ().substring (prefixLength );
45+ String originalPath = originalId .getPath ();
46+ int index = originalPath .indexOf (texturePrefix ) + texturePrefix .length ();
47+
48+ String before = originalPath .substring (0 , index );
49+ String after = originalPath .substring (index );
50+
51+ // 避免重复,如zh_cn/zh_cn
52+ if (after .startsWith (currentLang + "/" )) {
53+ continue ;
54+ }
55+
56+ String langSpecificPath = before + currentLang + '/' + after ;
4757 Identifier langId = Identifier .of (originalId .getNamespace (), langSpecificPath );
4858
4959 Boolean cache = LangTextureCache .get (langId );
0 commit comments