Перейти к содержимому
Mineforgian

Pause Day Cycle

Pause the in-game day if nobody's online or when all players are AFK. Fixes local difficulty on small SMP servers.

Загрузки
14K
Подписчики
23
Обновлён
30 марта 2025 г.
Лицензия
MIT

Опубликован 11 июля 2023 г.

Pause Day Cycle

To enable AFK detection feature, Detect AFK Players must be installed.

When nobody's 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. That's not a concern 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 run.

See it in action

Day pauses while player is AFK

Time pauses while player is AFK. Player sitting done with AFK Sit.

Why another one of these?

There are already a few mods and data packs that do the same thing as this one, but none of them did quite what I need:

  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 so that the pause/unpause doesn't break.

Even with the introduction of the server property pause-when-empty-seconds, the issue of AFK players increasing game time is not solved, and spawn chunks will not be ticked while paused, which you may or may not want.

Details

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!

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

Ченджлог

1.1.1+modРелиз1.21.6, 1.21.7, 1.21.8 · 30 марта 2025 г.

Updated to include support for 1.21.0

1.1.1Релиз1.21.6, 1.21.7, 1.21.8 · 17 июня 2024 г.

Updated to include support for 1.21.0

1.1Релиз1.20.2, 1.20.3, 1.20.4 · 28 февраля 2024 г.

This is a very small update that doesn't bring any new features, but does address two minor (theoretical) bugs that never (to the best of my knowledge) caused a problem.

  • #is_paused is now set to 0 when the pack is first installed, before the time gets paused for the first time. This means that you can now 100% rely on #is_paused (scoreboard pause_day_cycle.dummy) to always have a value of 0 or 1.
  • The pack now doesn't rely on its own function tags to implement its functionality. This prevents a subtle bug where a datapack that uses the pause/resume function tags could be placed before Pause Day Cycle in the load order, so when its functions would be called the gamerules wouldn't have been set yet.

It also adds support for the supported_formats mcmeta property, so now it's marked as supporting game versions back to 1.13. I haven't tested on 1.13, but this only uses simple commands, so I'm pretty sure it works. Let me know if it doesn't!

(and it also adds a pack.png, whoops!)

1.0.0Релиз1.20.2, 1.20.3, 1.20.4 · 2 августа 2023 г.

First release!

Комментарии

Загружаем…