Sided proxies are a way of safely calling client-only code in a common context.
Balm.safeClientAccess() that can be used for the most common use cases, such as getting the local player.With sided proxies, you can:
MyCommonProxy sidedProxy = Balm.sidedProxy("com.example.mymod.MyCommonProxy","com.example.mymod.client.MyClientProxy").get();
Proxy classes must
The client proxy class must
If you have a Level available in your context, you should use level.isClientSide to determine whether you're acting on the client level or the server level.
Note that singleplayer has a server level too, since it is running an integrated server.
For cases where you need to actually know whether the mod is running on a client or a dedicated server, you can check the environment:
if (Balm.platform().physicalSide() == BalmEnvironment.CLIENT) {
// Do something that only happens on clients, but not on dedicated servers
}
Balm also provides other proxy types: