Stop Minecraft Ticks when zero players online
As we all know , a Minecraft Server keeps the spawn chunks loaded all the time (if you don't know, read these questions: one two). So ticks keep passing by. I'm keen of the fact that in these ticks not everything is processed like there is a player nearby that is responsible for the loaded chunks.
Normally these questions go in the direction "I want something loaded and processed" but I'm looking for the opposite. In normal vanilla Minecraft there is no calendar, there is only day and night. Because of this the impact of ticking is not quite as relevant. But for mods like TerraFirmaCraft with calendar and stuff, this is a bit of a problem because you will starve while you're, for example, at work.
I found some scripts in python that act like some kind of proxy. Listening to the default Minecraft port 25565 and if they get any connection starting up a real server in the background passing the traffic over. If all players disconnect, after some time, the server gets shut down and the whole process starts over again.
As I'm using a hosted solution I can only run *.jars, so python and shell scripts are out for this. Is there any solution using Forge or a Java Wrapper to accomplish this type of behavior?
Manually starting and stopping the server all the time is no solution in this case.
Solution 1:
In the spawn chunks, use a command block with the command:
/testfor @a
With a comparator coming out of it connected to a block, place redstone dust on top of the block leading to a command block with the command:
/gamerule randomTickSpeed (speed, default is 3)
and a torch going out of the block with redstone dust connecting it to a command block with the command:
/gamerule randomTickSpeed 0
Solution 2:
Spawn chunks, as far as I know, do not stay active as long as no players are currently in that dimension. If all players are in the Nether or End, the overworld spawn chunks cease to tick. If no players are online, it's the same result. The day cycle continues as normal, as does anything else that doesn't have to do with physical chunks. While I don't know about Forge (I use command blocks for everything), all chunks should stop ticking when nobody is online. I do have one solution to try, though. If the modification you're using uses the day cycle to run it's calender, you can stop the day cycle with ' /gamerule doDaylightCycle false ', or use some kind of plugin to do that for you. I hope that I helped in some way. Have good luck.
Solution 3:
Ifound this thing for you. Maybe you can do something with it, perhaps you will need some script or so, but that is up to you. http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2421222-tickratechanger-change-the-speed-that-your-game