🌾 右键收获与自动补种机制
Agrarian Reform 包含即时反馈(QoL)的右键快速收割机制。玩家只需右键点击成熟作物即可一键采收并自动重新补种,受严格的六维交互安全卫士保驾护航。
📊 右键收获特性信息框
| Property | Value |
|---|---|
| Handler Class | net.instantgratification.agrarianreform.AgrarianReformFabric |
| Event Target | UseBlockCallback.EVENT |
| 触发动作 | 主手右键(使用)点击完全成熟的农作 emergency |
| 触发效果 | 生成收获掉落物,将方块重置为阶段 0,播放收割音效 |
| 潜行避让机制 | 潜行 + 右键 (player.isSecondaryUseActive()) 绕过收割直接放置方块 |
| 防抖保护 | 仅限主手触发(hand != InteractionHand.MAIN_HAND 直接返回 PASS) |
| GameRule Toggle | agrarian_reform:right_click_harvest (Default: true) |
⚙️ 6 维交互防护决策流程
PLAYER RIGHT-CLICKS CROP BLOCK
│
▼
1. Is Hand MAIN_HAND? (Off-Hand Debounce)
┌────┴────┐
YES│ │NO
▼ ▼
2. Is Player Sneaking? (Secondary Use Bypass)
(player.isSecondaryUseActive())
┌────┴────┐
NO│ │YES
▼ ▼
3. Is right_click_harvest GameRule true?
┌────┴────┐
YES│ │NO
▼ ▼
4. Is crop at maximum age (isMaxAge)?
┌────┴────┐
YES│ │NO
▼ ▼
5. Sided Execution & Item Drops
- Query loot table on server side (!level.isClientSide)
- Spawn drops into world
- Reset block state to Age 0
- Play harvest & crop rustle sound
- Return InteractionResult.SUCCESS🌾 支持右键收获的作物列表
- Wheat (
minecraft:wheat) - Carrots (
minecraft:carrots) - Potatoes (
minecraft:potatoes) - Beetroots (
minecraft:beetroots) - 模组农业集成:继承
CropBlock或标记有#c:crops的所有作物均完美兼容。
⚙️ 服务器指令配置
bash
/gamerule agrarian_reform:right_click_harvest falseSee also: 播种与草方块培植, 作物注册表与通用作物, and 通用骨粉机制.
