From 02ba7b73e14333ef4a0c6cacc32e41347be8fde0 Mon Sep 17 00:00:00 2001 From: Mumfrey Date: Mon, 9 Oct 2017 16:13:40 +0100 Subject: [PATCH] Move some launchwrapper-specific keys into service --- .../asm/launch/platform/MixinPlatformAgentFML.java | 5 +++-- .../asm/service/mojang/MixinServiceLaunchWrapper.java | 8 ++++++-- .../org/spongepowered/asm/launch/GlobalProperties.java | 3 --- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFML.java b/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFML.java index 744cd850..150dbee1 100644 --- a/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFML.java +++ b/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFML.java @@ -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 tweakers = GlobalProperties.>get(GlobalProperties.Keys.TWEAKS); + List tweakers = GlobalProperties.>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.>get(GlobalProperties.Keys.TWEAKCLASSES)) { + for (String tweaker : GlobalProperties.>get(MixinServiceLaunchWrapper.BLACKBOARD_KEY_TWEAKCLASSES)) { if (tweaker.endsWith(tweakerName)) { return true; } diff --git a/src/launchwrapper/java/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapper.java b/src/launchwrapper/java/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapper.java index 887cbd0a..359123f8 100644 --- a/src/launchwrapper/java/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapper.java +++ b/src/launchwrapper/java/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapper.java @@ -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 tweakClasses = GlobalProperties.>get(GlobalProperties.Keys.TWEAKCLASSES); + List tweakClasses = GlobalProperties.>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.>get(GlobalProperties.Keys.TWEAKS)) { + for (ITweaker tweaker : GlobalProperties.>get(MixinServiceLaunchWrapper.BLACKBOARD_KEY_TWEAKS)) { if (tweaker.getClass().getName().endsWith(".common.launcher.FMLServerTweaker")) { return "SERVER"; } else if (tweaker.getClass().getName().endsWith(".common.launcher.FMLTweaker")) { diff --git a/src/main/java/org/spongepowered/asm/launch/GlobalProperties.java b/src/main/java/org/spongepowered/asm/launch/GlobalProperties.java index b76efd4b..a5fef67d 100644 --- a/src/main/java/org/spongepowered/asm/launch/GlobalProperties.java +++ b/src/main/java/org/spongepowered/asm/launch/GlobalProperties.java @@ -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";