Jump to content

(1.16.2) How do I use RegisterCommandsEvent?


e2rifia

Recommended Posts

I have problems using RegisterCommandsEvent. Below is inside a EventBusSubscriber.

@SubscribeEvent
    public static void onRegisterCommands(final RegisterCommandsEvent event) {
        HelloWorldCommand.register(event.getDispatcher());
    }

This gives me this error.

Failure message: Chants (chants) has failed to load correctly
        java.lang.IllegalArgumentException: Method public static void com.name.chants.ModEventSubscriber.onServerStarting(net.minecraftforge.event.RegisterCommandsEvent) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.lifecycle.IModBusEvent: class net.minecraftforge.event.RegisterCommandsEvent
I heard that FMLServerStartingEvent was replaced with RegisterCommandsEvent for custom commands, but I couldn't find an example anywhere.

Can I have a couple of examples of command registration using RegisterCommandsEvent?

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.