Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.

Commit 8bafeba

Browse files
committed
Fix inverted detection of FML environment
1 parent 80bae69 commit 8bafeba

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/main/java/clientapi/load/ClientTweaker.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
* @author Brady
4242
* @since 1/20/2017
4343
*/
44-
public class ClientTweaker implements ITweaker {
44+
public final class ClientTweaker implements ITweaker {
4545

4646
/**
47-
* The Game Launch Arguments
47+
* The raw game launch arguments that are provided in {@link ClientTweaker#acceptOptions(List, File, File, String)}
4848
*/
4949
private List<String> args;
5050

@@ -60,19 +60,7 @@ public void acceptOptions(List<String> args, File gameDir, File assetsDir, Strin
6060
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
6161
ClientAPI.LOGGER.log(Level.INFO, "Injecting into ClassLoader");
6262

63-
MixinBootstrap.init();
64-
ClientAPI.LOGGER.log(Level.INFO, "Initialized Mixin bootstrap");
65-
66-
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
67-
68-
String obfuscation = ObfuscationServiceMCP.NOTCH;
69-
if (Launch.classLoader.getTransformers().stream().noneMatch(t -> t.getClass().getName().contains("fml"))) {
70-
obfuscation = ObfuscationServiceMCP.SEARGE;
71-
}
72-
73-
MixinEnvironment.getDefaultEnvironment().setObfuscationContext(obfuscation);
74-
75-
ClientAPI.LOGGER.log(Level.INFO, "Setup Mixin Environment");
63+
this.setupMixin();
7664

7765
ClientConfiguration config = findClientConfig();
7866

@@ -113,6 +101,22 @@ public final String[] getLaunchArguments() {
113101
return Arguments.join(parsed).toArray(new String[0]);
114102
}
115103

104+
private void setupMixin() {
105+
MixinBootstrap.init();
106+
ClientAPI.LOGGER.log(Level.INFO, "Initialized Mixin bootstrap");
107+
108+
String obfuscation = ObfuscationServiceMCP.NOTCH;
109+
110+
// If there are any transformers that have "fml" in their class name, then use the searge obfuscation context
111+
if (Launch.classLoader.getTransformers().stream().anyMatch(t -> t.getClass().getName().contains("fml"))) {
112+
obfuscation = ObfuscationServiceMCP.SEARGE;
113+
}
114+
115+
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
116+
MixinEnvironment.getDefaultEnvironment().setObfuscationContext(obfuscation);
117+
ClientAPI.LOGGER.log(Level.INFO, "Setup Mixin Environment");
118+
}
119+
116120
private ClientConfiguration findClientConfig() {
117121
InputStream stream;
118122
if ((stream = this.getClass().getResourceAsStream("/client.json")) == null)

0 commit comments

Comments
 (0)