From 7709c47bc1e2e147aad018cab4f51f23825ed851 Mon Sep 17 00:00:00 2001 From: makamys Date: Sat, 4 Jun 2022 19:49:21 +0200 Subject: Add debug feature enabling overriding resource files externally --- src/main/java/makamys/lodmod/util/Util.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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); -- cgit