Host your Minecraft server on BisectHosting - get 25% off your first month with code MODRINTH.

Pause Day Cycle 🌞⏯️

To enable the AFK detection feature, you need to have Detect AFK Players installed.

When nobody's online on a Minecraft server, the in-game time still increases. This means you can't track the number of days played, and the local difficulty will also increase. It's not an issue for servers that have players online almost constantly, but for small/medium sized servers, this is a problem!

This is a very light-weight data pack to prevent game time from increasing when nobody's online or when every player online is tagged as afk, without pausing the server itself so that automatic farms can continue to operate.

When nobody is online or all online players are tagged as afk (see Detect AFK Players) the following gamerules will be set to false:

  • doDaylightCycle
  • doWeatherCycle

doMobSpawning is not changed because it allows automatic farms in spawn chunks or manually loaded chunks to function with nobody present.

Note: If one of the gamerules is already set to false while the time isn't paused, that gamerule will not be changed - this pack respects your options!

Why another one of these?

There are already a few mods and data packs that serve the same purpose as this one, but none of them fit my requirements:

  1. It integrates with Detect AFK Players, allowing AFK players to also not skyrocket the game time.
  2. It's easy to integrate with other datapacks you may write.

Extending it

This datapack provides two function tags: pause_day_cycle:pause and pause_day_cycle:resume. These will be called when the day cycle is paused and resumed. Below is an extremely simple example of an add-on data pack that uses these tags to log to the server when the day cycle is paused.

announce/data/pause_day_cycle/tags/functions/pause.json
{ "values": ["announce:pause"] }
announce/data/announce/functions/pause.mcfunction
say Day cycle has been paused

Project members

clo4

Owner


Technical information

License
MIT
Project ID