Jump to content

Confused about the combined single/smp code


happyPenguin

Recommended Posts

Hi Im just wondering how do I make my code for the server side as I'm tiny bit confused how the new forge universal works :P

 

Ive decompiled my minecraft single/server using forge and when it gets to the decompiling of server says skipping this is normal I'm just wondering is this normal if I want to make an smp mod?

 

Also when i recompile my mod and add it to servers I get this error

"Caused by: java.lang.ClassNotFoundException: bbz" which it can't find the TileEntitySpecialRender as this file is on the client just wondering do i need to do something to stop certain class files running on the server?

Link to comment
Share on other sites

Look into the forge proxy system, but the major rule is, classes that address server side need to go in Common package and can NOT reference classes from the client package. Packages in the client package are client side only and can reference classes from both packages.

There are 2 threads that run through the mod, client and server, server needs to stay contained in the common package, and client can go wherever, but should not modify the server directly.

 

There is a proxy system in place that allows you to call a class in the common package, that is extended in the client package, and depending on if the thread is server or client, that is the class that it will use. This is the heart of combining the two.

Link to comment
Share on other sites

This is very simple, where you register your TESR, do it in the ClientProxy, like so:

ClientRegistry.registerTileEntity(TileEntityCable.class, "Cable", new TileEntitySpecialCableRenderer());

and in the server proxy, just do

GameRegistry.registerTileEntity(TileEntityCable.class, "Cable");

 

hope it helps :)

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.

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.