http://mcforge.readthedocs.io/en/latest/concepts/sides/
When in SP you are connected to integrated local server (basically multiplayer with one player).
In SP you have access to your own MinecraftServer since it is the one you are running in background, thus this:
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
Will not be null (it will be your integrated server).
Now when you connect to other server (LAN or dedic) you don't have server thread with you (thus your getMinecraftServerInstance() will be null). Read 1st link if you didn't catch the fact that there are 2 threads.
Now - guts tell me that MinecraftServer#getMaxPlayerIdleMinutes() is for server-side only.
This means you can't access it from client thread. To make it clear:
- If you are on MP (outside server) you don't have server thread, thus you cannot access MinecraftServer#getMaxPlayerIdleMinutes().
- While you are on SP - you DO have your integrated server thread, BUT - while it is possible to access this value (you will be doing cross-thread calls), you generally shouldn't do so! Why? Exchanging data between threads directly is kind of bad design, because, as you should understand now - it is NOT universal (works only on SP, not on MP).
How to deal with it? Unless "idleMinutes" are somehow sent to client internally (which I doubt) - only server thread can use this field, that is why you will need packets to share it with client.
1. Setup SimpleNetworkWrapper
2. Make packet which will send integer (only)
3. Make handler which will literally set some static field to integer received.
4. The packet can be sent from PlayerEvent.PlayerLoggedInEvent.
5. Use that integer in all of your rendering things.
Links:
SNW: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html
Example: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with
Thread safety: http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html
Aside from that: (some recent quote that might be useful):
Important thing are those so-called "scopes" - you shouldn't write code for one scope, but for all, and if you need such code, you use proxies. Note that it is not directly connected with current case.