make several adventure resources common (particle_effects, skin, sprites, ui, most of world)

This commit is contained in:
Rob Schnautz
2023-06-14 01:19:09 -05:00
parent 1adb7e5462
commit 015fd574a7
1026 changed files with 233 additions and 216 deletions

View File

@@ -41,6 +41,7 @@ import java.util.List;
public class Config {
private static Config currentConfig;
private final String prefix;
private final String commonPrefix;
private final HashMap<String, FileHandle> Cache = new HashMap<String, FileHandle>();
private ConfigData configData;
private final String[] adventures;
@@ -97,6 +98,7 @@ public class Config {
//prefix = "forge-gui/res/adventure/Shandalar/";
prefix = getPlanePath(settingsData.plane);
commonPrefix = getPlanePath("common");
currentConfig = this;
if (FModel.getPreferences() != null)
@@ -144,18 +146,33 @@ public class Config {
}
public FileHandle getFile(String path) {
String fullPath = prefix + path;
fullPath = fullPath.replace("//","/");
if (!Cache.containsKey(fullPath)) {
String fileName = fullPath.replaceFirst("[.][^.]+$", "");
String ext = fullPath.substring(fullPath.lastIndexOf('.'));
String langFile = fileName + "-" + Lang + ext;
if (Files.exists(Paths.get(langFile))) {
Cache.put(fullPath, new FileHandle(langFile));
} else {
Cache.put(fullPath, new FileHandle(fullPath));
}
String fullPath = (prefix + path).replace("//","/");
String commonPath= (commonPrefix+path).replace("//","/");
int x=0;
if(Cache.containsKey(fullPath)) x=1;
else if(Cache.containsKey(commonPath)) x=2;
switch(x) {
case 2:
return Cache.get(commonPath);
case 0:
String fileName = fullPath.replaceFirst("[.][^.]+$", "");
String commonFileName = commonPath.replaceFirst("[.][^.]+$", "");
String ext = fullPath.substring(fullPath.lastIndexOf('.'));
String langFile = fileName + "-" + Lang + ext;
String commonLangFile = commonFileName + "-" + Lang + ext;
boolean isCommon = false;
if (Files.exists(Paths.get(langFile))) {
Cache.put(fullPath, new FileHandle(langFile));
} else if (Files.exists(Paths.get(commonLangFile))) {
Cache.put(commonPath, new FileHandle(langFile));
isCommon = true;
} else if (Files.exists(Paths.get(fullPath))) {
Cache.put(fullPath, new FileHandle(fullPath));
} else if (Files.exists(Paths.get(commonPath))) {
Cache.put(commonPath, new FileHandle(commonPath));
isCommon = true;
}
if (isCommon) return Cache.get(commonPath);
}
return Cache.get(fullPath);
}

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 650 B

After

Width:  |  Height:  |  Size: 650 B

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 338 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

Some files were not shown because too many files have changed in this diff Show More