[20w18a] CommandRegistrationCallback not working
yentheo opened this issue ยท 3 comments
I made a mod that registers 2 extra commands on initialization of the mod.
Before 20w17a I just used the CommandRegistry.INSTANCE.register
method as explained in the wiki.
Now since 20w17a or 20w18a, that method has been deprecated and is replaced by the CommandRegistrationCallback. So I changed my code from
CommandRegistry.INSTANCE.register(false, dispatcher -> {...});
to
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {...});
I run this line of code as the first statement of the onInitialize
method of my Main mod class. I have a log statement in the onInitialize
and in the lambda that is the parameter of the register method. Only the log statement in onInitialize
is called.
What I did notice is that according to the MixinCommandManager
, is that the registrations are called before the findAmbiguity, which is called before my initialize of the mod is called I guess.
Leaving my code as is, with the deprecated CommandManager, doesn't work either, which is logical because that implementation is changed to something very similar to what I'm doing.
@modmuss50 thanks for the quick response and fix!