Jump to content

Recommended Posts

Posted

I did know forge mod only run in client.

but i have come to know forge mod have two side (client side, server side with isRemote)

I want to know forge networking perfectly, so I have found information in forge documentation

but it's too hard for me 

logical client, physical client, logical server, physical server blah blah...

 

I hope someone explain forge networking with example imaginary example situations.

I think explain this to me will be very annoying, but I ask you politely.

Sorry, I'm not good at english

Posted (edited)

most of the time you don't need networking and can rely on the game.

if you want to create an apple item on the ground, just pop one itemstack on the server side, game will take care of the rest. if you need to hurt or heal the player, just do it on server side (isRemote == false) and don't worry.

so when do you need networking? well once, i wanted to show a toast (the notification thing in top right corner) when player achieved some milestones. here's the code:

(handled an event)
if IsRemote==false and my condition is fulfilled:
send message to current player's client instance to show the toast
increase counter by +1 and mark my piece of game save as dirty

see the code above - last line (saving data) makes sense only on server. but trying to show a toast on server? not only does it not make sense but it would crash the game because that part of the game doesn't exist on server instance.

that was a server to client message.

if a player clicks on a button in your gui window, you need to send a client to server message because windows and screens don't exist on the server.

all game logic must happen on server side. client just holds copies of some things for the purpose of drawing things.

Edited by MFMods
underlined two things

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.