mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
rename readAsset function to readAssetResource
This commit is contained in:
parent
bd5f1d19bd
commit
d7df53fced
@ -128,7 +128,7 @@ public final class Minosoft {
|
||||
taskWorker.addTask(new Task(progress -> {
|
||||
Log.info("Loading versions.json...");
|
||||
long mappingStartLoadingTime = System.currentTimeMillis();
|
||||
Versions.loadAvailableVersions(Util.readJsonAsset("mapping/versions.json"));
|
||||
Versions.loadAvailableVersions(Util.readJsonAssetResource("mapping/versions.json"));
|
||||
Log.info(String.format("Loaded %d versions in %dms", Versions.getVersionIdMap().size(), (System.currentTimeMillis() - mappingStartLoadingTime)));
|
||||
Resources.load();
|
||||
Log.info("Loaded all resources!");
|
||||
|
@ -308,7 +308,7 @@ public class AssetsManager {
|
||||
}
|
||||
|
||||
public String readStringAsset(String name) throws IOException {
|
||||
return Util.readFile(new BufferedReader(readAsset(name)), true);
|
||||
return Util.readReader(new BufferedReader(readAsset(name)), true);
|
||||
}
|
||||
|
||||
public InputStream readAssetAsStream(String name) throws IOException {
|
||||
|
@ -14,7 +14,7 @@ public class Resources {
|
||||
private static final HashBiMap<Version, AssetVersion> ASSETS_VERSIONS = HashBiMap.create();
|
||||
|
||||
public static void load() throws IOException {
|
||||
JsonObject json = Util.readJsonAsset("mapping/resources.json");
|
||||
JsonObject json = Util.readJsonAssetResource("mapping/resources.json");
|
||||
|
||||
JsonObject versions = json.getAsJsonObject("versions");
|
||||
for (Map.Entry<String, JsonElement> versionEntry : versions.entrySet()) {
|
||||
|
@ -48,7 +48,7 @@ public class LocaleManager {
|
||||
}
|
||||
|
||||
private static Language loadLanguage(String language) throws IOException {
|
||||
return new Language(language, Util.readJsonAsset(String.format("locale/%s.json", language)));
|
||||
return new Language(language, Util.readJsonAssetResource(String.format("locale/%s.json", language)));
|
||||
}
|
||||
|
||||
public static void load(String language) {
|
||||
|
@ -19,7 +19,7 @@ public class ShaderUtil {
|
||||
throw new ShaderLoadingException();
|
||||
}
|
||||
|
||||
ARBShaderObjects.glShaderSourceARB(shaderId, Util.readAsset("/rendering/shader/" + shaderPath));
|
||||
ARBShaderObjects.glShaderSourceARB(shaderId, Util.readAssetResource("/rendering/shader/" + shaderPath));
|
||||
ARBShaderObjects.glCompileShaderARB(shaderId);
|
||||
|
||||
if (ARBShaderObjects.glGetObjectParameteriARB(shaderId, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) {
|
||||
|
@ -183,14 +183,14 @@ public final class Util {
|
||||
HashMap<String, String> ret = new HashMap<>();
|
||||
TarArchiveEntry entry;
|
||||
while ((entry = tarArchiveInputStream.getNextTarEntry()) != null) {
|
||||
ret.put(entry.getName(), readFile(new BufferedReader(new InputStreamReader(tarArchiveInputStream)), false));
|
||||
ret.put(entry.getName(), readReader(new BufferedReader(new InputStreamReader(tarArchiveInputStream)), false));
|
||||
}
|
||||
tarArchiveInputStream.close();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static String readFile(BufferedReader reader, boolean closeStream) throws IOException {
|
||||
public static String readReader(BufferedReader reader, boolean closeStream) throws IOException {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
@ -216,18 +216,18 @@ public final class Util {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static JsonObject readJsonAsset(String path) throws IOException {
|
||||
return readJsonAsset(path, Util.class);
|
||||
public static JsonObject readJsonAssetResource(String path) throws IOException {
|
||||
return readJsonAssetResource(path, Util.class);
|
||||
}
|
||||
|
||||
public static JsonObject readJsonAsset(String path, Class<?> clazz) throws IOException {
|
||||
InputStreamReader reader = readAsset(path, clazz);
|
||||
public static JsonObject readJsonAssetResource(String path, Class<?> clazz) throws IOException {
|
||||
InputStreamReader reader = readAssetResource(path, clazz);
|
||||
JsonObject json = JsonParser.parseReader(reader).getAsJsonObject();
|
||||
reader.close();
|
||||
return json;
|
||||
}
|
||||
|
||||
public static InputStreamReader readAsset(String path, Class<?> clazz) {
|
||||
public static InputStreamReader readAssetResource(String path, Class<?> clazz) {
|
||||
return new InputStreamReader(clazz.getResourceAsStream("/assets/" + path));
|
||||
}
|
||||
|
||||
@ -307,8 +307,8 @@ public final class Util {
|
||||
return result.substring(0, result.indexOf(second));
|
||||
}
|
||||
|
||||
public static String readAsset(String path) throws IOException {
|
||||
return readFile(new BufferedReader(readAsset(path, Util.class)), true);
|
||||
public static String readAssetResource(String path) throws IOException {
|
||||
return readReader(new BufferedReader(readAssetResource(path, Util.class)), true);
|
||||
}
|
||||
|
||||
public static boolean doesStringContainsUppercaseLetters(String string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user