? 概览
DistantTicking 是一款强大的 PaperMC 插件,旨在提升服务器性能的同时,确保您的红石装置和自动化农场在玩家远离时也能持续运行。告别挂机农场和不合时宜的区块卸载!
传统上,Minecraft 仅在玩家的 simulation-distance(模拟距离)范围内“tick”区块。这意味着当玩家移动得太远或登出时,复杂的机器和农场的运作就会停止。DistantTicking 通过追踪精确位置来智能检测并永久加载包含玩家放置的“可 tick 方块”的区块,从而解决了这一问题。
适用对象
这不适用于大型服务器。它面向的是注重沉浸感、追求最大模拟距离的小型私人高端服务器。此插件允许您降低模拟距离。
例如,在我的服务器上,模拟距离为 16 时,每位玩家需要模拟大约 1089 个区块。
使用此插件后,仅有约 60 个区块处于加载状态。
由于模拟距离的重要性不再那么突出,我们将模拟距离降低到了 10。
这意味着每位玩家减少了约 648 个区块的模拟量 同时,由于作物、熔炉、带有箱子的区块等仍然处于加载状态,就体验而言,模拟距离实际上变得无限了。
这本质上是一个隐蔽的区块加载器。
✨ 功能
- 智能区块加载: 通过追踪玩家放置方块的具体位置(如熔炉、漏斗、红石、活塞、铁轨),自动检测并强制加载区块。
- 区块休眠: 在超过预设时间且没有在线玩家时,自动使区块进入休眠状态。
- 持久 Tick: 确保您的机器、农场和红石装置全天候(24/7)持续工作,即使附近没有玩家或不在同一维度。
- 性能优化: 允许服务器管理员在
server.properties 中降低全局 simulation-distance(例如降至 4-8),以获得更好的整体 TPS 并减少服务器负载,同时由 DistantTicking 管理关键的 tick 区域。
- 可配置的 Tick 方块: 直接在
config.yml 中轻松自定义哪些方块材料会触发区块加载。
- 自我修复数据: 使用中央索引与每个区块的持久化数据容器(PDC)相结合的混合方法实现稳健的数据持久性。能够从意外删除数据文件或服务器崩溃中优雅恢复。
- 定期一致性检查: 如果方块被移除而未通过插件正确通知(例如使用世界编辑工具、服务器崩溃),则自动清理过期的强制加载条目。
- 管理命令: 提供直观的命令用于监控插件状态、列出强制加载的区块、刷新区块数据以及调试。
- 旧数据清理工具: 一个特定命令,用于移除来自以前插件版本的 PDC 中存储的旧版 tick 方块数据。
- 调试日志: 特定的调试模式,可提供详细的插件日志,而不会淹没整个服务器控制台。
⚙️ 工作原理
DistantTicking 采用混合数据存储模型:
- 区块数据 (PDC): 当玩家放置一个可配置的“可 tick 方块”时,插件会使用 Minecraft 内置的持久化数据容器(PDCs)标记该区块的数据。现在它不仅仅存储计数,而是存储该区块内每个可 tick 方块的具体 X, Y, Z 坐标。这些数据被序列化为 JSON 字符串并直接存储在区块文件中,即使主插件数据文件丢失,数据也会保留。
- 集中式索引 (
active_chunks.json): 一个轻量级的 JSON 文件维护着当前跨所有世界由插件强制加载的所有区块列表。该文件在服务器启动时加载,以立即启动所有相关区块的强制加载。
- 同步机制:
- 当玩家放置一个可 tick 方块时,其所在的区块会被添加到集中式索引并强制加载 (如果是该区块中的第一个可 tick 方块)。
- 当玩家破坏(或方块被摧毁)一个可 tick 方块时,其位置会从该区块的 PDC 中移除。如果在移除后 该区块的 PDC 中不再有任何可 tick 方块,则将其从集中式索引中移除并取消强制加载。
- 定期的后台任务会验证集中式索引中的区块在其 PDC 中是否仍有对应的可 tick 方块。如果区块的 PDC 显示没有存储的方块位置,则该条目将从集中式索引中移除,确保从数据不一致中“自我修复”。
这种方法提供了精确的追踪、可靠的持久性以及高效的资源管理。
已知问题
- 如果您追踪作物,当您踩踏它们时,插件可能无法检测到它们被破坏。但是,一致性检查最终会发现这一点。
? 安装
- 下载最新的
DistantTicking-X.Y.Z.jar。
- 将
DistantTicking-X.Y.Z.jar 文件放入服务器的 plugins/ 文件夹中。
- 重启您的 PaperMC 服务器。
- 将在您的
plugins/ 目录中创建一个 DistantTicking 文件夹,其中包含 config.yml 和 active_chunks.json。
- 重要!如果您将此插件添加到现有世界,您需要运行
/dt refresh <chunk radius> <vertical-up> <vertical-down> 来为现有方块填充基于新位置跟踪的数据。我建议以精准的方式执行此操作,使用较低的区块半径和适当的垂直限制,因为扫描大量区块或大垂直范围可能会很慢。
更新后您可能需要运行 /dt cleanup,以防我更改了任何内容。
?️ 配置 (config.yml)
config.yml 文件会在首次运行时自动生成。您可以在此自定义插件的行为。
# DistantTicking Plugin Configuration
settings:
# 自动将强制加载的区块数据保存到 active_chunks.json 的时间间隔。
# 单位为分钟。(20 ticks = 1 second)
auto-save-interval-minutes: 5 # 默认值: 5
# 周期性一致性检查的时间间隔。
# 此检查用于验证标记为强制加载的区块在其 PDC(持久数据组件)中是否仍包含需要刻更新的方块。
# 单位为小时。
consistency-check-interval-hours: 6 # 默认值:6
# 启用调试模式以输出更详细的控制台日志。
# 设置为 'true' 可查看插件的详细活动(例如,各个区块的加载/卸载情况)。
# 这些日志*仅*针对 DistantTicking,不会让其他插件的调试消息淹没你的控制台。
debug-mode: false # 默认值:false
# 服务器休眠功能的设置。
# 当服务器为空时,插件可以卸载所有区块以节省资源。
hibernation:
# 设置为 true 以启用此功能。
enabled: true
# 服务器必须保持空载状态多长时间后才会卸载区块。
# 单位为分钟。
unload-delay-minutes: 60
# 当玩家加入空服务器时,每次重新加载多少个区块。
# 数值越高,重新加载速度越快,但可能导致更多的卡顿。
reload-chunks-per-batch: 5
# 每隔多少刻处理一批区块进行重新加载。20 刻 = 1 秒。
# 值为 5 表示每 5 刻重新加载一批区块。
reload-stagger-ticks: 5
# 列出当玩家放置时应使其所在区块变为“需要刻更新”并强制加载的材料。
# 确保材料名称是有效的 Minecraft Material 枚举值(插件内不区分大小写,但建议使用大写以提高清晰度)。
#
# 重要提示:即使是非实体方块(如红石粉、中继器、活塞)也会导致区块保持加载状态,
# 如果它们属于活跃的红石电路的一部分,则允许其持续运行。
#
tick-worthy-blocks:
- Blocks you want to tick
# 给服务器拥有者的建议:
# 为了获得最佳性能,请考虑将 server.properties 中的 'simulation-distance'(模拟距离)
# 降低到类似 4-8 的值。这允许 DistantTicking 为你的机器管理持续的刻更新,
# 同时显著减少服务器 CPU 在没有关键机械装置区域上的负载。
? 命令
所有命令均以 /dt(或 /distantticking)开头。
| 命令 |
描述 |
权限 |
/dt help |
显示插件的帮助信息。 |
distantticking.command.base |
/dt pdcinfo |
显示你当前区块中具有可计时特性的方块(来自 PDC)的数量。 |
distantticking.command.pdcinfo |
| /dt status | 显示 DistantTicking 插件的当前状态。 | distantticking.command.status |
| /dt list [page] | 列出插件当前强制加载的所有区块,支持分页。 | distantticking.command.list |
| /dt removehere | 从强制加载列表中移除你当前所在的区块。 | distantticking.command.removehere |
| /dt reload | 重新加载插件的 config.yml 并重启内部任务。 | distantticking.command.reload |
| /dt refresh <半径> <垂直向上> <垂直向下> | 扫描由 <radius> 参数定义的方块区域,并通过垂直向上和向下的参数进行限制,以防止检测到不需要的地图结构(例如矿洞)。 | distantticking.command.refresh |
| /dt cleanup | 清理在追踪功能按区块区分之前使用的旧 PDC 键值。 | distantticking.command.cleanup |
| /dt check | 执行一致性检查并告知运行所花费的时间。此命令更适合作为性能分析工具,而非日常使用,因为这些检查会自动运行。 | distantticking.command.cleanup |
? Overview
DistantTicking is a powerful PaperMC plugin designed to enhance your server's performance while keeping your essential redstone contraptions and automated farms continuously active, regardless of player proximity. Say goodbye to AFK farms and chunks unloading at inconvenient times!
Traditionally, Minecraft only "ticks" chunks within a player's simulation-distance. This means complex machines and farms stop working when players move too far away or log off. DistantTicking solves this by intelligently detecting and permanently loading chunks that contain player-placed "tick-worthy" blocks by tracking their exact locations.
Who is this for?
This is not for large scale servers. This is for private, smaller, high end serveres which focus on immersion and aim to have the maximum simulation distance. This plugin can allow you to reduce your simulation distance.
For example, on my server with a sim distance of 16, we would simulate about 1089 chunks per player.
With this plugin there are about 60 chunks being loaded.
Because simulation distance doesn't matter as much anymore, we lowered the sim distance to 10.
This means about 648 less chunks being simulated per player, while effectively making the simulation distance unlimited as far as experience goes, since things like crops, furnances, chunks with chests, etc. are still loaded.
It's effectively a discreet chunk loader.
✨ Features
- Intelligent Chunk Loading: Automatically detects and force-loads chunks by tracking the specific locations of player-placed blocks (e.g., Furnaces, Hoppers, Redstone, Pistons, Rails).
- Chunk Hibernating: Automatically hibernates chunks when there are no players online after a predefined time.
- Persistent Ticking: Ensures your machines, farms, and redstone contraptions keep working 24/7, even when no players are nearby or in the same dimension.
- Performance Optimization: Allows server owners to lower the global
simulation-distance in server.properties (e.g., to 4-8) for better overall TPS and reduced server load, while DistantTicking manages the critical ticking areas.
- Configurable Tick-Worthy Blocks: Easily customize which block materials trigger chunk loading directly in the
config.yml.
- Self-Healing Data: Robust persistence using a hybrid approach of a central index and per-chunk Persistent Data Containers (PDCs). Recovers gracefully from accidental data file deletions or server crashes.
- Periodic Consistency Checks: Automatically cleans up outdated force-loaded entries if blocks are removed without proper plugin notification (e.g., world editing, server crashes).
- Admin Commands: Intuitive commands for monitoring plugin status, listing force-loaded chunks, refreshing chunk data, and debugging.
- Old Data Cleanup Utility: A specific command to remove legacy tick-worthy block data stored in PDCs from previous plugin versions.
- Debug Logging: Specific debug mode to get detailed plugin logs without flooding the entire server console.
⚙️ How it Works
DistantTicking operates on a hybrid data storage model:
- Per-Chunk Data (PDC): When a player places a configurable "tick-worthy" block, the plugin marks that chunk's data using Minecraft's built-in Persistent Data Containers (PDCs). Instead of just a count, it now stores the specific X, Y, Z coordinates of each tick-worthy block within that chunk. This data is serialized to a JSON string and stored directly within the chunk's file, persisting even if the main plugin data file is lost.
- Centralized Index (
active_chunks.json): A lightweight JSON file maintains a list of all chunks that are currently force-loaded by the plugin across all worlds. This file is loaded on server startup to immediately initiate force-loading of all relevant chunks.
- Synchronization:
- When a player places a tick-worthy block, its chunk is added to the centralized index and force-loaded if it's the first tick-worthy block in that chunk.
- When a player breaks (or a block is destroyed) a tick-worthy block, its location is removed from the chunk's PDC. If, after removal, no tick-worthy blocks remain in that chunk's PDC, it's removed from the centralized index and un-force-loaded.
- A periodic background task verifies that chunks in the centralized index still have corresponding tick-worthy blocks in their PDC. If a chunk's PDC shows no stored block locations, the entry is removed from the centralized index, ensuring "self-healing" from data inconsistencies.
This approach provides precise tracking, reliable persistence, and efficient resource management.
Known Bugs
- If you track crops, it won’t detect them being broken if you jump on them. However the consistency check will eventually realise.
? Installation
- Download the latest
DistantTicking-X.Y.Z.jar.
- Place the
DistantTicking-X.Y.Z.jar file into your server's plugins/ folder.
- Restart your PaperMC server.
- A
DistantTicking folder will be created in your plugins/ directory, containing config.yml and active_chunks.json.
- IMPORTANT! If you add this to an existing world, you will want to run
/dt refresh <chunk radius> <vertical-up> <vertical-down> to populate the new location-based tracking data for existing blocks. I advise doing this surgically, with a low chunk radius and appropriate vertical limits, as scanning many chunks or large vertical ranges can be slow.
You may want to run /dt cleanup after updating, in case I've changed anything.
?️ Configuration (config.yml)
The config.yml file is automatically generated on first run. You can customize the plugin's behavior here.
# DistantTicking Plugin Configuration
settings:
# Interval for automatically saving the force-loaded chunks data to active_chunks.json.
# Measured in minutes. (20 ticks = 1 second)
auto-save-interval-minutes: 5 # Default: 5
# Interval for the periodic consistency check.
# This check verifies if chunks marked for force-loading still contain tick-worthy blocks in their PDC.
# Measured in hours.
consistency-check-interval-hours: 6 # Default: 6
# Enable debug mode for more verbose console logging.
# Set to 'true' to see detailed plugin activity (e.g., individual chunk loads/unloads).
# These logs are *only* for DistantTicking and will not flood your console with other plugin's debug messages.
debug-mode: false # Default: false
# Settings for the server hibernation feature.
# When the server is empty, the plugin can unload all chunks to save resources.
hibernation:
# Set to true to enable this feature.
enabled: true
# How long the server must be empty before chunks are unloaded.
# Measured in minutes.
unload-delay-minutes: 60
# How many chunks to reload at a time when a player joins an empty server.
# Higher values reload faster but may cause more lag.
reload-chunks-per-batch: 5
# How often (in ticks) to process a batch of chunks for reloading. 20 ticks = 1 second.
# A value of 5 means a batch is reloaded every 5 ticks.
reload-stagger-ticks: 5
# List of materials that, when placed by a player, should make their chunk tick-worthy and force-loaded.
# Ensure material names are valid Minecraft Material enums (case-insensitive in plugin, but use uppercase for clarity).
#
# IMPORTANT: Even non-BlockEntities (like Redstone Wire, Repeaters, Pistons) will cause a chunk to stay loaded,
# allowing them to function continuously if they are part of an active redstone circuit.
#
tick-worthy-blocks:
- Blocks you want to tick
# Suggestion for server owners:
# For optimal performance, consider lowering your server's 'simulation-distance' in server.properties
# to a value like 4-8. This allows DistantTicking to manage persistent ticking for your machines
# while significantly reducing the load on your server's CPU for areas without critical contraptions.
? Commands
All commands start with /dt (or /distantticking).
| Command |
Description |
Permission |
/dt help |
Displays the plugin's help message. |
distantticking.command.base |
/dt pdcinfo |
Shows the count of tick-worthy blocks (from PDC) in your current chunk. |
distantticking.command.pdcinfo |
/dt status |
Displays the current status of the DistantTicking plugin. |
distantticking.command.status |
/dt list [page] |
Lists all chunks currently force-loaded by the plugin, with pagination. |
distantticking.command.list |
/dt removehere |
Removes the chunk you are standing in from the force-load list. |
distantticking.command.removehere |
/dt reload |
Reloads the plugin's config.yml and restarts internal tasks. |
distantticking.command.reload |
/dt refresh <radius> <vertical-up> <vertical-down> |
Scans a square area of chunks defined by the <radius> argument, and clamped by the vertical up and down args to prevent detecting unwanted map structures (eg mineshafts.) |
distantticking.command.refresh |
/dt cleanup |
Cleans up old PDC keys used before tracking was block specific. |
distantticking.command.cleanup |
/dt check |
Performs a consistency check and tells you how long it took to run. This is meant to be more of a profiling tool than actually used, since these checks run automatically. |
distantticking.command.cleanup |
评论 0
登录后参与评分
还没有评论,来抢沙发吧