Fabric API

Fabric API

106M Downloads

Inconsistent method names for mixin methods

i509VCB opened this issue ยท 0 comments

commented

I've noticed a tendency around the codebase where mixin injections and redirects are not consistently named.

For example some injections are prepended with fabric_emulateOldPick (https://github.com/FabricMC/fabric/blob/1.15/fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinMinecraftClient.java#L44)

While other occurrences do literally nothing but copy the method name they inject into (https://github.com/FabricMC/fabric/blob/1.15/fabric-commands-v0/src/main/java/net/fabricmc/fabric/mixin/command/MixinMinecraftDedicatedServer.java#L46).

Other ones I've seen are:
onFabricXXXXX
loadHook(https://github.com/FabricMC/fabric/blob/1.15/fabric-keybindings-v0/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java#L36)
method_2902 and more.

Basically we can't seem to keep a consistent naming format which is why I've opened this issue to possibly discuss what format for mixin injection/redirect method names we want to use.

My personal opinion on the matter is we should put fabric_/fabric$ in front of all the mixin methods names for convince in reading crash logs. And the name of these methods should be related to the function the specific injection serves.

For example, setupServer(CallbackInfoReturnable<Boolean>) { in MixinMinecraftDedicatedServer would become fabric_registerCommands(CallbackInfoReturnable<Boolean>) {

Of course suggestions are welcome on other naming schemes.