Minecraft 1.21.1 · Fabric + NeoForge · Java 21
Remnant 在玩家登出后,仍可为模组提供玩家数据支持。它作为服务器端库继续承载 Offline Player Cache (OPC) 的功能,用于排行榜、统计信息、进度追踪及其他集成需求。
工作原理
- 登出时保存数据。 集成模组会注册所需的数据值。Remnant 将这些捕获的值存储在 Minecraft 世界数据中,因此快照可在服务器重启后保留。
- 登录时返回实时数据。 当玩家重新加入时,Remnant 会清除离线快照。集成模块可以通过 UUID 或忽略大小写的用户名查找玩家。
- 在游戏中管理快照。 操作员可以检查已保存的值、移除某个键,或清除玩家的离线快照。
安装
- Fabric 1.21.1 — 需要 Fabric API 和 Fabric Language Kotlin
- NeoForge 1.21.1 — 需要 Kotlin for Forge
- Java 21
在服务器上安装对应加载器的 JAR 文件以及上述依赖项。集成模组会提供排行榜、统计信息和其他功能所使用的数据值。
命令
所有命令都需要权限等级 2。
/remnant keys
/remnant players
/remnant get name <name> <key>
/remnant get uuid <uuid> <key>
/remnant list name <name>
/remnant list uuid <uuid>
/remnant remove name <name> <key>
/remnant remove uuid <uuid> <key>
/remnant clear name <name>
/remnant clear uuid <uuid>
get 和 list 读取在线玩家的实时值和离线玩家的已保存值。查找操作支持 UUID 和忽略大小写的用户名。remove 和 clear 仅修改离线快照。
面向开发者
已注册的值由一个 ResourceLocation 标识,使用 Mojang Codec 进行序列化,并从实时 Player 生成。
public static final PlayerLedgerKey<Contract> CONTRACT = PlayerLedger.register(
ResourceLocation.fromNamespaceAndPath("example", "contract"),
Contract.CODEC,
player -> new Contract(player.getName().getString(), true)
);
使用 PlayerLedger.getPlayer(...) 配合 UUID 或用户名来读取实时玩家或离线快照。如果两者均不可用,将抛出 IllegalStateException。使用 getOfflinePlayer(...) 进行仅限缓存的查找,若无快照则返回 null。
对于 Modrinth Maven,请使用项目 ID,以便即使公开别名(slug)发生变化,坐标也能保持稳定:
repositories {
exclusiveContent {
forRepository {
maven("https://api.modrinth.com/maven")
}
filter {
includeGroup("maven.modrinth")
}
}
}
dependencies {
implementation("maven.modrinth:oLPaySSb:3.0.0+1.21.1-fabric") /* For NeoForge, use 3.0.0+1.21.1-neoforge. */
}
完整的 API 示例、源代码、开发说明和发布历史可在 主 GitHub 仓库 中找到。
许可证
Remnant 采用 Bare Minimum License (BML) v1.1 许可证。请参阅 完整许可证。
赞助商
使用代码 bareminimum 可获得 首月 25% 折扣!
Minecraft 1.21.1 · Fabric + NeoForge · Java 21
Remnant keeps player data available to mods after players log out. It continues Offline Player Cache (OPC) as a server-side library for leaderboards, statistics, progression, and other integrations.
How it works
- Save data on logout. Integrating mods register the values they need. Remnant stores captured values in Minecraft world data, so snapshots survive server restarts.
- Return to live data on login. Remnant clears the offline snapshot when the player rejoins. Integrations can look up players by UUID or case-insensitive username.
- Manage snapshots in game. Operators can inspect saved values, remove a key, or clear a player's offline snapshot.
Installation
- Fabric 1.21.1 — requires Fabric API and Fabric Language Kotlin
- NeoForge 1.21.1 — requires Kotlin for Forge
- Java 21
Install the JAR for your loader and the dependencies above on the server. Integrating mods supply the values used by leaderboards, stats, and other features.
Commands
All commands require permission level 2.
/remnant keys
/remnant players
/remnant get name <name> <key>
/remnant get uuid <uuid> <key>
/remnant list name <name>
/remnant list uuid <uuid>
/remnant remove name <name> <key>
/remnant remove uuid <uuid> <key>
/remnant clear name <name>
/remnant clear uuid <uuid>
get and list read live values for online players and saved values for offline players. Lookups support UUIDs and case-insensitive usernames. remove and clear only modify offline snapshots.
For developers
A registered value is identified by a ResourceLocation, serialized with a Mojang Codec, and produced from a live Player.
public static final PlayerLedgerKey<Contract> CONTRACT = PlayerLedger.register(
ResourceLocation.fromNamespaceAndPath("example", "contract"),
Contract.CODEC,
player -> new Contract(player.getName().getString(), true)
);
Use PlayerLedger.getPlayer(...) with a UUID or username to read a live player or an offline snapshot. It throws IllegalStateException when neither is available. Use getOfflinePlayer(...) for a cache-only lookup that returns null when there is no snapshot.
For Modrinth Maven, use the project ID so the coordinate stays stable if the public slug changes:
repositories {
exclusiveContent {
forRepository {
maven("https://api.modrinth.com/maven")
}
filter {
includeGroup("maven.modrinth")
}
}
}
dependencies {
implementation("maven.modrinth:oLPaySSb:3.0.0+1.21.1-fabric") /* For NeoForge, use 3.0.0+1.21.1-neoforge. */
}
Full API examples, source, development notes, and release history are available on the main GitHub repository.
License
Remnant is licensed under the Bare Minimum License (BML) v1.1. See the full license.
Sponsor
Use code bareminimum to get 25% off your first month!
评论 0
登录后参与评分
还没有评论,来抢沙发吧