Move some launchwrapper-specific keys into service

This commit is contained in:
Mumfrey committed 2017-10-09 16:13:40 +01:00
1 parent c218a4a76e
commit 02ba7b73e1
3 files changed
+9 -7

No files matched your search

@@ -42,6 +42,7 @@ import org.spongepowered.asm.mixin.MixinEnvironment;
//import org.spongepowered.asm.mixin.environment.PhaseDefinition;
//import org.spongepowered.asm.mixin.environment.phase.OnLogMessage;
import org.spongepowered.asm.mixin.extensibility.IRemapper;
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
//import com.google.common.collect.ImmutableList;
@@ -237,7 +238,7 @@ public class MixinPlatformAgentFML extends MixinPlatformAgentAbstract {
// Was it already loaded, check the tweakers list
try {
List<ITweaker> tweakers = GlobalProperties.<List<ITweaker>>get(GlobalProperties.Keys.TWEAKS);
List<ITweaker> tweakers = GlobalProperties.<List<ITweaker>>get(MixinServiceLaunchWrapper.BLACKBOARD_KEY_TWEAKS);
if (tweakers == null) {
return false;
}
@@ -347,7 +348,7 @@ public class MixinPlatformAgentFML extends MixinPlatformAgentAbstract {
* @return true if a tweaker with the specified name is queued
*/
private static boolean isTweakerQueued(String tweakerName) {
for (String tweaker : GlobalProperties.<List<String>>get(GlobalProperties.Keys.TWEAKCLASSES)) {
for (String tweaker : GlobalProperties.<List<String>>get(MixinServiceLaunchWrapper.BLACKBOARD_KEY_TWEAKCLASSES)) {
if (tweaker.endsWith(tweakerName)) {
return true;
}
@@ -60,6 +60,10 @@ import net.minecraft.launchwrapper.Launch;
*/
public class MixinServiceLaunchWrapper implements IMixinService {
// Blackboard keys
public static final String BLACKBOARD_KEY_TWEAKCLASSES = "TweakClasses";
public static final String BLACKBOARD_KEY_TWEAKS = "Tweaks";
// Consts
private static final String LAUNCH_PACKAGE = "org.spongepowered.asm.launch.";
private static final String MIXIN_PACKAGE = "org.spongepowered.asm.mixin.";
@@ -128,7 +132,7 @@ public class MixinServiceLaunchWrapper implements IMixinService {
MixinServiceLaunchWrapper.logger.error("MixinBootstrap.doInit() called during a tweak constructor!");
}
List<String> tweakClasses = GlobalProperties.<List<String>>get(GlobalProperties.Keys.TWEAKCLASSES);
List<String> tweakClasses = GlobalProperties.<List<String>>get(MixinServiceLaunchWrapper.BLACKBOARD_KEY_TWEAKCLASSES);
if (tweakClasses != null) {
tweakClasses.add(MixinServiceLaunchWrapper.STATE_TWEAKER);
}
@@ -404,7 +408,7 @@ public class MixinServiceLaunchWrapper implements IMixinService {
public final String getSideName() {
// Using this method first prevents us from accidentally loading FML classes
// too early when using the tweaker in dev
for (ITweaker tweaker : GlobalProperties.<List<ITweaker>>get(GlobalProperties.Keys.TWEAKS)) {
for (ITweaker tweaker : GlobalProperties.<List<ITweaker>>get(MixinServiceLaunchWrapper.BLACKBOARD_KEY_TWEAKS)) {
if (tweaker.getClass().getName().endsWith(".common.launcher.FMLServerTweaker")) {
return "SERVER";
} else if (tweaker.getClass().getName().endsWith(".common.launcher.FMLTweaker")) {
@@ -39,9 +39,6 @@ public final class GlobalProperties {
*/
public static final class Keys {
public static final String TWEAKCLASSES = "TweakClasses";
public static final String TWEAKS = "Tweaks";
public static final String INIT = "mixin.initialised";
public static final String AGENTS = "mixin.agents";
public static final String CONFIGS = "mixin.configs";