From 5e3a301dfbdbeee14aecc9da2955168605f6a0c4 Mon Sep 17 00:00:00 2001 From: TexTrue <3140846162@qq.com> Date: Mon, 5 Aug 2024 14:48:29 +0800 Subject: [PATCH] add `isDevEnv` --- .../main/java/band/kessoku/lib/platform/api/ModLoader.java | 1 + .../java/band/kessoku/lib/platform/impl/ModLoaderImpl.java | 5 +++++ .../java/band/kessoku/lib/platform/impl/ModLoaderImpl.java | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/platform-common/src/main/java/band/kessoku/lib/platform/api/ModLoader.java b/platform-common/src/main/java/band/kessoku/lib/platform/api/ModLoader.java index e70e6dc5..2b772c5b 100644 --- a/platform-common/src/main/java/band/kessoku/lib/platform/api/ModLoader.java +++ b/platform-common/src/main/java/band/kessoku/lib/platform/api/ModLoader.java @@ -20,4 +20,5 @@ static ModLoader getInstance() { boolean isModLoaded(String id); Collection getModIds(); Collection getMods(); + boolean isDevEnv(); } diff --git a/platform-fabric/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java b/platform-fabric/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java index 2488e718..5f5f18e6 100644 --- a/platform-fabric/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java +++ b/platform-fabric/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java @@ -68,4 +68,9 @@ public Collection getModIds() { public Collection getMods() { return FabricLoader.getInstance().getAllMods().stream().map(ModDataImpl::new).toList(); } + + @Override + public boolean isDevEnv() { + return FabricLoader.getInstance().isDevelopmentEnvironment(); + } } diff --git a/platform-neo/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java b/platform-neo/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java index 8dc7c362..cd5f6cb1 100644 --- a/platform-neo/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java +++ b/platform-neo/src/main/java/band/kessoku/lib/platform/impl/ModLoaderImpl.java @@ -68,4 +68,9 @@ public Collection getModIds() { public Collection getMods() { return ModList.get().getMods().stream().map(ModDataImpl::new).toList(); } + + @Override + public boolean isDevEnv() { + return !FMLLoader.isProduction(); + } }