🌾 右鍵收穫與自動補種機制
Agrarian Reform 具備即時回饋(QoL)的右鍵快速採收機制。玩家只需右鍵點擊成熟作物即可一鍵收成並自動補種,由嚴謹的六維互動安全守衛提供安全保障。
📊 右鍵收穫特性資訊框
| Property | Value |
|---|---|
| Handler Class | net.instantgratification.agrarianreform.AgrarianReformFabric |
| Event Target | UseBlockCallback.EVENT |
| 觸發動作 | 主手右鍵(使用)點擊完全成熟的作物 |
| 收成效果 | 掉落農作物產物,將作物重置為階段 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 通用骨粉機制.
