Skip to content

Commit

Permalink
1.1.18
Browse files Browse the repository at this point in the history
fix replaymod detection not mattering
  • Loading branch information
Wyvest committed Jul 4, 2024
1 parent 9b4a5da commit 4b5876f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/co/skyclient/scc/SkyclientCosmetics.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -179,24 +180,23 @@ 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();
isReplayMod = false;
}
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();
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/co/skyclient/scc/utils/ReplayModCompat.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 4b5876f

Please sign in to comment.