diff options
author | makamys <makamys@outlook.com> | 2022-06-04 19:49:21 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-06-04 19:49:21 +0200 |
commit | 7709c47bc1e2e147aad018cab4f51f23825ed851 (patch) | |
tree | dd37e5d4787874989e8d8db3c6a8137a8d088e49 /src/main/java/makamys | |
parent | 1f8f47a57e67ff3cea73b88f7d86a124981e5e5f (diff) | |
download | Neodymium-7709c47bc1e2e147aad018cab4f51f23825ed851.tar.gz Neodymium-7709c47bc1e2e147aad018cab4f51f23825ed851.tar.bz2 Neodymium-7709c47bc1e2e147aad018cab4f51f23825ed851.zip |
Add debug feature enabling overriding resource files externally
Diffstat (limited to 'src/main/java/makamys')
-rw-r--r-- | src/main/java/makamys/lodmod/util/Util.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/makamys/lodmod/util/Util.java b/src/main/java/makamys/lodmod/util/Util.java index 0a10463..ae80b78 100644 --- a/src/main/java/makamys/lodmod/util/Util.java +++ b/src/main/java/makamys/lodmod/util/Util.java @@ -10,8 +10,20 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; +import net.minecraft.launchwrapper.Launch; + public class Util { + + private static boolean allowResourceOverrides = Boolean.parseBoolean(System.getProperty("lodmod.allowResourceOverrides", "false")); + public static Path getResourcePath(String relPath) { + if(allowResourceOverrides) { + File overrideFile = new File(new File(Launch.minecraftHome, "lodmod/resources"), relPath); + if(overrideFile.exists()) { + return overrideFile.toPath(); + } + } + try { URL resourceURL = Util.class.getClassLoader().getResource(relPath); |