동원 부 Posted June 14, 2023 Posted June 14, 2023 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 Quote
MFMods Posted June 19, 2023 Posted June 19, 2023 (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 June 19, 2023 by MFMods underlined two things Quote
Recommended Posts
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.