Jump to content

Is their ever a use for a Server Proxy?


Shadyshackle

Recommended Posts

So I'm a bit new to this modding thing and after looking as Psi's source code, I had a thought. Psi only uses a common proxy and the subclass client proxy. This is different from most tutorials on the subject where you have both a client proxy subclass and a server proxy subclass. From my understanding, there's two instances where a mod could be run: on a server(which only has server code) and a Combined client(which has both client and server code). Therefore wouldn't you just need a common proxy when the mod is being run a server and a client proxy that simply overrides the common proxy to add things like gui implementation etc?

Where would you ever have code that would be run on the server proxy but not on the combined client, as the combined client has all the code of the server and more?

Link to comment
Share on other sites

Hi

 

You're right, you almost never need the server proxy.  The only time I've ever used it was when I needed to get the path to the save game files.  This is different on the dedicated server than on the combined client.

 

Some folks don't even like the common proxy.  Their Client-only code goes in the client proxy, the server proxy has nothing in it, and all the common code gets called directly from the mod class preInit(), init() etc.  Personally I think that's a matter of taste, and it really doesn't matter which style you choose.

 

-TGG

 

Link to comment
Share on other sites

Some folks don't even like the common proxy.  Their Client-only code goes in the client proxy, the server proxy has nothing in it, and all the common code gets called directly from the mod class preInit(), init() etc.  Personally I think that's a matter of taste, and it really doesn't matter which style you choose.

 

The only reason I don't like the preInit methods getting passed off to the proxy is that often times they're passed on (again!) to another class and when something goes wrong, it's a huge pain for us here to help debug because we have to ask "for your main class" only to then ask for the "proxy classes" and again for the "ModBlocks" and/or "ModItems" class.

 

I grumble about the ModBlocks class (such an awful name for it*) but it's not wholly bad.  What's bad is when people just pipe the FML events all over the place making it difficult to track the execution of potentially faulty code.  If I wanted to track the execution of faulty code and find the error and have it be intentionally difficult, I'd go here.

 

*I literally cringed when I saw one noob comment to another, "Hey we use the same class name!" No shit, you both watched the same tutorial. Get over yourselves.  At least replace "mod" with the name of your mod, "ArtifactsBlocks" "HungerOverhaulBlocks" "SuperChestsBlocks." Why? In case anyone ever plans to integrate with your mod and wants to reference your class without needing a fully qualified name because there's now TWO ModBlocks classes.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.



×
×
  • Create New...

Important Information

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