Make tweaker/manifest constants public for @Minecrell

This commit is contained in:
Mumfrey committed 2016-06-17 22:28:05 +01:00
1 parent 0541ed4d3c
commit 2cd02e91a4
3 files changed
+24 -11

No files matched your search

@@ -26,6 +26,8 @@ package org.spongepowered.asm.launch;
import java.net.URI;
import org.spongepowered.asm.util.Constants.ManifestAttributes;
import net.minecraft.launchwrapper.LaunchClassLoader;
/**
@@ -33,11 +35,6 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
*/
public class MixinLaunchAgentDefault extends MixinLaunchAgentAbstract {
protected static final String MFATT_MIXINCONFIGS = "MixinConfigs";
protected static final String MFATT_TOKENPROVIDERS = "MixinTokenProviders";
protected static final String MFATT_MAINCLASS = "Main-Class";
protected static final String MFATT_COMPATIBILITY = "MixinCompatibilityLevel";
public MixinLaunchAgentDefault(URI uri) {
super(uri);
}
@@ -45,21 +42,21 @@ public class MixinLaunchAgentDefault extends MixinLaunchAgentAbstract {
@SuppressWarnings("deprecation")
@Override
public void prepare() {
String compatibilityLevel = this.attributes.get(MixinLaunchAgentDefault.MFATT_COMPATIBILITY);
String compatibilityLevel = this.attributes.get(ManifestAttributes.COMPATIBILITY);
if (compatibilityLevel != null) {
MixinLaunchAgentAbstract.logger.warn("{} Setting mixin compatibility level via manifest is deprecated, "
+ "use 'compatibilityLevel' key in config instead", this.container);
MixinTweaker.setCompatibilityLevel(compatibilityLevel);
}
String mixinConfigs = this.attributes.get(MixinLaunchAgentDefault.MFATT_MIXINCONFIGS);
String mixinConfigs = this.attributes.get(ManifestAttributes.MIXINCONFIGS);
if (mixinConfigs != null) {
for (String config : mixinConfigs.split(",")) {
MixinTweaker.addConfig(config.trim());
}
}
String tokenProviders = this.attributes.get(MixinLaunchAgentDefault.MFATT_TOKENPROVIDERS);
String tokenProviders = this.attributes.get(ManifestAttributes.TOKENPROVIDERS);
if (tokenProviders != null) {
for (String provider : tokenProviders.split(",")) {
MixinTweaker.addTokenProvider(provider.trim());
@@ -77,7 +74,7 @@ public class MixinLaunchAgentDefault extends MixinLaunchAgentAbstract {
@Override
public String getLaunchTarget() {
return this.attributes.get(MixinLaunchAgentDefault.MFATT_MAINCLASS);
return this.attributes.get(ManifestAttributes.MAINCLASS);
}
}
@@ -38,6 +38,7 @@ import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.MixinEnvironment.CompatibilityLevel;
import org.spongepowered.asm.mixin.MixinEnvironment.Phase;
import org.spongepowered.asm.mixin.Mixins;
import org.spongepowered.asm.util.Constants.ManifestAttributes;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
@@ -50,7 +51,6 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
*/
public class MixinTweaker implements ITweaker {
private static final String MFATT_TWEAKER = "TweakClass";
private static final String DEFAULT_MAIN_CLASS = "net.minecraft.client.main.Main";
/**
@@ -174,7 +174,7 @@ public class MixinTweaker implements ITweaker {
continue;
}
MainAttributes attributes = MainAttributes.of(uri);
String tweaker = attributes.get(MixinTweaker.MFATT_TWEAKER);
String tweaker = attributes.get(ManifestAttributes.TWEAKER);
if (MixinTweaker.class.getName().equals(tweaker)) {
MixinTweaker.logger.debug("{} contains a mixin tweaker, adding agents", uri);
this.addContainer(uri);
@@ -43,4 +43,20 @@ public abstract class Constants {
public static final String CLASS = "Ljava/lang/Class;";
private Constants() {}
/**
* Shared Jar Manifest Attributes
*/
public abstract static class ManifestAttributes {
public static final String TWEAKER = "TweakClass";
public static final String MAINCLASS = "Main-Class";
public static final String MIXINCONFIGS = "MixinConfigs";
public static final String TOKENPROVIDERS = "MixinTokenProviders";
@Deprecated
public static final String COMPATIBILITY = "MixinCompatibilityLevel";
private ManifestAttributes() {}
}
}