
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
Список изменений
Bug Fix: Confused conversations when multiple Pokemon are out
Problem: When multiple Pokemon were out of their Pokeballs at the same time, they would say things that didn't make sense - wrong personality, wrong stats,
mixed-up context.
Root causes found and fixed:
Fix 1 — ResponseContext was shared (AIHandler.kt)
- Before: A single ResponseContext was built using only the first Pokemon's data (level, health, friendship, mood). All Pokemon used that same context.
- After: Added buildContextForPokemon() that creates a separate context per Pokemon with its own level, HP, friendship, and mood.
Fix 2 — Cache keys used name instead of UUID (EmbeddedAIProvider.kt)
- Before: Response caches (recentResponses, recentStructures, responseCounters) were keyed by Pokemon display name. Two Pokemon with the same species/nickname would share caches, corrupting response variety and adaptive probabilities. Also ConversationMemory was called with the name instead of UUID, so contextual responses never worked.
- After: Added pokemonId parameter. All caches now use UUID as key. No more collisions between same-name Pokemon.
Fix 3 — DialogueSystem matched wrong Pokemon (DialogueSystem.kt)
- Before: pokemons.find() always returned the first match by name. With two Pokemon of the same species, the second one never got its speech bubble.
- After: Added matchedPokemonUuids tracking set. Each dialogue is assigned to a different Pokemon entity, even if they share the same name.
Fix 4 — MultiPokemonChatSystem was Italian-only
- Before: All interaction responses (agree, disagree, joke, question, addition) and message detection (addressed to all, discussion topics, addressed Pokemon) were Italian-only.
- After: All 8 functions now use Lang.tList() for bilingual IT/EN support.
Bonus fixes
- Lang.kt — Made t() and tList() generic so they work with data classes (Fear, Secret, Belief, Legend), fixing pre-existing compile errors in PokemonLifeStory.kt and PokemonLore.kt.
- MoodSystem.kt — 16 mood descriptions + getMoodDescription() now bilingual.
- WorldContext.kt — toPromptText(), toCompactText(), and collect() (weather, time, biome) now bilingual.