
Cobblemon:Crzbrain
CRZbrain is a Kotlin-based Fabric mod for Minecraft/Cobblemon that gives Pokemon an AI-powered brain featuring reinforcement learning, sentiment analysis, cross-trainer knowledge sharing, and adaptive response generation to make Pokemon interaction
Tags
Creators
Details
2.1.0
Compatibility
Changes
v3.5: Knowledge Graduation + SRG Optimization + Auto-Pruning + File Consolidation
- SRG Lazy Evaluation (SmartResponseGenerator.kt)
- Problem: 35+ subsystems were called BEFORE the probability gate check. With average gate ~9%, 91% of subsystem calls were wasted CPU.
- Fix: Inverted all probability gates so Random.nextFloat() < probability is checked BEFORE calling the subsystem. If the random check fails, the subsystem is never called.
- Replaced parts.add() with parts.addPart() that tracks a partsCollected counter.
- SRG Part Budget System (SmartResponseGenerator.kt)
- Problem: 30-50 response parts were generated per response, but only 2-3 were used.
- Fix: budgetGate(probability) lambda that enforces limits:
- After 8 parts collected: skip any gate with probability < 15%
- After 12 parts collected: skip ALL remaining gates
- Priority gates (critical health, shiny, near death, evolution) bypass the budget entirely
- Auto-Pruning of Stale Data (LearningSystem.kt + ExternalAILearning.kt)
- Problem: Learning data accumulated indefinitely, files grew without bound.
- Fix: pruneStaleData() runs every 5 minutes and removes:
- Associations with strength < 0.1
- Behavior patterns with < 3 observations AND older than 30 days
- Lessons with importance < 3 AND older than 60 days
- Pokemon knowledge with confidence < 0.3 AND not reinforced in 30 days
- Terminology with frequency == 1 AND older than 14 days
- ExternalAI responses with effectiveQuality < 0.1
- Backward compatible: pre-v3.5 data (createdAt == 0) is never pruned by age
- ExternalAI File Consolidation (ExternalAILearning.kt)
- Problem: 11 separate JSON files for ExternalAI learning data.
- Fix: Consolidated to 3 files:
- learned_responses.json (byNature + byEvent + byEmotion + byTopic + bySpecies + speciesLastUsed)
- learned_phrases.json (phrases + expressions + openers + closers + conversationPatterns)
- stats.json (unchanged)
- Backward compatible: loads old 11-file format if new format not found, migrates on next save, then deletes old files
- Knowledge Graduation System (LearningSystem.kt)
- Problem: Each Pokemon learns independently from scratch. Data accumulated per-Pokemon without cross-pollination.
- Fix: graduateKnowledge() runs every 5 minutes and promotes validated knowledge:
- Vocabulary appearing in 3+ Pokemon → shared vocabulary
- Associations in 3+ Pokemon with avg strength > 0.5 → shared associations
- Behavior patterns with successRate > 0.75 and 10+ observations in 2+ Pokemon → shared patterns
- Knowledge with confidence > 0.8 and 5+ reinforcements in 2+ Pokemon → shared knowledge
- Battle strategies from Pokemon with 20+ battles → shared battle meta
- Graduated entries are removed from per-Pokemon data (files shrink over time)
- bootstrapNewPokemon(): Pokemon with < 10 vocabulary items automatically receive graduated knowledge as a starting base
- Saved to graduated_knowledge.json
Files Modified ┌───────────────────────────┬────────────────────────────────────────────────────────────────────┐ │ File │ Changes │ ├───────────────────────────┼────────────────────────────────────────────────────────────────────┤ │ SmartResponseGenerator.kt │ Lazy evaluation (35+ gates inverted) + Part budget system │ ├───────────────────────────┼────────────────────────────────────────────────────────────────────┤ │ LearningSystem.kt │ Knowledge graduation + auto-pruning + createdAt fields + version 5 │ ├───────────────────────────┼────────────────────────────────────────────────────────────────────┤ │ ExternalAILearning.kt │ File consolidation (11→3) + pruning │ ├───────────────────────────┼────────────────────────────────────────────────────────────────────┤ │ CRZbrainMod.kt │ Periodic graduation/pruning trigger (every 6000 ticks) │ └───────────────────────────┴────────────────────────────────────────────────────────────────────┘ Impact
- CPU: ~91% reduction in subsystem calls, max 12 parts instead of 30-50
- Disk: Files auto-shrink via graduation + pruning, 11 files → 3 for ExternalAI
- AI Quality: New Pokemon inherit validated cross-Pokemon knowledge instead of starting from zero
- Build: BUILD SUCCESSFUL, only 2 pre-existing warnings (playerMessage != null)
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:JbNzzoj3:AMU2LlIf"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:JbNzzoj3:AMU2LlIf"
}
