Mixin and inheritance

I have a question about the mixin module.
Can i create a mixin class which inherits from another mixin class like this example below:

@Mixin(EntityPlayerMp.class)
public class MyAwesomePlayerClass extends MixinEntityPlayerMP implements MyAwesomeInterface {
        ....
        public void myAwesomeMethodFromInterface()  {..}
}

Is it possible or not?

@Mixin(EntityPlayerMp.class)
public class MyAwesomePlayerClass implements MyAwesomeInterface {
     public void myAwesomeMethodFromInterface()  {..}
}

In second example when i’ll have a method which takes MyAwesomePlayerClass as an argument

public void somemethod(MyAwesomePlayerClass obj) {}

and i will need to access a method from Player interface i will have to cast the object to Player. First example with inheritance wont require this cast.

I am afraid you can’t extend mixin classes. But I am sure @mumfrey can tell more about it :smile:.

Mixins can’t inherit from other mixins yet. It’s in the works but believe me it’s annoyingly complicated and is taking some time to get the wiring in place for it. For now, just type cast.

1 Like