Skip to content

Commit

Permalink
Move some launchwrapper-specific keys into service
Browse files Browse the repository at this point in the history
  • Loading branch information
Mumfrey committed Oct 9, 2017
1 parent c218a4a commit 02ba7b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
//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;

Expand Down Expand Up @@ -237,7 +238,7 @@ private boolean isAlreadyInjected(String coreModName) {

// 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;
}
Expand Down Expand Up @@ -347,7 +348,7 @@ protected final boolean checkForCoInitialisation() {
* @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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
*/
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.";
Expand Down Expand Up @@ -128,7 +132,7 @@ public void init() {
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);
}
Expand Down Expand Up @@ -404,7 +408,7 @@ private ClassNode getClassNode(byte[] classBytes, int flags) {
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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 02ba7b7

Please sign in to comment.