diff --git a/CHANGELOG.md b/CHANGELOG.md index 651523f6..3ccb22d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,2 @@ ## Changelog -- port to 1.20.5 \ No newline at end of file +- port to 1.20.6 \ No newline at end of file diff --git a/README.md b/README.md index e27c8a7a..46d55e84 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ A dynamic lights mod for Minecraft. -forge +forge (1.16.5~1.20.1) +neoforge (≥1.20.1) fabric architectury-api diff --git a/common/src/main/java/org/thinkingstudio/ryoamiclights/DynamicLightsConfig.java b/common/src/main/java/org/thinkingstudio/ryoamiclights/DynamicLightsConfig.java index 0ca753f9..cc8e5d36 100644 --- a/common/src/main/java/org/thinkingstudio/ryoamiclights/DynamicLightsConfig.java +++ b/common/src/main/java/org/thinkingstudio/ryoamiclights/DynamicLightsConfig.java @@ -38,7 +38,7 @@ public class DynamicLightsConfig { private static final ExplosiveLightingMode DEFAULT_CREEPER_LIGHTING_MODE = ExplosiveLightingMode.SIMPLE; private static final ExplosiveLightingMode DEFAULT_TNT_LIGHTING_MODE = ExplosiveLightingMode.OFF; - public static final Path CONFIG_FILE_PATH = RyoamicLightsCompat.getConfigDir().resolve("ryoamiclights.toml"); + public static final Path CONFIG_FILE_PATH = ModPlatform.getConfigDir().resolve("ryoamiclights.toml"); protected final FileConfig config; private final RyoamicLights mod; private DynamicLightsMode dynamicLightsMode; diff --git a/common/src/main/java/org/thinkingstudio/ryoamiclights/ModPlatform.java b/common/src/main/java/org/thinkingstudio/ryoamiclights/ModPlatform.java new file mode 100644 index 00000000..8575b7cb --- /dev/null +++ b/common/src/main/java/org/thinkingstudio/ryoamiclights/ModPlatform.java @@ -0,0 +1,22 @@ +package org.thinkingstudio.ryoamiclights; + +import dev.architectury.injectables.annotations.ExpectPlatform; + +import java.nio.file.Path; + +public class ModPlatform { + @ExpectPlatform + public static boolean isModLoaded(String modid) { + throw new AssertionError(); + } + + @ExpectPlatform + public static boolean isDevEnvironment() { + throw new AssertionError(); + } + + @ExpectPlatform + public static Path getConfigDir() { + throw new AssertionError(); + } +} diff --git a/common/src/main/java/org/thinkingstudio/ryoamiclights/RyoamicLightsCompat.java b/common/src/main/java/org/thinkingstudio/ryoamiclights/RyoamicLightsCompat.java index a43b9892..60226db2 100644 --- a/common/src/main/java/org/thinkingstudio/ryoamiclights/RyoamicLightsCompat.java +++ b/common/src/main/java/org/thinkingstudio/ryoamiclights/RyoamicLightsCompat.java @@ -10,10 +10,6 @@ package org.thinkingstudio.ryoamiclights; -import dev.architectury.injectables.annotations.ExpectPlatform; - -import java.nio.file.Path; - /** * Represents a utility class for compatibility. * @@ -27,9 +23,8 @@ public final class RyoamicLightsCompat { * * @return {@code true} if Canvas is installed, else {@code false} */ - @ExpectPlatform public static boolean isCanvasInstalled() { - throw new AssertionError(); + return ModPlatform.isModLoaded("canvas"); } /** @@ -37,19 +32,17 @@ public static boolean isCanvasInstalled() { * * @return {@code true} if LTR is installed, else {@code false} */ - @ExpectPlatform public static boolean isLilTaterReloadedInstalled() { - throw new AssertionError(); + return ModPlatform.isModLoaded("ltr"); } /** - * Returns whether Sodium(Fabric) or Embeddium(Forge/NeoForge) is installed. + * Returns whether Sodium is installed. * - * @return {@code true} if Sodium(Fabric) or Embeddium(Forge/NeoForge) is installed, else {@code false} + * @return {@code true} if Sodium is installed, else {@code false} */ - @ExpectPlatform public static boolean isSodiumInstalled() { - throw new AssertionError(); + return ModPlatform.isModLoaded("sodium"); } /** @@ -57,18 +50,7 @@ public static boolean isSodiumInstalled() { * * @return {@code true} if Fabric API or Forgified Fabric API is installed, else {@code false} */ - @ExpectPlatform public static boolean isFabricApiInstalled() { - throw new AssertionError(); - } - - @ExpectPlatform - public static boolean isDevEnvironment() { - throw new AssertionError(); - } - - @ExpectPlatform - public static Path getConfigDir() { - throw new AssertionError(); + return ModPlatform.isModLoaded("fabric-api") | ModPlatform.isModLoaded("fabric_api"); } } diff --git a/fabric/CHANGELOG.md b/fabric/CHANGELOG.md index 3ace1802..3ccb22d2 100644 --- a/fabric/CHANGELOG.md +++ b/fabric/CHANGELOG.md @@ -1,3 +1,2 @@ ## Changelog -- remove the mixin for embeddium (only forge) -- remove architectury dependency \ No newline at end of file +- port to 1.20.6 \ No newline at end of file diff --git a/fabric/src/main/java/org/thinkingstudio/ryoamiclights/fabric/ModPlatformImpl.java b/fabric/src/main/java/org/thinkingstudio/ryoamiclights/fabric/ModPlatformImpl.java new file mode 100644 index 00000000..f4ed9b38 --- /dev/null +++ b/fabric/src/main/java/org/thinkingstudio/ryoamiclights/fabric/ModPlatformImpl.java @@ -0,0 +1,19 @@ +package org.thinkingstudio.ryoamiclights.fabric; + +import net.fabricmc.loader.api.FabricLoader; + +import java.nio.file.Path; + +public class ModPlatformImpl { + public static boolean isModLoaded(String modid) { + return FabricLoader.getInstance().isModLoaded(modid); + } + + public static boolean isDevEnvironment() { + return FabricLoader.getInstance().isDevelopmentEnvironment(); + } + + public static Path getConfigDir() { + return FabricLoader.getInstance().getConfigDir(); + } +} diff --git a/fabric/src/main/java/org/thinkingstudio/ryoamiclights/fabric/RyoamicLightsCompatImpl.java b/fabric/src/main/java/org/thinkingstudio/ryoamiclights/fabric/RyoamicLightsCompatImpl.java deleted file mode 100644 index e6b635c0..00000000 --- a/fabric/src/main/java/org/thinkingstudio/ryoamiclights/fabric/RyoamicLightsCompatImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.thinkingstudio.ryoamiclights.fabric; - -import net.fabricmc.loader.api.FabricLoader; - -import java.nio.file.Path; - -public class RyoamicLightsCompatImpl { - public static boolean isCanvasInstalled() { - return FabricLoader.getInstance().isModLoaded("canvas"); - } - - public static boolean isLilTaterReloadedInstalled() { - return FabricLoader.getInstance().isModLoaded("ltr"); - } - - public static boolean isSodiumInstalled() { - return FabricLoader.getInstance().isModLoaded("sodium"); - } - - public static boolean isFabricApiInstalled() { - return FabricLoader.getInstance().isModLoaded("fabric-api"); - } - - public static boolean isDevEnvironment() { - return FabricLoader.getInstance().isDevelopmentEnvironment(); - } - - public static Path getConfigDir() { - return FabricLoader.getInstance().getConfigDir(); - } -} diff --git a/gradle.properties b/gradle.properties index d97c9446..6fdcb0b5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,19 @@ org.gradle.jvmargs=-Xmx2G org.gradle.daemon=false -minecraft_version=1.20.5 +minecraft_version=1.20.6 enabled_platforms=fabric,neoforge -yarn_mappings=1.20.5+build.1 +yarn_mappings=1.20.6+build.1 archives_base_name=RyoamicLights mod_version=0.2.5 maven_group=org.thinkingstudio.ryoamiclights -fabric_loader_version=0.15.2 -fabric_api_version=0.97.6+1.20.5 +fabric_loader_version=0.15.11 +fabric_api_version=0.98.0+1.20.6 mod_menu_version=10.0.0-beta.1 -neoforge_version=20.5.21-beta +neoforge_version=20.6.63-beta obsidianui_version=0.2.1+mc1.20.4 diff --git a/neoforge/CHANGELOG.md b/neoforge/CHANGELOG.md index 3ace1802..3ccb22d2 100644 --- a/neoforge/CHANGELOG.md +++ b/neoforge/CHANGELOG.md @@ -1,3 +1,2 @@ ## Changelog -- remove the mixin for embeddium (only forge) -- remove architectury dependency \ No newline at end of file +- port to 1.20.6 \ No newline at end of file diff --git a/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/ModPlatformImpl.java b/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/ModPlatformImpl.java new file mode 100644 index 00000000..987ee13e --- /dev/null +++ b/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/ModPlatformImpl.java @@ -0,0 +1,21 @@ +package org.thinkingstudio.ryoamiclights.neoforge; + +import net.neoforged.fml.ModList; +import net.neoforged.fml.loading.FMLLoader; +import net.neoforged.fml.loading.FMLPaths; + +import java.nio.file.Path; + +public class ModPlatformImpl { + public static boolean isModLoaded(String modid) { + return ModList.get().isLoaded(modid); + } + + public static boolean isDevEnvironment() { + return !FMLLoader.isProduction(); + } + + public static Path getConfigDir() { + return FMLPaths.CONFIGDIR.get(); + } +} diff --git a/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/RyoamicLightsCompatImpl.java b/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/RyoamicLightsCompatImpl.java deleted file mode 100644 index 4247b6f5..00000000 --- a/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/RyoamicLightsCompatImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.thinkingstudio.ryoamiclights.neoforge; - -import net.neoforged.fml.loading.FMLLoader; -import net.neoforged.fml.loading.FMLPaths; - -import java.nio.file.Path; - -public class RyoamicLightsCompatImpl { - public static boolean isCanvasInstalled() { - return FMLLoader.getLoadingModList().getModFileById("canvas") != null; - } - - public static boolean isLilTaterReloadedInstalled() { - return FMLLoader.getLoadingModList().getModFileById("ltr") != null; - } - - public static boolean isSodiumInstalled() { - return FMLLoader.getLoadingModList().getModFileById("embeddium") != null; - } - - public static boolean isFabricApiInstalled() { - return FMLLoader.getLoadingModList().getModFileById("fabric_api") != null; - } - - public static boolean isDevEnvironment() { - return !FMLLoader.isProduction(); - } - - public static Path getConfigDir() { - return FMLPaths.CONFIGDIR.get(); - } -} diff --git a/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/RyoamicLightsNeoForgeMixinPlugin.java b/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/RyoamicLightsNeoForgeMixinPlugin.java index cf0edbb3..b31f5126 100644 --- a/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/RyoamicLightsNeoForgeMixinPlugin.java +++ b/neoforge/src/main/java/org/thinkingstudio/ryoamiclights/neoforge/RyoamicLightsNeoForgeMixinPlugin.java @@ -28,11 +28,6 @@ public RyoamicLightsNeoForgeMixinPlugin() { this.conditionalMixins.put("org.thinkingstudio.ryoamiclights.neoforge.mixin.ltr.LilTaterBlocksMixin", ltrInstalled); this.conditionalMixins.put("org.thinkingstudio.ryoamiclights.neoforge.mixin.ltr.LilTaterBlockEntityMixin", ltrInstalled); - //boolean embeddiumInstalled = RyoamicLightsCompat.isSodiumInstalled(); - //this.conditionalMixins.put("org.thinkingstudio.ryoamiclights.neoforge.mixin.embeddium.ArrayLightDataCacheMixin", embeddiumInstalled); - //this.conditionalMixins.put("org.thinkingstudio.ryoamiclights.neoforge.mixin.embeddium.FlatLightPipelineMixin", embeddiumInstalled); - //this.conditionalMixins.put("org.thinkingstudio.ryoamiclights.neoforge.mixin.embeddium.LightDataAccessMixin", embeddiumInstalled); - boolean forgifiedFabricApiInstalled = RyoamicLightsCompat.isFabricApiInstalled(); this.conditionalMixins.put("org.thinkingstudio.ryoamiclights.neoforge.mixin.fabricapi.AoCalculatorMixin", forgifiedFabricApiInstalled); }