Fetch stylesheets from the correct module (Java 9+)

Fixes GH-395.
This commit is contained in:
Jamie Mansfield 2020-07-17 02:18:23 +01:00
parent f7eb98196d
commit a96fb2a239
No known key found for this signature in database
GPG key ID: 36F61598F39F67B0
3 changed files with 6 additions and 2 deletions

2
.gitignore vendored
View file

@ -1,11 +1,13 @@
# Directories
.gradle/
.idea/
.settings/
bin/
build/
dist/
target/
testLauncher/
run/
# Files
.classpath

View file

@ -37,3 +37,5 @@ This changelog only contains the changes that are unreleased. For changes for in
- Add in tests to forge/fabric servers for network checker tool
- Add in higher timeouts for network calls
- Add in CPU and GPU logging to console
- Fetch stylesheets and fonts from the correct module, allowing the launcher
to run in Java 9 and above. (GH-395)

View file

@ -61,7 +61,7 @@ public final class Resources {
} else {
StyleSheet sheet = new StyleSheet();
Reader reader = new InputStreamReader(System.class.getResourceAsStream("/assets/css/" + name + ".css"));
Reader reader = new InputStreamReader(Resources.class.getResourceAsStream("/assets/css/" + name + ".css"));
sheet.loadRules(reader, null);
reader.close();
@ -89,7 +89,7 @@ public final class Resources {
resources.put(name, f);
return f;
} else {
URL url = System.class.getResource("/assets/font/" + name + ".ttf");
URL url = Resources.class.getResource("/assets/font/" + name + ".ttf");
if (url == null) {
LogManager.error("Cannot find font " + name);
return new Font("Sans-Serif", Font.PLAIN, 0);