Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I am trying to create a mod that writes some player data into file.
I want the file to be updated only when logical server is starting up.
As I can see, @SidedProxy affects physical side only, and the file is not created on local server.
I've tried to use this way:
 

public static CommonProxy _proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) _proxy = new ClientProxy();
else _proxy = new ServerProxy();
_proxy.preInit(event);
}

...
//Other handlers
...

There ServerProxy.preInit() is:

public void init(FMLInitializationEvent e) 
	{
		System.out.println("init server!");
		ServerRegisterer.init(e);
		PlayerData.load();
	}


But now I don't know what to do with registering things: as I understand, I don't have to register anything on logical server when it is physically a client. (Because init methods of ServerProxy aren't called at all on the logical server)

So, what should I do?
I would be happy if there is a way of programming my mod, with only logical server-client separation.

 

  • Author
18 minutes ago, diesieben07 said:

What kind of data are you trying to store? Usually writing your own files is unnecessarily complicated most of the time.

Thank you for your reply!
Multiplayer class system. I have to save some player lvls somewhere...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.