From 9e7dc61d2087342012f77f4510d998081a308003 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Tue, 31 Mar 2020 14:07:35 +0200 Subject: [PATCH] `#ifdef DEV_ENV` is no longer applicable since 8bc0b0a There is no longer a dedicated "core" project where DEV_ENV would be defined, instead whichever is the currently selected version automatically becomes the main project using the main src folder. --- .../java/com/replaymod/core/ReplayMod.java | 19 ++++++++++--------- .../java/com/replaymod/core/utils/Utils.java | 11 +---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/replaymod/core/ReplayMod.java b/src/main/java/com/replaymod/core/ReplayMod.java index 7fdb4495..d11bae29 100644 --- a/src/main/java/com/replaymod/core/ReplayMod.java +++ b/src/main/java/com/replaymod/core/ReplayMod.java @@ -236,14 +236,15 @@ public class ReplayMod implements } static { // Note: even preInit is too late and we'd have to issue another resource reload - //#ifdef DEV_ENV - //noinspection ConstantConditions - if (true) { - //#else - //$$ //noinspection ConstantConditions - //$$ if (false) { - //#endif - DirectoryResourcePack jGuiResourcePack = new DirectoryResourcePack(new File("../jGui/src/main/resources")) { + initJGuiResourcePack(); + } + + private static void initJGuiResourcePack() { + File folder = new File("../jGui/src/main/resources"); + if (!folder.exists()) { + return; + } + DirectoryResourcePack jGuiResourcePack = new DirectoryResourcePack(folder) { @Override protected InputStream openFile(String resourceName) throws IOException { try { @@ -290,7 +291,7 @@ public class ReplayMod implements //$$ }; //$$ defaultResourcePacks.add(mainResourcePack); //#endif - }} + } //#if FABRIC>=1 @Override diff --git a/src/main/java/com/replaymod/core/utils/Utils.java b/src/main/java/com/replaymod/core/utils/Utils.java index 6cf0b3c1..81448cb5 100644 --- a/src/main/java/com/replaymod/core/utils/Utils.java +++ b/src/main/java/com/replaymod/core/utils/Utils.java @@ -76,16 +76,7 @@ public class Utils { private static Logger LOGGER = LogManager.getLogger(); private static InputStream getResourceAsStream(String path) { - // FIXME this seems broken in 1.13, hence the workaround. probably want to open an issue with modlauncher (or forge?) - //#ifdef DEV_ENV - try { - return new java.io.FileInputStream(new File("../src/main/resources" + path)); - } catch (java.io.FileNotFoundException e) { - throw new RuntimeException(e); - } - //#else - //$$ return Utils.class.getResourceAsStream(path); - //#endif + return Utils.class.getResourceAsStream(path); } public static final Image DEFAULT_THUMBNAIL;