VillageAI
Intelligent village defense system. Villages centered on bells automatically detect nearby villagers. Friendly players gain reputation by trading. Hostile players lose reputation by attacking villagers. When hostile players are nearby reputation drops belo
📖About VillageAI
🧠 How Villages Work
Bell-Centered: Every bell defines a village center (auto-detects on place/load/break).
Member Tracking: Auto-adds nearby villagers (32-block scan on spawn).
Reputation System:
+2 rep: Right-click/trade with villager.
-25 rep: Attack a villager.
Auto-decay: Slowly recovers (+1 every 30-60s if no harm).
Hostile Threshold: Rep ≤ -30 = enemy (forgivable over time).
⚔️ Defense Stages
ALERT (Immediate):
All doors in 8-block radius slam shut.
Bell rings (15s cooldown for spam-free alerts).
DEFENDING (After 10s):
Spawns up to 2 iron golems at bell (natural spawn, not player-created).
Golems only target hostile players – ignores allies!
Auto-despawn when safe.
Safe Mode: Resets when no threats nearby. Doors reopen naturally.
🔧 Smart Behaviors
Iron Golem AI: Cancels targeting non-hostiles (even if vanilla would attack).
Chunk-Safe: Loads villages on chunk load (bells trigger scan).
Efficient: 2s tick rate – zero lag (50+ players tested).
Edge Cases: Handles bell breaks (dismantles village), villager spawns near bells.
🎮 Player Experience
Friendly Traders: Interact freely – villages trust you over time.
Raiders Beware: Sneak in? Rep drops → instant lockdown + golem squad.
No Fuss: Works out-of-box, no worlds/config/commands needed.
Vanilla Feel: Uses native entities/sounds – seamless integration.
⚙️ Technical Specs
Supported: Paper/Spigot/Purpur 1.20–1.21+ (Java 21).
Permissions: villageai.admin (OP default, unused for now).
Size: Tiny (~10KB jar) – fast load.
Future-Proof: Easy to extend (add config, more states, pathsfinding).
📥 Installation
Drop VillageAI-1.0.0.jar into plugins/.
Restart/reload server.
Build a bell – watch villages come alive! 🔔
Author: Dương (Duong2012G)