Jump to content

Need direction regarding program structure.


Recommended Posts

Hi so I'm just learning forge now and am kind of confused about the whole client vs server side topic that I read about on forge: ForgeDocs. I don't understand how I'm supposed to structure my project and classes so that their methods doesn't cause this server-client conflict. Is there a list of certain methods that are client side only? I'm pretty new to forge so any advice or help would be appreciated!

Edited by bigMojitos
Link to comment
Share on other sites

Basically, any class that contains a `client` package will almost always be client-side only. Everything else is either executed in common code (which means both sides), or on server only (which most people never interact with). The separation is just to make sure you understand that those in the vanilla client package do not exist on a physical server, so if you ever want to directly call code for that, you need to make sure using one of the methods described in the doc that the code only gets called then. This includes playing sounds directly (not through SoundEvent), rendering objects, player interactions with keyboard and mouse, and the Minecraft instance.

If you have trouble with a specific area, just ask another question in the modder support forum or on the discord. It's better to work through problems when you encounter them and you can't work out a solution on your own. Otherwise, you'll never actually program anything.

Link to comment
Share on other sites

37 minutes ago, bigMojitos said:

Is there a list of certain methods that are client side only?

You can check for yourself whether a method is only available on the client side, use your IDE to open the class. If the class or the method is annotated with @OnlyIn (with Dist#CLIENT) the full class or the method is client only.
As far as i know there are no server side only classes/methods.

In general:

  • Client side stuff is: Keyboard & Mouse input, Rendering of Screens and Entities
  • Server side stuff is: Block placing & Entity spawning
Link to comment
Share on other sites

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.

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.

  • Create New...

Important Information

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