Jump to content

Recommended Posts

Posted

I am currently working on a part of my code that requires, that the called method knows, if it was called by Server Side (Side.Server) or Client Side (Side.Client).

Is there any universal way to check which side is calling the method?

(By universal i mean u do not need an additional parameter in the method declaration,

you just call a persistent method like "FMLClientHandler.instance().getServer().getEntityWorld()" and get the result)

The TileEntitys are Going to kill us all and take over the entire (Minecraft) world!

Posted

FMLcommonHandler.instance().getEffectiveSide() returns Side.SERVER or Side.CLIENT.

 

This might be what you need.  I've never had to use it myself, and it has a disclaimer that it might be unreliable, but it might be all you can get.

 

It might be better to refactor your code so it doesn't need to tell which side it is on, or uses a source of information other than the method parameters it gets.  Might be more robust.  Hard to know without more specific info...

 

-TGG

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.