-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCrashAssistantTransformationService.java
44 lines (37 loc) · 1.56 KB
/
CrashAssistantTransformationService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package dev.kostromdan.mods.crash_assistant.core_mod.services;
import cpw.mods.modlauncher.api.IEnvironment;
import cpw.mods.modlauncher.api.ITransformationService;
import cpw.mods.modlauncher.api.ITransformer;
import dev.kostromdan.mods.crash_assistant.loading_utils.JarInJarHelper;
import dev.kostromdan.mods.crash_assistant.platform.PlatformHelp;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Set;
/**
* CrashAssistantApp should be launched as soon as possible after game start
* to be able to help players even with coremod/mixin/hs_err crashes.
* So we launch it from initialize of ITransformationService, the first point, we can launch it from forge mod.
*/
public class CrashAssistantTransformationService implements ITransformationService {
public static final Logger LOGGER = LoggerFactory.getLogger("CrashAssistantTransformationService");
@Override
public @NotNull String name() {
return "crash_assistant";
}
@Override
public void initialize(IEnvironment environment) {
String launchTarget = environment.getProperty(IEnvironment.Keys.LAUNCHTARGET.get()).orElse("unknown");
PlatformHelp.platform = PlatformHelp.FORGE;
JarInJarHelper.launchCrashAssistantApp(launchTarget);
JarInJarHelper.checkDuplicatedCrashAssistantMod();
}
@Override
public void onLoad(IEnvironment env, Set<String> otherServices) {
}
@Override
public @NotNull List<ITransformer> transformers() {
return List.of();
}
}