diff --git a/gradle.properties b/gradle.properties index 8979e78..e140717 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_id=skyclientcosmetics mod_name=SkyClientCosmetics -mod_version=1.1.17 +mod_version=1.1.18 mod_archives_name=SkyClientCosmetics # Gradle Configuration -- DO NOT TOUCH THESE VALUES. diff --git a/src/main/java/co/skyclient/scc/SkyclientCosmetics.java b/src/main/java/co/skyclient/scc/SkyclientCosmetics.java index 90441c1..bf725a8 100644 --- a/src/main/java/co/skyclient/scc/SkyclientCosmetics.java +++ b/src/main/java/co/skyclient/scc/SkyclientCosmetics.java @@ -32,6 +32,7 @@ import co.skyclient.scc.mixins.ServerListAccessor; import co.skyclient.scc.rpc.RPC; import co.skyclient.scc.utils.Files; +import co.skyclient.scc.utils.ReplayModCompat; import com.replaymod.core.ReplayMod; import com.replaymod.recording.Setting; import de.jcm.discordgamesdk.Core; @@ -79,7 +80,7 @@ public class SkyclientCosmetics { public static boolean isPatcher; public static boolean isEssential; - public static boolean isReplayMod; + public static boolean isReplayMod = false; public static Object scuConfig = null; //private static boolean hasFailed; @@ -179,13 +180,15 @@ public void onPostInit(FMLPostInitializationEvent event) { } else if ("replaymod".equals(mod.getModId())) { isReplayMod = true; try { - Class replayMod = Class.forName("com.replaymod.core.ReplayMod"); + Class replayMod = Class.forName("com.replaymod.core.ReplayMod", false, getClass().getClassLoader()); replayMod.getDeclaredField("instance"); replayMod.getDeclaredMethod("getSettingsRegistry"); - Class settingsRegistry = Class.forName("com.replaymod.core.SettingsRegistry"); + Class settingsRegistry = Class.forName("com.replaymod.core.SettingsRegistry", false, getClass().getClassLoader()); + Class settingKey = Class.forName("com.replaymod.core.SettingsRegistry$SettingKey", false, getClass().getClassLoader()); + Class settingKeys = Class.forName("com.replaymod.core.SettingsRegistry$SettingKeys", false, getClass().getClassLoader()); settingsRegistry.getDeclaredMethod("set", settingsRegistry.getDeclaredClasses()[0], Object.class); settingsRegistry.getDeclaredMethod("save"); - Class settings = Class.forName("com.replaymod.recording.Setting"); + Class settings = Class.forName("com.replaymod.recording.Setting", false, getClass().getClassLoader()); settings.getDeclaredField("AUTO_START_RECORDING"); } catch (Exception e) { e.printStackTrace(); @@ -193,10 +196,7 @@ public void onPostInit(FMLPostInitializationEvent event) { } if (isReplayMod) { if (!Settings.hasWipedOutReplayModAutoRecording) { - ReplayMod.instance.getSettingsRegistry().set(Setting.AUTO_START_RECORDING, false); - ReplayMod.instance.getSettingsRegistry().save(); - Settings.hasWipedOutReplayModAutoRecording = true; - config.save(); + ReplayModCompat.doReplayModStuff(); } } } diff --git a/src/main/java/co/skyclient/scc/utils/ReplayModCompat.java b/src/main/java/co/skyclient/scc/utils/ReplayModCompat.java new file mode 100644 index 0000000..cc0cc53 --- /dev/null +++ b/src/main/java/co/skyclient/scc/utils/ReplayModCompat.java @@ -0,0 +1,19 @@ +package co.skyclient.scc.utils; + +import co.skyclient.scc.SkyclientCosmetics; +import co.skyclient.scc.config.Settings; +import com.replaymod.core.ReplayMod; +import com.replaymod.recording.Setting; + +public class ReplayModCompat { + + /** + * i have to move this to another method or else forge will die + */ + public static void doReplayModStuff() { + ReplayMod.instance.getSettingsRegistry().set(Setting.AUTO_START_RECORDING, false); + ReplayMod.instance.getSettingsRegistry().save(); + Settings.hasWipedOutReplayModAutoRecording = true; + SkyclientCosmetics.config.save(); + } +}