Vital Signals
[ English | 简体中文 ]
一个为 Minecraft 模组提供详细玩家状态信息和事件系统的库。该库提供了一个对模组友好的 API,使其他模组能够接收和处理关于重要玩家状态变化(如生命值、饥饿值、氧气量等)的事件。
简介
Vital Signals 是专为 Minecraft 模组开发者设计的事件库。它利用 Fabric API 提供底层事件钩子和网络同步功能,允许模组精确追踪各种玩家属性变化。
- ? 详细数据捕获:捕获伤害计算过程的每一个阶段。
- ? 对模组友好的 API:简单且易于使用的事件注册系统。
- ? 自动网络同步:服务器自动将数据同步到客户端。
- ?️ 完整的减伤信息:记录所有减伤来源(护甲、盾牌、魔法效果等)。
功能
已完成的功能
伤害事件 ✅
一个全面的伤害计算追踪系统,记录玩家受到伤害时的所有详细信息。
计划中的功能
- ? 死亡事件 [v0.2.0]:玩家死亡时的完整信息。
- ? 饥饿事件 [v0.3.0]:饥饿值和饱和度的变化。
- ? 氧气事件 [v0.4.0]:水下氧气量的变化。
快速开始
添加依赖
将此库添加到你的 build.gradle 中:
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
modImplementation 'com.github.Rainy-day-y:Vital-Signals:v0.1.2'
}
伤害事件数据结构 (DamageData)
用于伤害事件的网络传输数据结构,采用 NBT 格式:
| 字段 |
类型 |
描述 |
gameVersion |
String |
Minecraft 游戏版本 |
version |
Int |
数据格式版本号 |
isDirect |
Boolean |
是否为直接伤害 |
typeId |
Int |
伤害类型 ID |
phase |
String |
当前伤害计算阶段 |
isCancelled |
Boolean |
伤害是否被取消 |
damageAmount |
Float |
最终伤害值(对生命值的实际影响) |
rawDamageAmount |
Float |
原始伤害值 |
difficultyReduced |
Float |
难度减免量 |
shieldBlocked |
Float |
盾牌格挡量 |
iceReduced |
Float |
冰霜行者靴子减免量 |
helmetReduced |
Float |
海龟壳 / 雪靴减免量 |
armorReduced |
Float |
护甲减免量 |
effectAndEnchantmentReduced |
Float |
魔法效果和附魔减免量 |
absorbed |
Float |
伤害吸收量 |
otherReduced |
Float |
其他减免量(计算得出的差值) |
数据包示例
{
gameVersion: "1.21.1",
version: 1,
isDirect: true,
typeId: 0,
phase: "FINAL",
isCancelled: false,
damageAmount: 5.0,
rawDamageAmount: 10.0,
difficultyReduced: 0.0,
shieldBlocked: 0.0,
iceReduced: 0.0,
helmetReduced: 0.0,
armorReduced: 2.0,
effectAndEnchantmentReduced: 0.5,
absorbed: 2.5,
otherReduced: 0.0
}
路线图
v0.1.2 (当前版本) - 伤害事件
- 伤害事件基础设施
- 完整的减伤信息捕获
- 向客户端的网络同步
- 对模组友好的 API
v0.2.0 (计划中) - 死亡事件
- 玩家死亡事件触发
- 详细的死亡原因信息
- 物品掉落前钩子
- 经验球掉落信息
v0.3.0 (计划中) - 饥饿事件
v0.4.0 (计划中) - 氧气事件
v1.0.0 (计划中) - 正式发布
- 完善所有核心事件
- 保证 API 稳定性
- 完整的文档和示例
- 性能优化
许可证
本项目根据 MIT 许可证 授权。
贡献
欢迎提交 Issue 和 Pull Request!如有建议或问题,请通过 GitHub Issues 联系我们。
相关链接
Vital Signals
[ English | 简体中文 ]
A library that provides detailed player status information and an event system for Minecraft mods. This library offers a Mod-friendly API, enabling other mods to receive and process events regarding important player status changes such as health, hunger, oxygen levels, and more.
Introduction
Vital Signals is an event library designed specifically for Minecraft mod developers. It leverages the Fabric API to provide low-level event hooks and network synchronization, allowing mods to precisely track various player attribute changes.
- ? Detailed Data Capture: Captures every stage of the damage calculation process.
- ? Mod-friendly API: Simple and easy-to-use event registration system.
- ? Automatic Network Synchronization: Server automatically syncs data to clients.
- ?️ Complete Damage Reduction Information: Records all sources of damage reduction (armor, shield, magic, etc.).
Features
Completed Features
Damage Event ✅
A comprehensive damage calculation tracking system that records all detailed information when a player takes damage.
Planned Features
- ? Death Event [v0.2.0]: Complete information upon player death.
- ? Hunger Event [v0.3.0]: Changes in hunger and saturation levels.
- ? Oxygen Event [v0.4.0]: Changes in underwater oxygen levels.
Quick Start
Adding Dependency
Add this library to your build.gradle:
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
modImplementation 'com.github.Rainy-day-y:Vital-Signals:v0.1.2'
}
Damage Event Data Structure (DamageData)
Data structure sent over the network for damage events, using NBT format:
| Field |
Type |
Description |
gameVersion |
String |
Minecraft game version |
version |
Int |
Data format version number |
isDirect |
Boolean |
Whether it is direct damage |
typeId |
Int |
Damage type ID |
phase |
String |
Current damage calculation phase |
isCancelled |
Boolean |
Whether the damage is cancelled |
damageAmount |
Float |
Final damage value (actual impact on health) |
rawDamageAmount |
Float |
Raw damage value |
difficultyReduced |
Float |
Difficulty reduction amount |
shieldBlocked |
Float |
Shield block amount |
iceReduced |
Float |
Frost Walker boot reduction |
helmetReduced |
Float |
Turtle Shell / Snow Boots reduction |
armorReduced |
Float |
Armor reduction amount |
effectAndEnchantmentReduced |
Float |
Magic effects and enchantment reduction |
absorbed |
Float |
Damage absorption amount |
otherReduced |
Float |
Other reductions (calculated difference) |
Data Packet Example
{
gameVersion: "1.21.1",
version: 1,
isDirect: true,
typeId: 0,
phase: "FINAL",
isCancelled: false,
damageAmount: 5.0,
rawDamageAmount: 10.0,
difficultyReduced: 0.0,
shieldBlocked: 0.0,
iceReduced: 0.0,
helmetReduced: 0.0,
armorReduced: 2.0,
effectAndEnchantmentReduced: 0.5,
absorbed: 2.5,
otherReduced: 0.0
}
Roadmap
v0.1.2 (Current Version) - Damage Event
- Damage event infrastructure
- Complete damage reduction information capture
- Network synchronization to client
- Mod-friendly API
v0.2.0 (Planned) - Death Event
- Player death event trigger
- Detailed death cause information
- Pre-item drop hooks
- Experience point drop information
v0.3.0 (Planned) - Hunger Event
- Hunger level change event
- Saturation level change event
- Hunger status change
v0.4.0 (Planned) - Oxygen Event
- Oxygen level change event
- Drowning status tracking
- Water breathing effect detection
v1.0.0 (Planned) - Full Release
- All core events refined
- API stability guarantee
- Complete documentation and examples
- Performance optimization
License
This project is licensed under the MIT License.
Contributing
Issues and Pull Requests are welcome! For suggestions or questions, please contact us via GitHub Issues.
Related Links
评论 0
登录后参与评分
还没有评论,来抢沙发吧