mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 03:22:17 +00:00
Fix config priority and provide config-wide mixin priorty setting
This commit is contained in:
1 parent
97319a5049
commit
1218cc51e3
3 files changed
+25
-3
No files matched your search
@@ -31,6 +31,11 @@ import java.util.Set;
|
||||
*/
|
||||
public interface IMixinConfig {
|
||||
|
||||
/**
|
||||
* Default priority for mixin configs and mixins
|
||||
*/
|
||||
public static final int DEFAULT_PRIORITY = 1000;
|
||||
|
||||
/**
|
||||
* Get the name of the file from which this configuration object was
|
||||
* initialised
|
||||
|
||||
@@ -111,7 +111,16 @@ class MixinConfig implements Comparable<MixinConfig>, IMixinConfig {
|
||||
* Configuration priority
|
||||
*/
|
||||
@SerializedName("priority")
|
||||
private final int priority = 1000;
|
||||
private int priority = IMixinConfig.DEFAULT_PRIORITY;
|
||||
|
||||
/**
|
||||
* Default mixin priority. By default, mixins get a priority of
|
||||
* {@link IMixinConfig#DEFAULT_PRIORITY DEFAULT_PRIORITY} unless a different
|
||||
* value is specified in the annotation. This setting allows the base
|
||||
* priority for all mixins in this config to be set to an alternate value.
|
||||
*/
|
||||
@SerializedName("mixinPriority")
|
||||
private int mixinPriority = IMixinConfig.DEFAULT_PRIORITY;
|
||||
|
||||
/**
|
||||
* Package containing all mixins. This package will be monitored by the
|
||||
@@ -383,7 +392,15 @@ class MixinConfig implements Comparable<MixinConfig>, IMixinConfig {
|
||||
public int getPriority() {
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the default priority for mixins in this config. Values specified in
|
||||
* the mixin annotation still override this value
|
||||
*/
|
||||
public int getDefaultMixinPriority() {
|
||||
return this.mixinPriority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of mixin classes we will be applying
|
||||
*/
|
||||
|
||||
@@ -271,7 +271,7 @@ class MixinInfo extends TreeInfo implements Comparable<MixinInfo>, IMixinInfo {
|
||||
}
|
||||
|
||||
Integer priority = ASMHelper.getAnnotationValue(mixin, "priority");
|
||||
return priority == null ? 1000 : priority.intValue();
|
||||
return priority == null ? this.parent.getDefaultMixinPriority() : priority.intValue();
|
||||
}
|
||||
|
||||
private boolean validateTargetClasses(ClassNode classNode) {
|
||||
|
||||
Reference in new issue
Block a user