You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a long, magical string that's required for the Mixin but completely unreadable and would be an anti-pattern in modern Kotlin development. My goal was to come up with some kind of entity that would contain information from which this string could be deduced during compilation, but at the same time, make it so that the modder would never have to write it manually. The most elegant solution for this in Kotlin is callable references:
val crit =Player::crit
If the method is overloaded, then we need to clarify which one we mean. For this purpose, Kotlin provides us function types:
val crit:Player.(Entity) ->Unit=Player::crit
By using both features together on a consistent basis, we force the compiler to check that the crit is actually non-static method, exists in the Player class, takes single parameter of type Entity, and returns void.