
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
v2.2: Core AI Learning Infrastructure
- Adaptive Learning Rate + Epsilon Decay - RL learning rate decreases over time, exploration decays (ReinforcementLearning.kt)
- Experience Replay Buffer with Prioritized Sampling - RL replays high-reward episodes more often (ReinforcementLearning.kt)
- Bilingual Sentiment IT/EN + Negation Detection - 3D sentiment (VAD) works in Italian and English, detects negation (AdvancedPatternMining.kt)
- Quality Decay + Diversity Scoring - External AI responses lose quality over time, diverse responses preferred (ExternalAILearning.kt)
- RL-Driven Response Selection - Response parts scored by RL success history (SmartResponseGenerator.kt)
- Closed-Loop Feedback Attribution - Player feedback traces back to which response sources caused it (LearningContextIntegration.kt)
- Cross-Pokemon Knowledge Transfer - Winning strategies propagate across trainers (GlobalKnowledgeNetwork.kt + AdaptiveLearning.kt)
v2.3: Critical Bug Fixes + Exploration Overhaul
- Move crash fix - null-safety on displayName.string, template access, target.pokemon (PokemonDefenseSystem.kt)
- Quality score formula fix - Was cancelling out normalization (LearningContextIntegration.kt)
- Policy Gradient fix - Now advantage-based (reward - baseline) instead of broken ln(probability) (ReinforcementLearning.kt)
- UCB exploration - Replaces epsilon-greedy in both RL and AdaptiveLearning
- Bayesian Beta confidence - Strategy success rates use proper Bayesian estimation (AdaptiveLearning.kt)
- Strategy temporal decay - Old strategies gradually lose relevance (AdaptiveLearning.kt)
- Markov chain prediction - Predicts trainer's next action from transition probabilities (AdaptiveLearning.kt)
- Context weight persistence - Learned source weights saved/loaded as JSON (LearningContextIntegration.kt)
- Conflict detection - Detects contradictions between context sources (LearningContextIntegration.kt)
- Adaptive enhancement probabilities - contextQuality drives feature activation rates (LearningContextIntegration.kt)
v2.4: RL Feedback Loop + Adaptive Probabilities
- RL Feedback Loop closed - SRG records responses and detects player feedback (SmartResponseGenerator.kt)
- LCI connected to SRG - Was completely dormant, now provides context (SmartResponseGenerator.kt)
- Rich RL context - "event_nature_mood" instead of just "event_name" (SmartResponseGenerator.kt)
- 6 adaptive gates - Key feature gates use getAdaptiveProbability() instead of hardcoded values (SmartResponseGenerator.kt)
- RL exploration from profile - Uses learned epsilon instead of hardcoded 10% (SmartResponseGenerator.kt)
- Context quality drives maxParts - 15-30% chance of 2 response parts based on quality (SmartResponseGenerator.kt)
- RL scoring boost - Scaled by context quality, up to +25 points (SmartResponseGenerator.kt)
- Post-processing with LCI context - Responses enhanced with learning context (SmartResponseGenerator.kt)
v2.5: Terminology Learning
- LearnedTerm data class - Tracks frequency, context, decay, anti-parrot flag (LearningSystem.kt)
- learnPlayerTerminology() - Extracts words/expressions, filters IT/EN stop words (LearningSystem.kt)
- getTopPlayerTerms() - Scored by frequency + recency - decay, minimum frequency 2 (LearningSystem.kt)
- Terminology injection - ~20% chance in post-processing (SmartResponseGenerator.kt)
- Nature-aware injection - jolly=excited, timid=hesitant, sassy=meta (SmartResponseGenerator.kt)
- Multi-word expressions - 2-3 word phrases supported, cap 150 terms/player (LearningSystem.kt)
- Persistence - LearningData v4, backward compatible with v3 (LearningSystem.kt)
v2.6: Bug Fix + Dormant Code Activation
- LanguageGrowth || → && fix - Expression/catchphrase development was 95% blocked (LanguageGrowth.kt)
- LanguageGrowth typo + activation - Fixed "deplorevol mente", activated useAcquiredWord + generateEmotiveExpression (LanguageGrowth.kt)
- EmotionalMomentum dynamics - Dynamic momentum by nature, energy/curiosity/confidence/stress influence responses (EmotionalMomentum.kt)
- DeepUnderstanding 5x faster - Comprehension reaches 0.85 in 2K messages instead of 100K (DeepUnderstanding.kt)
- IntelligenceEvolution inference fix - Fuzzy word matching for deductive, multi-word for inductive (IntelligenceEvolution.kt)
- Battle dialogue probability - Nature/friendship-based: brave+max=67%, timid+min=7.5% (BattleEnhancementSystem.kt)
- No early return in AdvancedIntelligence - Now flows through ALL post-processing systems (SmartResponseGenerator.kt)
v2.7: TPS Optimization
- PokemonDefenseSystem - Interval 5→20 ticks, 1 entity search per player instead of N*M, auto-deactivate (PokemonDefenseSystem.kt)
- Async File I/O - MemorySystem.batchSave + RL + PatternMining + CollectiveIntelligence on CompletableFuture.runAsync (CRZbrainMod.kt)
- Memory leak fix - 22 AI systems now have reset() and are registered in PokemonLifecycleManager
- Chat learning throttle - 2s cooldown + max 3 Pokemon per message (was unlimited) (CRZbrainMod.kt)
v2.8: Bug Fix + AI Quality Overhaul (44 fixes)
Critical (10)
- RL Experience Replay gradient fix - Was ln(prob), now advantage-based like main path (ReinforcementLearning.kt)
- SRG Feedback Loop ordering - Read previous context BEFORE overwriting (was attributing to wrong context) (SmartResponseGenerator.kt)
- LCI parser fix - Was parsing wrong format, always returning dummy data (LearningContextIntegration.kt)
- LCI Quality Score fix - Removed division by qualityFactors (was ~0.17, now sum ~1.0) (LearningContextIntegration.kt)
- EmbeddedAIProvider pokemonId fix - Pass UUID instead of display name (all lookups were failing) (EmbeddedAIProvider.kt)
- ExternalAILearning usageCount - val→var + increment (overuse penalty was dead) (ExternalAILearning.kt)
- ExternalAILearning 3 collections persisted - learnedByEvent/Emotion/Topic were lost on restart (ExternalAILearning.kt)
- GlobalKnowledgeNetwork propagation - propagateWinningStrategy now actually calls AdaptiveLearning.importStrategy (GlobalKnowledgeNetwork.kt)
- EmotionalMomentum loadAll() - Called at server start (states were saved but never loaded) (EmotionalMomentum.kt)
- SRG confidence/curiosity passthrough - Were silently dropped when calling EmotionalMomentum.applyMomentum (SmartResponseGenerator.kt)
High (14)
- AdaptiveLearning temporal decay - Read-time only (was compounding destructively on every update) (AdaptiveLearning.kt)
- RL double reward removed - integrateWithAdaptiveLearning no longer calls recordConsequence (ReinforcementLearning.kt)
- RL UCB constant - Fixed to 1.414 (was decaying with epsilon, becoming useless) (ReinforcementLearning.kt)
- RL plateau detection - Sliding window of last 200 rewards (was cumulative avg, always triggering) (ReinforcementLearning.kt)
- LCI word-boundary matching - Feedback indicators use word boundaries (was substring: "sono"/"pokemon" triggered "no"/"ok") (LearningContextIntegration.kt)
- APM transition matrix - Stores raw counts, normalizes on-the-fly (AdvancedPatternMining.kt)
- LearningSystem action inference - Infers action type from message (question/greeting/farewell/compliment/command/chat) (LearningSystem.kt)
- SRG wasSuccessful - Uses real feedback tracking (was always true) (SmartResponseGenerator.kt)
- LanguageGrowth nature mapping - All 25 natures mapped to 4 categories + complexity 5 expressions (LanguageGrowth.kt)
- SRG evolution keywords - Not filtered during EVOLUTION events (SmartResponseGenerator.kt)
- ExternalAILearning separate .copy() - Per collection (feedback was multiplied 5x) (ExternalAILearning.kt)
- AdaptiveLearning preferences - Non-destructive (both liked/disliked accumulate independently) (AdaptiveLearning.kt)
- EmbeddedAIProvider level fix - {newLevel} off-by-one fixed (context.level is already the new level) (EmbeddedAIProvider.kt)
- RL thread-safe replay - Local var instead of mutating shared profile.learningRate (ReinforcementLearning.kt)
Medium + Optimizations (20)
- RL prioritized sampling - Recalculates remaining priority after each selection
- RL sliding window baseline - For advantage computation (replaces stale cumulative avg)
- APM arousal baseline - 0.3 (was 0.5, wasting half the range)
- APM English stopwords - 35 words added to keyword extraction
- APM detectIntent - Word-boundary matching (was substring false-positive)
- DeepUnderstanding random gate - On output not analysis (detectImplicit, detectSarcasm)
- DeepUnderstanding emotionalReading - No longer multiplies intensity (was making emotion path unreachable)
- IntelligenceEvolution inference - Single-roll weighted type selection (was biased cascade)
- EmotionalMomentum punctuation - Regex-based period/exclamation replacement (sentence-ending only)
- ExternalAILearning recencyBonus - Uses creation timestamp (was rich-get-richer on lastUsed)
- ExternalAILearning Gson fixup - Post-load fixup for pre-v2.2 data
- GlobalKnowledgeNetwork diversity - Uses total trainers (was always 1.0)
- SRG thread-safe maps - ConcurrentHashMap for lastEventByPokemon/recentEventsByPokemon
- SRG reset() - Cleans all maps (was missing 2+1 maps)
- LanguageGrowth faster progression - Lower divisors + Math.round
- SRG discard reduced - ContextualResponse 40%→15%
- SRG bounded action space - Uses source category instead of response text
- APM sentiment cache - LRU eviction when full (was stopping caching at 500)
- EmbeddedAIProvider reset() - Added + registered in PokemonLifecycleManager (4 maps cleaned)
- EmotionalMomentum reset() - Deletes JSON file (was leaving orphans on disk)
v2.9: Performance Optimization
- LCI containsWord→Set check - Split once, Set.contains(), zero Regex per call (was 60+) (LearningContextIntegration.kt)
- LCI 4 parser Regex pre-compiled - PARSER_MESSAGE_COUNT, PARSER_MOOD, etc. (LearningContextIntegration.kt)
- APM detectIntent rewrite - Set-based word matching (was 20+ Regex per call) (AdvancedPatternMining.kt)
- APM sentiment cache LRU - Eviction when full (was stopping caching) (AdvancedPatternMining.kt)
- SRG wordBoundary→Set check - Was 24 Regex per call (SmartResponseGenerator.kt)
- SRG removed duplicate learning - Was running 17 ops twice per response (SmartResponseGenerator.kt)
- SmartConversation simplified - Replaced with recordDirectInteraction only (SmartConversation.kt)
- DeepUnderstanding 36 Regex pre-compiled - Object-level vals (was per-message creation) (DeepUnderstanding.kt)
- LearningSystem VOCAB_SPLIT_REGEX - Pre-compiled, recordDirectInteraction made public (LearningSystem.kt)
- CRZbrainMod isDirectToMe - true for sender's own Pokemon in handlePlayerChat (CRZbrainMod.kt)
- LearningSystem size caps - learnedVocabulary(500), associations(300), behaviorPatterns(100), positiveResponseTriggers(50), evidence(20) (LearningSystem.kt)
Impact: ~150 Regex/message → ~5, learning ops halved for responding Pokemon
v3.0: AI Quality Overhaul (Zero CPU Cost)
Gruppo A: Emotional + Intention Scoring
- EmotionalMomentum guides selection - Emotional state influences WHICH response is chosen, not just post-processing (SmartResponseGenerator.kt)
- DeepUnderstanding moved before selection - analyzeMessage runs BEFORE scoring, intent guides response choice (SmartResponseGenerator.kt)
- Intention-based scoring - QUESTION→answers, PRAISE→thanks, CRITICISM→apologies, AFFECTION→emotes (SmartResponseGenerator.kt)
Gruppo B: Waste Reduction
- Score-based rejection - topScore>=20 always passes, else 75% (was 50% random discard) (SmartResponseGenerator.kt)
- RL boost 2.5x stronger - Formula (40+ctx20) range 0-60 (was 20+ctx5, range 0-25) (SmartResponseGenerator.kt)
- IQ-based comment chance - 15-35% based on IQ (was fixed 15%) (SmartResponseGenerator.kt)
- Pattern-based recall chance - 10-25% based on patternRecognition (was fixed 10%) (SmartResponseGenerator.kt)
Gruppo C: Adaptive Gates
- 7 more gates adaptive - species_behavior, social_comment, battle_style, proactive_comment, help_offer, rank_dialogue, inter_member (SmartResponseGenerator.kt)
- Terminology + DeepUnderstanding adaptive - Both injection gates use getAdaptiveProbability() (SmartResponseGenerator.kt)
Gruppo D: Transitions + Feedback Loop
- Content-based transitions - combineResponsesLogically uses content analysis instead of random (SmartResponseGenerator.kt)
- Feature source tracking - activeFeatureSources feeds into recordResponseAttribution for feedback (SmartResponseGenerator.kt)
Gruppo E: Complexity-Aware Depth
- getComplexityLevel() added - Public function in LanguageGrowth (LanguageGrowth.kt)
- High-complexity Pokemon depth - complexity>=4 with high abstractThinking get extra intelligent comments (SmartResponseGenerator.kt)
v3.1: Stability + Performance + Dormant AI Activation
Gruppo A: Stability/Persistence (6 fixes)
- Shutdown async wait - Server waits up to 5s for async save to finish before shutdown saves (CRZbrainMod.kt)
- ExternalAILearning.loadData() at startup - Was missing, 3 collections not loaded (CRZbrainMod.kt)
- Atomic write - LearningSystem writes to .tmp then renames, prevents corruption on crash (LearningSystem.kt)
- isDirty timing verified - CollectiveIntelligence was already correct, added clarifying comments (CollectiveIntelligence.kt)
- learnedClosers persisted - Now saved/loaded as learned_closers.json (was lost every restart) (ExternalAILearning.kt)
- recentEpisodeRewards verified - Already persisted via Gson in RLProfile data class (ReinforcementLearning.kt)
Gruppo B: Performance (13 fixes)
- IntelligenceEvolution 17 Regex pre-compiled - detectEmotionalPattern(5), detectRequestPattern(4), categorizeMessage(8) (IntelligenceEvolution.kt)
- 4x removeAt(0) → ArrayDeque.removeFirst() - O(1) instead of O(n) in SRG, APM, EmbeddedAIProvider(2x)
- Outer map cap 200 - EmbeddedAIProvider trimOuterMapsIfNeeded() prevents unbounded growth (EmbeddedAIProvider.kt)
- SRG CLEAN_ACTION_REGEX - Pre-compiled Regex in scoring loop (SmartResponseGenerator.kt)
- AIHandler 2 retry Regex - CLAUDE_RETRY_REGEX + RETRY_DELAY_REGEX pre-compiled (AIHandler.kt)
- ContextualMemoryBridge 2 Regex - DIGIT_REGEX + INTENSITY_REGEX pre-compiled (ContextualMemoryBridge.kt)
- ExternalAILearning 3 Regex - SENTENCE_SPLIT_REGEX + WORD_SPLIT_REGEX + ASTERISK_EXPRESSION_REGEX pre-compiled (ExternalAILearning.kt)
- AdvancedPersonalitySystem 1 Regex - TOKEN_SPLIT_REGEX pre-compiled (AdvancedPersonalitySystem.kt)
Gruppo C: Dormant AI Activation (3 fixes)
- predictNextAction activated - Markov chain predictions enrich RL context before response selection (SmartResponseGenerator.kt ← AdvancedPatternMining.kt)
- validatePrediction activated - Predictions validated on next player message, closes feedback loop (SmartResponseGenerator.kt ← AdvancedPatternMining.kt)
- Cross-Pokemon RL transfer - New Pokemon (<10 episodes) get +15 score boost from global top actions; integrateWithAdaptiveLearning syncs every 50 episodes (SmartResponseGenerator.kt ← ReinforcementLearning.kt)
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:F8u1GG6H"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:JbNzzoj3:F8u1GG6H"
}
