#Cannot add methods to class with mixin
16 messages ยท Page 1 of 1 (latest)
Example of Duck interfaces:
io/github/mymod/mixin/MyClassMixin
// This mixin implements the duck interface onto `MyClass`
@Mixin(MyClass.class)
public class MyClassMixin implements MyClassAccess {
@Override
public void access() {
System.out.println("Accessed!");
}
}
io/github/mymod/access/MyClassAccess
// The duck interface being implemented onto `MyClass`
public interface MyClassAccess {
void access();
}
To use it:
public class Container {
public void slapHaykam(MyClass instance) {
((MyClassAccess)instance).access(); // Will print "Accessed!"
}
}
you cannot cast an object to a mixin
mixins don't exist at runtime, and clearly the compiler is also complaining
So, I cannot cast to class mixins but I can to interface mixins true?
I really appreciate the patience you guys have with the recurring questions ๐ tyty
The transformation is somehow failing
Mixin transformation of com.iadnah.addon.mixin.ITestMixin failed
what's the full error?
We do not support hacked clients, cheats, or modifications that are intended to give you the upper hand in a server, competitive or otherwise.
See rule 1 in #welcome and the Discord TOS: https://discordapp.com/terms