Fabric API

Fabric API

112M Downloads

Incorrect behavior with ClientMessageEvents and CommandApi

kevinthegreat1 opened this issue ยท 3 comments

commented

Two separate mixins are used for commands in ClientSendMessageEvents. The first one implements ALLOW_COMMAND and COMMAND_CANCELED and injects to HEAD, which executes before Client Command Api. The second one implements MODIFY_COMMAND and COMMAND and injects into the first variable load, which is after Client Command Api. The documentation however states that MODIFY_COMMAND and COMMAND will work with client commands, which it currently does not, since Client Command Api cancels the method before those invokers are called.

My specific use case is replacing a command with another before sending it to the server. I also registered my custom command to client commands api so command suggestions will work. But Client Command Api cancels the method and never gets to the MODIFY_COMMAND and COMMAND events.

I think it would make sense for MODIFY_COMMAND and COMMAND moved to inject at HEAD. Below is the mixin output.
Mixin output for ClientPlayNetworkHandler#sendChatCommand

commented

@Juuxel do you want to have a look at this?

commented

Maybe PR it first then we can have a look?

commented

Any update on this? I can pr moving the injection point to HEAD easily. Thanks.