Open Hands Lib
为 NeoForge 内容模组提供按手区分的近战冷却与挖掘功能。
如果你不是模组开发者,这是一个依赖模组。
仅当其他模组将 open_hands_lib 列为必需依赖时才安装它。单独安装时,它不会添加任何物品、方块或游戏玩法。
Open Hands Lib 是什么?
一个 NeoForge 库,将攻击和挖掘逻辑拆分到主手和副手。每只手拥有独立的冷却计时器;你的内容模组决定系统何时激活以及使用哪只手。
该库管理计时器、混入(mixins)和状态。你的模组注册启用条件并处理事件——库本身不会替你选择决斗逻辑。
功能
战斗(为玩家启用时)
- 每只手独立冷却
- 仅在完全蓄力时命中——故意拒绝部分挥击
- 通过
ResolveAttackHandEvent 选择手(如交替使用、最佳武器等)
- 伤害、附魔和武器效果使用已解析的手
- 可选规则:当副手持用物品时,使用主手进行攻击
当任意注册的启用条件为真时激活战斗(OR 逻辑)。
挖掘(启用时)
- 工具、采集判定、速度和耐久度遵循已解析的手
- 通过
ResolveMiningHandEvent 选择手
- 每个方块的会话缓存,直到挖掘停止
当任意注册的启用条件为真时激活挖掘(OR 逻辑)。
要求
|
|
| Minecraft |
1.21.1 |
| Java |
21+ |
| Mod ID |
open_hands_lib |
| Version |
0.1.1 |
| Author |
Thow New Error |
| NeoForge |
21.1.219+ · Kotlin for Forge 5.9.0+ |
| Fabric |
Loader 0.16.14+ · Fabric API · Fabric Language Kotlin |
安装
- 安装 NeoForge
- 安装 Kotlin for Forge
- 安装 Open Hands Lib 及其依赖的内容模组
请勿在公共整合包中重命名此模组或将 jar 替换为非官方构建版本。
供模组开发者使用
注册你的游戏玩法应开启的时机,然后监听手部事件:
OpenHandsLib.registerEnableCondition(
ResourceLocation.fromNamespaceAndPath("your_mod", "dual_wield"),
) { player -> /* your check */ true }
NeoForge.EVENT_BUS.register(object {
@SubscribeEvent
fun onResolveAttackHand(event: ResolveAttackHandEvent) {
event.hand = InteractionHand.MAIN_HAND
}
@SubscribeEvent
fun onAttackHandCompleted(event: AttackHandCompletedEvent) {
// alternation, etc.
}
})
挖掘:registerMiningEnableCondition + ResolveMiningHandEvent。
公共 API
mod.openhandslib.api.OpenHandsLib — 入口点
ResolveAttackHandEvent, AttackHandCompletedEvent, OpenHandsCombatStateClearEvent
ResolveMiningHandEvent
Open Hands Lib
Per-hand melee cooldowns and mining for NeoForge content mods.
If you are not a mod developer, this is a dependency mod.
Install it only when another mod lists open_hands_lib as a required dependency. On its own it does not add items, blocks, or gameplay.
What is Open Hands Lib?
A NeoForge library that splits attack and mining logic across main hand and off hand. Each hand gets its own cooldown timer; your content mod decides when the system is active and which hand to use.
The library owns timers, mixins, and state. Your mod registers enable conditions and handles events — the library does not pick duelist logic for you.
Features
Combat (when enabled for a player)
- Independent cooldown per hand
- Attacks only land at full charge — partial swings are rejected on purpose
- Hand selection via
ResolveAttackHandEvent (alternation, best weapon, etc.)
- Damage, enchantments, and weapon effects use the resolved hand
- Optional rules to attack with the main hand while the off hand is using an item
Combat activates when any registered condition is true (OR).
Mining (when enabled)
- Tool, harvest check, speed, and durability follow the resolved hand
- Hand selection via
ResolveMiningHandEvent
- Per-block session cache until mining stops
Mining activates when any registered condition is true (OR).
Requirements
|
|
| Minecraft |
1.21.1 |
| Java |
21+ |
| Mod ID |
open_hands_lib |
| Version |
0.1.1 |
| Author |
Thow New Error |
| NeoForge |
21.1.219+ · Kotlin for Forge 5.9.0+ |
| Fabric |
Loader 0.16.14+ · Fabric API · Fabric Language Kotlin |
Installation
- Install NeoForge
- Install Kotlin for Forge
- Install Open Hands Lib and the content mod that depends on it
Do not rename the mod or swap the jar for an unofficial build in public modpacks.
For mod developers
Register when your gameplay should turn on, then listen for hand events:
OpenHandsLib.registerEnableCondition(
ResourceLocation.fromNamespaceAndPath("your_mod", "dual_wield"),
) { player -> /* your check */ true }
NeoForge.EVENT_BUS.register(object {
@SubscribeEvent
fun onResolveAttackHand(event: ResolveAttackHandEvent) {
event.hand = InteractionHand.MAIN_HAND
}
@SubscribeEvent
fun onAttackHandCompleted(event: AttackHandCompletedEvent) {
// alternation, etc.
}
})
Mining: registerMiningEnableCondition + ResolveMiningHandEvent.
Public API
mod.openhandslib.api.OpenHandsLib — entry point
ResolveAttackHandEvent, AttackHandCompletedEvent, OpenHandsCombatStateClearEvent
ResolveMiningHandEvent
评论 0
登录后参与评分
还没有评论,来抢沙发吧