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.