Darkhax @darkhax.dev · Feb 16

Here is an example with all the suggestions applied. The if condition will fail on a dedicated server, leaving that branch of the code untouched. Feel free to ask if you have any questions about it.

2 likes 2 replies

?

Replies

Slimeist · Feb 16

Was using linear mode, so my above reply turns out to be redundant. Anyways, couldn't this still lead to illegal imports on the server? Generally I'd put the if-protected code in a separate client-only class, then make a construction like this gist: gist.github.com/techno-sam/4...

Darkhax · Feb 16

Also a bonus tip, Forge will mark any class, field, or method with an annotation if it only exists on the client. You can reference these to know when it is necessary to check the physical side before using the code.