🏛️ 系統架構與代碼套件佈局
📌 代碼倉庫原始碼免責聲明:本維基文件反映了倉庫當前的原始碼狀態,可能包含領先於 CurseForge 與 Modrinth 上公開發布版本的最新開發提交或未發布功能。
| Design Principle | Architectural Policy |
|---|---|
| Core Philosophy | Vanilla Outsider (VO) — Diegetic, non-destructive, input-consistent |
| Design Rule | 1 File, 1 Function Law (Single-responsibility Cohesion) |
| Main Package Namespace | net.vanillaoutsider.betterbats |
| Thread Safety Model | Server-Thread Main Looper Sync (No async world mutation) |
☕ 獨立開發者寄語:如果你喜歡蝙蝠逼真的三維群飛和鳥糞為莊稼施肥的生態體驗,歡迎在 Ko-fi 上支持我的獨立開發!
🌳 套件結構分層圖
net.vanillaoutsider.betterbats
├── BetterBatsFabric.java # Mod initialization, GameRules registration
├── BetterBatsFabricClient.java # Client render layer, debug toggles
├── ai/ # AI Goal domain logic
│ ├── BatDiveBombGoal.java # Predatory hunting of silverfish/endermites
│ ├── BatFlightHelper.java # 3D BOIDs flocking and vector math
│ ├── BatHuntLightGoal.java # Nighttime phototaxis light orbiting
│ ├── BatPanicGoal.java # Vibration acoustic panic dispersion
│ ├── BatRoostHelper.java # Daytime roost surface validator
│ └── BatSleepGoal.java # Roosting and guano accumulation
├── config/ # YACL v3 and Cloth Config menus
│ ├── BetterBatsConfig.java # Plain Java config data model
│ └── ModMenuIntegration.java # ModMenu screen factory provider
└── mixin/ # Bytecode injection layer
├── BatMixin.java # Injects AI goals, flight forces, save data
├── GameEventDispatcherMixin.java # Acoustic vibration listener hook
└── NaturalSpawnerMixin.java # Dynamic ambient spawner weight replacement🧩 核心類別職責
BatFlightHelper: Stateless mathematical engine computing flocking, cohesion, separation, alignment, and altitude bounds.BatRoostHelper: Checks valid roosting blocks (dripstone, chains, lanterns, leaves, solid ceilings).BatMixin: Surgical bytecode hooks ensuring complete vanilla world-save safety.
Next: Mixin 參考與注入點 | 行為配置與狀態存取器
