Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Creators
Details
Changelog
● Fix: Remove getActivePokemon() caching from PokemonBattleMixin
Problem: NoSuchElementException crash in Targetable.getOppositeOpponent() during battle start (Cobblemon 1.7.3 only).
Root cause: The mixin cached PokemonBattle.getActivePokemon() as a static snapshot (List.copyOf()). In Cobblemon 1.7.3, this method is a lazy iterable that evaluates on each call. During SwitchInstruction processing, the
cached snapshot became stale — the opponent's slot was in transition (old pokemon cleared, new one not yet assigned), so getOppositeOpponent() found no match and threw.
Fix: Removed the getActivePokemon() cache. Cobblemon's lazy iterable now evaluates in real-time, always reflecting current battle state. Other caches (sides, actors, players, isPvP/isPvN/isPvW) are unaffected — they don't change during instruction processing.
Why it only affects 1.7.3: Cobblemon 1.7.1 likely returned direct list references from getActivePokemon(), making the snapshot safe. 1.7.3 changed to a lazily computed iterable, breaking the snapshot approach.
Files
Metadata
Release channel
ReleaseVersion number
4.0.2Loaders
Game versions
1.21.1Environment
Downloads
135Publication date
March 8, 2026 at 10:00 PMPublisher
MarcoErCarrozza
Member


