Jump to content

Recommended Posts

Posted

What do you mean? There is an integrated server in the singleplayer world too, any command registered will work in singleplayer just as well as in multiplayer. Please elaborate on your question. Do you need to create client-side only commands or do you wish to know how to register commands in general?

Posted

I used the FMLServerStartingEvent to register the commands like this:
 

private void onServerStarting(final FMLServerStartingEvent e)
	{
		e.getCommandDispatcher().register(LiteralArgumentBuilder.<CommandSource>literal("celriff").then(GamemodeCreativeShortcutCommand.register()).then(GamemodeSurvivalShortcutCommand.register()).then(GamemodeSpectatorShortcutCommand.register()));
	}

 

but I am not able to use these commands in a single player world.

Posted

Okay, So I see a few errors with my code and fixed them. Firstly I wasn't using a SubscribeEvent annotation and Secondly, I was trying to register all of these commands as sub-commands to "celriff".

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.