暂停日夜循环
要启用挂机检测功能,必须安装 Detect AFK Players。
当没有人在线 Minecraft 服务器时,游戏内的时间仍然会增加。这意味着你无法追踪已玩的天数,本地难度也会随之增加。对于几乎一直有玩家在线的服务器来说这不是问题,但对于中小型服务器而言,这是一个问题。
这是一个非常轻量级的数据包,用于在无人在线或所有在线玩家都被标记为 afk 时防止游戏时间增加,无需暂停服务器本身,以便自动农场可以继续运行。
查看实际效果

玩家在挂机时时间暂停。玩家使用 AFK Sit 坐着挂机。
为什么是又一个这样的模组?
已经有一些模组和数据包实现了相同的功能,但都没有完全满足我的需求:
- 它与 Detect AFK Players 集成,允许挂机玩家也不会导致游戏时间飙升。
- 它易于与其他数据包集成,确保暂停/恢复不会出错。
即使引入了服务器属性 pause-when-empty-seconds,挂机玩家导致游戏时间增加的问题仍未解决,并且在暂停期间出生点区块不会被刻(ticked),这可能符合也可能不符合你的需求。
详情
当没有玩家在线或所有在线玩家都被标记为 afk(参见 Detect AFK Players)时,以下游戏规则将被设置为 false:
doDaylightCycle
doWeatherCycle
doMobSpawning 不会被更改,因为它允许在没有人在场的情况下,出生点区块或手动加载区块中的自动农场正常运行。
注意: 如果某个游戏规则在时间未暂停时已经设置为 false,则该规则将不会被更改——此数据包尊重你的设置!
扩展功能
此数据包提供了两个函数标签:pause_day_cycle:pause 和 pause_day_cycle:resume。这些将在日夜循环暂停和恢复时被调用。下面是一个使用这些标签向服务器日志记录日夜循环暂停状态的极简附加数据包的示例。
announce/data/pause_day_cycle/tags/functions/pause.json
{ "values": ["announce:pause"] }
announce/data/announce/functions/pause.mcfunction
say Day cycle has been paused
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

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:
- It integrates with Detect AFK Players, allowing AFK players to also not skyrocket the game time.
- 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
评论 0
登录后参与评分
还没有评论,来抢沙发吧