Chrono API
Chrono API 是一款用于控制时间流逝的 Minecraft Forge 模组。
该模组最初从 Deus Chrono-Machina 中提取,将可复用的时间控制引擎与原模组的玩法内容分离开来。其他模组和 Palladium 能力包可以调用其时间操控功能,而无需安装 Deus Chrono-Machina 本身。
本模组与 Deus Chrono-Machina v6.x 不兼容(特此提醒)
它是 Deus Chrono-Machina v7.x(尚未发布)的必需依赖项
功能特性
- 将受支持模拟的时间速度降低或加速至
0.0001 到 100 TPS。正常速度为 20 TPS。
- 全局暂停或恢复时间,或在跟随所有者的区域内进行暂停/恢复。
- 创建命名时间场,目标可以是实体、方块、几何区域、区块或已加载的维度。
- 通过 UUID 白名单豁免特定实体,使其不受时间暂停和刻率变化的影响。
- 回放可用的记录历史,包括实体、方块、物品、投射物、物品栏以及受支持的玩家状态。
- 通过 Java API 或可选的 Palladium 能力和条件集成时间控制功能。
- 通过自定义免疫、回溯保护、玩家状态和客户端展示钩子扩展引擎。
- 使用
/chrono 命令进行玩法集成、测试和服务器管理。
回溯功能恢复的是记录的状态,而非逆转服务器执行过的每一个操作。覆盖范围取决于已加载的历史数据、支持的状态类型以及其他模组使用的集成路径。
Palladium 兼容性
安装 Palladium 后,能力包可以通过 chrono_api 命名空间下的 JSON 能力和条件来访问 Chrono API。
Palladium 是可选的。核心模组、命令和 Java API 在没有 Palladium 的情况下也能正常工作。
Palladium 兼容性由 Ender2460 贡献。
能力 (Abilities)
| 能力 ID |
描述 |
chrono_api:stop_time |
在玩家周围暂停时间,可配置半径和 UUID 豁免列表。 |
chrono_api:tick_rate |
使用 rate、radius 和 whitelist 设置跟随玩家的区域的刻率。 |
chrono_api:dynamic_tick_rate |
从受支持的动态值源计算刻率。 |
chrono_api:rewind |
使用配置的 seconds 值请求本地回溯。 |
chrono_api:dynamic_rewind |
从受支持的动态值源计算回溯持续时间。 |
chrono_api:chrono_immunity |
在启用期间将能力持有者加入白名单,并在能力结束时移除该白名单条目。 |
chrono_api:whitelist |
通过 property_type 和可选的能力结束清理功能暴露 UUID 列表白名单操作。详见下方的实现说明。 |
暂停、刻率和回溯能力当前通过服务器端玩家持有者运行。免疫和白名单能力接受活体实体持有者。
配置
rate: 固定速率能力使用的刻率,或作为动态速率计算的运算数。
radius: 暂停和速率控制的显式跟随所有者半径。使用 1–128 个方块。默认值 -1 表示忽略半径覆盖;它不选择全局时间控制。
seconds: 回溯持续时间,范围为 0.1 到 100 秒。
whitelist: 有效的实体 UUID 字符串数组。
property_type: 专用白名单能力的 add(添加)或 remove(移除)。
remove_last_tick: 当对 add 配置启用时,在能力结束时移除配置的 UUID 条目。
当前实现说明: 专用的 chrono_api:whitelist 能力的 add 分支目前会透传到 remove。在修正之前,请使用 /chrono whitelist add、chrono_immunity 或暂停/速率能力的白名单属性来添加豁免。
动态值源
两种动态能力均支持:
dynamic_property |
值源 |
scoreboard |
玩家在名为 property 的目标中的得分。 |
energy_bar |
持有者的能量条中名为 property 的当前值。 |
palladium_property |
当前能力实例上的数值属性,由 property 选择。 |
xp_level |
玩家的经验等级。 |
xp |
玩家向下一级经验值的进度,而非总经验点数。 |
multiplier 字段用于选择计算方法:
add: 源值 + 配置的 rate 或 seconds
multiply: 源值 × 配置的 rate 或 seconds
divide: 源值 ÷ 配置的 rate 或 seconds
避免除数为零。仅当计算出的持续时间在 0.1–100 秒范围内时,动态回溯才会启动。
能力示例
以下是 Palladium 能力定义片段,用于 Power 的 abilities 部分。请根据需要配置激活条件和冷却时间。
暂停一个半径为 32 方块的区域:
{
"type": "chrono_api:stop_time",
"radius": 32.0,
"whitelist": []
}
启用时,为持有者提供基于白名单的时间豁免:
{
"type": "chrono_api:chrono_immunity"
}
将刻率计算为玩家经验等级乘以 2:
{
"type": "chrono_api:dynamic_tick_rate",
"dynamic_property": "xp_level",
"multiplier": "multiply",
"rate": 2.0,
"radius": 32.0,
"whitelist": []
}
请求五秒的本地回溯:
{
"type": "chrono_api:rewind",
"seconds": 5.0
}
条件
| 条件 ID |
描述 |
chrono_api:is_paused |
检查当前实体是否受时间暂停影响。 |
chrono_api:is_rewound |
检查当前实体是否由活跃的回溯播放控制。 |
chrono_api:is_rewinding |
检查是否有任何回溯处于活动状态;这不是针对单个实体的检查。 |
chrono_api:is_whitelisted |
使用 side_type 根据客户端、服务器或两者白名单视图检查配置的 UUID。 |
chrono_api:tick_rate |
检查共享服务器刻率值是否在 min_ticks 和 max_ticks 之间(包含边界)。 |
chrono_api:is_chrono_immune |
检查当前实体的有效时间调度器豁免状态,包括白名单和政策性豁免。 |
对于 is_whitelisted,请明确提供一个 UUID:当前实现仅评估列出的第一个 UUID,空数组不会选择当前玩家。
条件定义示例:
{
"type": "chrono_api:is_chrono_immune"
}
{
"type": "chrono_api:tick_rate",
"min_ticks": 0.0001,
"max_ticks": 10.0
}
基于白名单的豁免不应被视为免受任何恢复操作的保证。精确的回溯排除应放在字段排除项或回溯集成中。
命令
所有命令都需要权限级别 2。命令名称区分大小写。
基本时间控制
/chrono settickrate <TPS> [radius <blocks>]
/chrono pausetime <true|false> [radius <blocks>]
/chrono clearfield
玩家发出的暂停和速率命令控制一个跟随字段,默认半径为 40 格。可选半径接受 1–128 格。
控制台和命令方块源控制共享的全局字段,不能使用半径后缀。
回溯
/chrono rewindTime <seconds>
/chrono rewindTime <seconds> at <x> <y> <z>
/chrono rewindTime <seconds> near <entity>
/chrono rewindTime <seconds> in <dimension> at <x> <y> <z>
持续时间接受从 0.1 到 100 秒的小数值。普通回溯使用 32 格半径区域内的可用历史数据。near 形式选择实体周围的区域,而不是仅针对实体的回溯。
白名单与诊断
/chrono whitelist add <targets>
/chrono whitelist remove <targets>
/chrono whitelist clear
/chrono whitelist list
/chrono diagnostics
/chrono diagnostics entity <target>
命名时间字段
/chrono field create <id> <scope>
/chrono field rate <id> <TPS>
/chrono field pause <id> <true|false>
/chrono field step <id> <ticks>
/chrono field preview <id> rewind <seconds>
/chrono field rewind <id> <seconds>
/chrono field stop <id>
/chrono field clear <id>
/chrono field remove <id>
支持的范围包括实体选择器、确切 UUID、方块、方块区域、球体、立方体、圆柱体、跟随实体、区块、维度以及全局选择。
示例:
/chrono field create arena sphere 0 64 0 32
/chrono field rate arena 5
/chrono field pause arena true
/chrono field step arena 1
/chrono field pause arena false
/chrono field remove arena
clear 重置命名字段的控制,但保留其选择范围。remove 删除该字段。
Java API
主要入口点是 chrono_api.api.ChronoTime。在逻辑服务端线程上运行时间控制变更。
import chrono_api.api.ChronoTime;
import net.minecraft.server.level.ServerPlayer;
public void slowTime(ServerPlayer owner) {
ChronoTime.setTickrate(8.0F, owner, 32.0D);
}
public void stopTime(ServerPlayer owner) {
ChronoTime.pause(true, owner, 32.0D);
}
public void restoreTime(ServerPlayer owner) {
ChronoTime.clear(owner);
}
public boolean rewindTime(ServerPlayer player) {
return ChronoTime.rewind(
player.serverLevel(),
player.position(),
5.0D,
player
);
}
传递实体将创建或更新一个所有者跟随字段。传递 null 则控制共享的全局字段:
ChronoTime.setTickrate(8.0F, null);
ChronoTime.pause(true, null);
// 恢复全局时间并还原为 20 TPS。
ChronoTime.clear(null);
状态查询接口包括:
ChronoTime.isPaused(entity);
ChronoTime.tickrate(entity);
ChronoTime.isRewinding(entity);
ChronoTime.isRewinding();
对于命名选择和高级操作,请使用 ChronoTime.createField(...)、TimeScope 和 TimeControl。
始终检查回溯请求的结果。当没有可用的历史数据或已有其他回溯活动时,它可能会失败。
要求
- Minecraft
1.20.1
- Minecraft Forge
47.x
- Java
17
- 仅在使用了可选的 power-pack 集成时才需要 Palladium
请在服务器和连接的客户端上都安装 Chrono API。
Chrono API
Chrono API is a Minecraft Forge mod for controlling the flow of time.
Originally extracted from Deus Chrono-Machina, it separates the reusable time-control engine from the original mod’s gameplay content. Other mods and Palladium power packs can use its time-manipulation features without requiring Deus Chrono-Machina itself.
THIS MOD IS NOT COMPATIBLE WITH Deus Chrono-Machina v6.x (just remind)
AND IT'S A REQUIRED DEPENDENCY FOR Deus Chrono-Machina v7.x (not released yet)
Features
- Slow down or accelerate supported simulation from
0.0001 to 100 TPS. Normal speed is 20 TPS.
- Pause and resume time globally or within an owner-following field.
- Create named time fields targeting entities, blocks, geometric areas, chunks, or loaded dimensions.
- Exempt entities from time pause and tick-rate changes through UUID whitelists.
- Rewind available recorded history, including entities, blocks, items, projectiles, inventories, and supported player state.
- Integrate time control through a Java API or optional Palladium abilities and conditions.
- Extend the engine through custom immunity, rewind-protection, player-state, and client-presentation hooks.
- Use
/chrono commands for gameplay integrations, testing, and server administration.
Rewind restores recorded state rather than reversing every operation performed by the server. Coverage depends on loaded history, supported state, and the integration paths used by other mods.
Palladium Compatibility
With Palladium installed, power packs can access Chrono API through JSON abilities and conditions in the chrono_api namespace.
Palladium is optional. The core mod, commands, and Java API work without it.
Palladium compatibility was contributed by Ender2460.
Abilities
| Ability ID |
Description |
chrono_api:stop_time |
Pause time around the player, with a configurable radius and UUID exemptions. |
chrono_api:tick_rate |
Set a player-following field’s tick rate using rate, radius, and whitelist. |
chrono_api:dynamic_tick_rate |
Calculate the tick rate from a supported dynamic value source. |
chrono_api:rewind |
Request a local rewind using the configured seconds value. |
chrono_api:dynamic_rewind |
Calculate the rewind duration from a supported dynamic value source. |
chrono_api:chrono_immunity |
Whitelist the ability holder while enabled and remove that whitelist entry when the ability ends. |
chrono_api:whitelist |
Expose UUID-list whitelist operations through property_type and optional end-of-ability cleanup. See the implementation note below. |
The pause, tick-rate, and rewind abilities currently operate through server-side player holders. The immunity and whitelist abilities accept living-entity holders.
Configuration
rate: Tick rate used by fixed-rate abilities or as the calculation operand for dynamic rate control.
radius: Explicit owner-following radius for pause and rate control. Use 1–128 blocks. The default -1 omits the radius override; it does not select global time control.
seconds: Rewind duration from 0.1 to 100 seconds.
whitelist: An array of valid entity UUID strings.
property_type: add or remove for the dedicated whitelist ability.
remove_last_tick: When enabled for an add configuration, remove the configured UUID entries when the ability ends.
Current implementation note: The dedicated chrono_api:whitelist ability’s add branch currently falls through to remove. Until corrected, use /chrono whitelist add, chrono_immunity, or the whitelist property of the pause/rate abilities when adding exemptions.
Dynamic Value Sources
Both dynamic abilities support:
dynamic_property |
Value source |
scoreboard |
The player’s score in the objective named by property. |
energy_bar |
The current value of the holder’s energy bar named by property. |
palladium_property |
A numeric property on the current ability instance, selected by property. |
xp_level |
The player’s experience level. |
xp |
The player’s progress toward the next experience level, not total XP points. |
The multiplier field selects the calculation:
add: source value + configured rate or seconds
multiply: source value × configured rate or seconds
divide: source value ÷ configured rate or seconds
Avoid a zero divisor. Dynamic rewind starts only when the calculated duration is within 0.1–100 seconds.
Ability Examples
These are ability-definition fragments for a Palladium power’s abilities section. Configure activation conditions and cooldowns through Palladium as appropriate.
Pause a 32-block-radius field:
{
"type": "chrono_api:stop_time",
"radius": 32.0,
"whitelist": []
}
Give the holder a whitelist-based time exemption while enabled:
{
"type": "chrono_api:chrono_immunity"
}
Calculate the tick rate as the player’s XP level multiplied by 2:
{
"type": "chrono_api:dynamic_tick_rate",
"dynamic_property": "xp_level",
"multiplier": "multiply",
"rate": 2.0,
"radius": 32.0,
"whitelist": []
}
Request a five-second local rewind:
{
"type": "chrono_api:rewind",
"seconds": 5.0
}
Conditions
| Condition ID |
Description |
chrono_api:is_paused |
Check whether the current entity is affected by time pause. |
chrono_api:is_rewound |
Check whether the current entity is controlled by active rewind playback. |
chrono_api:is_rewinding |
Check whether any rewind is active; this is not a per-entity check. |
chrono_api:is_whitelisted |
Check a configured UUID against client, server, or both whitelist views using side_type. |
chrono_api:tick_rate |
Check whether the shared server tick-rate value is between min_ticks and max_ticks, inclusive. |
chrono_api:is_chrono_immune |
Check the current entity’s effective time-scheduler immunity, including whitelist and policy-based exemptions. |
For is_whitelisted, supply one UUID explicitly: the current implementation evaluates only the first listed UUID, and an empty array does not select the current player.
Condition-definition examples:
{
"type": "chrono_api:is_chrono_immune"
}
{
"type": "chrono_api:tick_rate",
"min_ticks": 0.0001,
"max_ticks": 10.0
}
Whitelist-based immunity should not be treated as a guarantee of protection from every restoration operation. Precise rewind exclusions belong in field exclusions or rewind integration.
Commands
All commands require permission level 2. Command names are case-sensitive.
Basic Time Control
/chrono settickrate <TPS> [radius <blocks>]
/chrono pausetime <true|false> [radius <blocks>]
/chrono clearfield
Player-issued pause and rate commands control a following field with a default radius of 40 blocks. The optional radius accepts 1–128 blocks.
Console and command-block sources control the shared global field and cannot use the radius suffix.
Rewind
/chrono rewindTime <seconds>
/chrono rewindTime <seconds> at <x> <y> <z>
/chrono rewindTime <seconds> near <entity>
/chrono rewindTime <seconds> in <dimension> at <x> <y> <z>
Durations accept decimal values from 0.1 to 100 seconds. Ordinary rewind uses available history within a 32-block-radius area. The near form selects an area around the entity, not an entity-only rewind.
Whitelist and Diagnostics
/chrono whitelist add <targets>
/chrono whitelist remove <targets>
/chrono whitelist clear
/chrono whitelist list
/chrono diagnostics
/chrono diagnostics entity <target>
Named Time Fields
/chrono field create <id> <scope>
/chrono field rate <id> <TPS>
/chrono field pause <id> <true|false>
/chrono field step <id> <ticks>
/chrono field preview <id> rewind <seconds>
/chrono field rewind <id> <seconds>
/chrono field stop <id>
/chrono field clear <id>
/chrono field remove <id>
Supported scopes include entity selectors, exact UUIDs, blocks, block regions, spheres, boxes, cylinders, following entities, chunks, dimensions, and global selection.
Example:
/chrono field create arena sphere 0 64 0 32
/chrono field rate arena 5
/chrono field pause arena true
/chrono field step arena 1
/chrono field pause arena false
/chrono field remove arena
clear resets a named field’s controls while retaining its selection. remove deletes the field.
Java API
The main entry point is chrono_api.api.ChronoTime. Run time-control mutations on the logical server thread.
import chrono_api.api.ChronoTime;
import net.minecraft.server.level.ServerPlayer;
public void slowTime(ServerPlayer owner) {
ChronoTime.setTickrate(8.0F, owner, 32.0D);
}
public void stopTime(ServerPlayer owner) {
ChronoTime.pause(true, owner, 32.0D);
}
public void restoreTime(ServerPlayer owner) {
ChronoTime.clear(owner);
}
public boolean rewindTime(ServerPlayer player) {
return ChronoTime.rewind(
player.serverLevel(),
player.position(),
5.0D,
player
);
}
Passing an entity creates or updates an owner-following field. Passing null controls the shared global field:
ChronoTime.setTickrate(8.0F, null);
ChronoTime.pause(true, null);
// Resume global time and restore 20 TPS.
ChronoTime.clear(null);
State-query interfaces include:
ChronoTime.isPaused(entity);
ChronoTime.tickrate(entity);
ChronoTime.isRewinding(entity);
ChronoTime.isRewinding();
For named selections and advanced operations, use ChronoTime.createField(...), TimeScope, and TimeControl.
Always check the result of a rewind request. It may fail when usable history is unavailable or another rewind is already active.
Requirements
- Minecraft
1.20.1
- Minecraft Forge
47.x
- Java
17
- Palladium only when using the optional power-pack integration
Install Chrono API on both the server and connecting clients.
评论 0
登录后参与评分
还没有评论,来抢沙发吧