Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 930 Bytes

mixin-priority.md

File metadata and controls

37 lines (30 loc) · 930 Bytes

Changing your mixin's priority

<- Return

Changes the order in which mixins are applied. This can be especially useful when trying to inject into a method that another mod overwrites, or overwriting a method that other mods inject into. The default priority is 1000. The priority is set in the mixin annotation.

Example mixins:

@Mixin(Dummy.class)
public class MixinDummyTwo {
    @Inject(at = @At("HEAD"), method = "dummy")
    public void doFoo(CallbackInfo info) {
        System.out.println("Priority = 1000");
    }
}
@Mixin(value = Dummy.class, priority = 800)
public class MixinDummyOne {
    @Inject(at = @At("HEAD"), method = "dummy")
    public void doFoo(CallbackInfo info) {
        System.out.println("Priority = 800");
    }
}

Method Modification:

public void dummy() {
   System.out.println("Priority = 800");
   System.out.println("Priority = 1000");
}