Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Confusion as to how often I need to specify a "side" in code
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
MrChoke

Confusion as to how often I need to specify a "side" in code

By MrChoke, October 26, 2018 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

MrChoke    2

MrChoke

MrChoke    2

  • Stone Miner
  • MrChoke
  • Members
  • 2
  • 79 posts
Posted October 26, 2018

I get the concept of sides, a server thread (or separate JVM if dedicated) versus a client thread.  What confuses me is when should we specify a side in our code?  I know if its rendering stuff it should be client only.  But how about other things, like entity movement, AI, process mouse clicks, etc??  Is there someplace I can check or read up on to help with this?  I fear I am not specifying the side enough (I barely have it at all) and does that mean I have the client loading and/or doing too much stuff that it doesn't need to.

 

 

  • Quote

Share this post


Link to post
Share on other sites

V0idWa1k3r    386

V0idWa1k3r

V0idWa1k3r    386

  • World Shaper
  • V0idWa1k3r
  • Members
  • 386
  • 1773 posts
Posted October 26, 2018
22 minutes ago, MrChoke said:

entity movement

Depends. Players move on the client and just send the server their new position.

 

22 minutes ago, MrChoke said:

AI

Entirely server sided.

 

22 minutes ago, MrChoke said:

mouse clicks

How would a server even handle mouse clicks if it may not even have a mouse? This is entirely client-side.

 

In general everything rendering or input related is client side only, and pretty much everything else is either common or server sided. Note that when I say server sided I mean the logical server, not the physical server.

 

Every time you need to do something think about it. Could a dedicated server perform it? It has no controlling player, no mouse input, no keyboard input and may not even have any display at all. If it can't - then the thing you are trying to do is client based. Otherwise the server is likely the entity that needs to do it.

 

22 minutes ago, MrChoke said:

does that mean I have the client loading and/or doing too much stuff that it doesn't need to.

In general the client doesn't do much at all anyway, it mostly displays stuff. Most logic runs on the server and if you have any custom logic you should run it on a server aswell.

 

22 minutes ago, MrChoke said:

I am not specifying the side enough (I barely have it at all)

Define "not specifying the side". 

  • Quote

Share this post


Link to post
Share on other sites

MrChoke    2

MrChoke

MrChoke    2

  • Stone Miner
  • MrChoke
  • Members
  • 2
  • 79 posts
Posted October 27, 2018

By sides, I mean specifying a side, with world.isRemote() or @Side.

 

I guess I will just follow the common sense approach when I add sides.  Right now I am running in any integrated server sop I know my code is going need work when I move to dedicated.

 

  • Quote

Share this post


Link to post
Share on other sites

V0idWa1k3r    386

V0idWa1k3r

V0idWa1k3r    386

  • World Shaper
  • V0idWa1k3r
  • Members
  • 386
  • 1773 posts
Posted October 27, 2018
3 hours ago, MrChoke said:

specifying a side, with world.isRemote() or @Side.

These are completely different things. World.isRemote checks whether you are on a logical client or not. @SideOnly removes the method completely from the class on the physical side opposite to the one specified.

  • Quote

Share this post


Link to post
Share on other sites

Cadiboo    277

Cadiboo

Cadiboo    277

  • Reality Controller
  • Cadiboo
  • Members
  • 277
  • 3303 posts
Posted October 28, 2018

https://mcforge.readthedocs.io/en/latest/concepts/sides/

Physical Side - Client software application or Server software application

Logical Side - Where logic like keystrokes (client) and mob spawning (server) is done. It can be either Server Thread or Client Thread (the Integrated (Physical) Client has both a server and client thread so you can play single player. The Physical Server does not have a client thread.)

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • DaemonUmbra
      Can't see anything on minecraft menu screen except for the bottom left corner

      By DaemonUmbra · Posted 14 minutes ago

      Please don't Necro old threads, if you have an issue make your own.
    • DaemonUmbra
      Forge having problem loading mods

      By DaemonUmbra · Posted 14 minutes ago

      You changed "Game Directory" to your mods folder. The Game Directory is supposed to be the folder that contains the mods folder, .minecraft by default
    • Casual
      1.12.2 crash on game start

      By Casual · Posted 18 minutes ago

      Ok to add on, had to do manual library install due to failed library install thing, also there is never another window It just closes the launcher window and then reopens it with the error.
    • Cosmic_Cookie
      Can't see anything on minecraft menu screen except for the bottom left corner

      By Cosmic_Cookie · Posted 27 minutes ago

      Hey, I have the same problem except my screen is black instead of white and this doesn't work. I know it's years later but maybe someone can help.
    • Cosmic_Cookie
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By Cosmic_Cookie · Posted 40 minutes ago

      Nvm wrong topic
  • Topics

    • florgonn
      4
      Can't see anything on minecraft menu screen except for the bottom left corner

      By florgonn
      Started July 30, 2014

    • SilviaX_92
      3
      Forge having problem loading mods

      By SilviaX_92
      Started 3 hours ago

    • Casual
      1
      1.12.2 crash on game start

      By Casual
      Started 43 minutes ago

    • PulseBeat_02
      14
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By PulseBeat_02
      Started December 13, 2018

    • GeokitFX
      1
      Minecraft Custom mod pack crashing i need help

      By GeokitFX
      Started 1 hour ago

  • Who's Online (See full list)

    • Casual
    • Vorquel
    • JMAS
    • Epicmoofish
    • creepaaa
    • DaemonUmbra
    • yuusha
    • Darren Hayden
    • AtlasTheFirst
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Confusion as to how often I need to specify a "side" in code
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community