Cobblemon 1.8.4 Battle Engine & Showdown Architecture

Cobblemon 1.8.4 Battle Engine & Showdown Bridge (67 Classes)

Bytecode-verified architecture reference for all 67 core classes inside com.cobblemon.mod.common.battles (complementing the 80 Showdown tokens on Battle Protocol and 42 AI/catching classes on Battle AI). Covers BattleBuilder (pvp1v1, pvp2v2, pve, pvn), BattleRegistry, all 5 BattleTypes, 9 ShowdownActionResponseType enum decoders & 10 response classes, 7 BattleStartError types, BattleDispatch execution queues, and the GraalShowdownService vs SocketShowdownService JavaScript runners.

Core battles/ Classes
67 (excl. 69 interpreter + 8 AI classes on sister hubs)
BattleBuilder Entries
pvp1v1 · pvp2v2 · pve · pvn
Action Responses
10 Classes · 9 Enum Decoders · 7 Start Errors
Showdown Runners
GraalShowdownService (embedded) · SocketShowdownService (TCP)
Battle Subsystem
Bytecode Kind
API Complexity
Inheritance
Core Battle & Formats · ClassActiveBattlePokemon

Tracks a currently fielded slot on a BattleActor including its BattlePokemon and visual position.

Fields: actor, battlePokemon, battle, position (+1) · Methods: getActor, getBattlePokemon, setBattlePokemon, getBattle (+25)

5 fields · 29 methodsBattle Pipeline →
Start Results & Errors · ClassAlreadyInBattleError

BattleStartError returned when an actor is already participating in another battle.

Fields: actorUUID, name · Methods: getActorUUID, getName, getMessageFor

2 fields · 3 methods7 Start Errors →
Action Responses & Showdown Bridge · ClassBagItemActionResponse

Turn response applying an in-battle BagItem script from a player's inventory.

Fields: bagItem, target, data · Methods: getBagItem, getTarget, getData, isValid (+1)

3 fields · 5 methodsAction Responses →
Core Battle & Formats · ObjectBagItems

DataRegistry loading all 11 data/cobblemon/bag_items/*.js scripts and mapping ItemStacks to in-battle BagItemLike actions.

Fields: id, type, observable, bagItems (+1) · Methods: getId, getType, getObservable, sync (+3)

5 fields · 7 methodsBattle Pipeline →
Start Results & Errors · ClassBattleActorErrors

Aggregates per-actor and general BattleStartErrors for localized chat feedback.

Methods: get, getSize, size, containsKey (+7)

0 fields · 11 methods7 Start Errors →
Core Battle & Formats · ObjectBattleBuilder

Server factory building PvP 1v1 (pvp1v1), PvP 2v2 (pvp2v2), wild PvE (pve), and trainer PvN (pvn) battles with validation.

Methods: pvp1v1, pvp2v2, pve, pvn

0 fields · 4 methodsBattle Pipeline →
Core Battle & Formats · ClassBattleCaptureAction

Server action executing a Poké Ball capture attempt against a wild target inside an active battle.

Fields: battle, targetPokemon, pokeBallEntity, pokemonName · Methods: getBattle, getTargetPokemon, getPokeBallEntity, getPokemonName (+1)

4 fields · 5 methodsBattle Pipeline →
Core Battle & Formats · ClassBattleFormat

Serializable battle format specification bundling mod, BattleType, gen, adjustLevel, and ruleSet strings.

Fields: mod, battleType, ruleSet, gen (+6) · Methods: getMod, getBattleType, getRuleSet, setRuleSet (+5)

10 fields · 9 methodsBattle Pipeline →
Core Battle & Formats · ObjectBattleRegistry

Singleton tracking all active PokemonBattle instances by UUID, packing Showdown teams, ticking battles, and handling disconnects.

Fields: gson, battleMap · Methods: getGson, onServerStarted, onPlayerDisconnect, packTeam (+7)

2 fields · 11 methodsBattle Pipeline →
Core Battle & Formats · ObjectBattleRules

Constants defining all 10 official Showdown ruleset strings (Obtainable, +Past, +Unobtainable, Bag Clause, Wild Alpha, etc.).

Fields: OBTAINABLE, PAST, UNOBTAINABLE, BAG_CLAUSE (+6)

10 fields · 0 methodsBattle Pipeline →
Core Battle & Formats · ClassBattleSide

Represents one side of a PokemonBattle holding BattleActors, active slots, and side-wide state.

Fields: actors, battle, contextManager · Methods: getActors, getActivePokemon, getBattle, setBattle (+5)

3 fields · 9 methodsBattle Pipeline →
Start Results & Errors · InterfaceBattleStartError

Interface for structured validation failures preventing battle launch.

Methods: getMessageFor

0 fields · 1 method7 Start Errors →
Start Results & Errors · AbstractBattleStartResult

Sealed result wrapper returned by BattleBuilder and BattleRegistry.startBattle (SuccessfulBattleStart or ErroredBattleStart).

Methods: ifSuccessful, ifErrored

0 fields · 2 methods7 Start Errors →
Core Battle & Formats · InterfaceBattleType

Interface defining a battle format's Showdown name, displayName, actorsPerSide, and slotsPerActor.

Methods: getName, getDisplayName, getActorsPerSide, getSlotsPerActor (+2)

0 fields · 6 methodsBattle Pipeline →
Core Battle & Formats · ObjectBattleTypes

Registry defining the 5 built-in BattleType formats: SINGLES (1×1), DOUBLES (1×2), TRIPLES (1×3), MULTI (2×1), and ROYAL (freeforall).

Fields: SINGLES, DOUBLES, TRIPLES, MULTI (+1) · Methods: getSINGLES, getDOUBLES, getTRIPLES, getMULTI (+2)

5 fields · 6 methodsBattle Pipeline →
Start Results & Errors · ClassBusyError

BattleStartError returned when a player or Pokémon is busy (e.g. trading, evolving, or locked).

Fields: targetName · Methods: getTargetName, getMessageFor

1 field · 2 methods7 Start Errors →
Start Results & Errors · ClassCanceledError

BattleStartError returned when a CobblemonEvents.BATTLE_STARTED_PRE listener cancels the battle.

Fields: reason · Methods: getReason, getMessageFor

1 field · 2 methods7 Start Errors →
Core Battle & Formats · ObjectChallengeManager

Manages timed PvP battle challenge requests and multi-battle invitations between players.

Fields: MAX_BATTLE_RADIUS, selectedLead · Methods: expirationPacket, notificationPacket, onDecline, onSend (+6)

2 fields · 10 methodsBattle Pipeline →
Action Responses & Showdown Bridge · ClassDefaultActionResponse

Fallback response submitting Showdown's default action (used by timeouts/fallbacks).

Methods: isValid, toShowdownString

0 fields · 2 methodsAction Responses →
Start Results & Errors · ClassErroredBattleStart

BattleStartResult holding BattleActorErrors when battle creation fails validation.

Fields: generalErrors, participantErrors · Methods: getGeneralErrors, getParticipantErrors, ifErrored, forError (+8)

2 fields · 12 methods7 Start Errors →
Action Responses & Showdown Bridge · ClassHealItemActionResponse

Specialized BagItemActionResponse for healing/status items applied to a party target.

Fields: item · Methods: getItem, setItem, saveToBuffer, loadFromBuffer (+2)

1 field · 6 methodsAction Responses →
Core Battle & Formats · ClassInBattleGimmickMove

Special move descriptor for gimmick-enabled moves inside Showdown action requests.

Fields: move, target, disabled · Methods: getMove, setMove, getTarget, setTarget (+3)

3 fields · 7 methodsBattle Pipeline →
Core Battle & Formats · ClassInBattleMove

Deserialized move option inside a ShowdownActionRequest with id, pp, maxpp, target, disabled, and gimmick flags.

Fields: id, move, pp, maxpp (+3) · Methods: getId, setId, getMove, setMove (+14)

7 fields · 18 methodsBattle Pipeline →
Start Results & Errors · ClassIncorrectActorCountError

BattleStartError returned when actor count violates the BattleType actorsPerSide requirement.

Fields: requiredCount, hadCount · Methods: getRequiredCount, getHadCount, getMessageFor

2 fields · 3 methods7 Start Errors →
Start Results & Errors · ClassInsufficientPokemonError

BattleStartError returned when an actor lacks enough healthy Pokémon for the BattleType slot count.

Fields: actorEntity, requiredCount, hadCount · Methods: getActorEntity, getRequiredCount, getHadCount, getMessageFor

3 fields · 4 methods7 Start Errors →
Action Responses & Showdown Bridge · ClassMoveActionResponse

Turn response selecting a move slot, optional target PNX, and gimmick flag.

Fields: moveName, targetPnx, gimmickID, VALID_GIMMICK_IDS · Methods: getMoveName, setMoveName, getTargetPnx, setTargetPnx (+6)

4 fields · 10 methodsAction Responses →
Core Battle & Formats · EnumMoveTarget

Enum mapping Showdown move target scopes (self, normal, allAdjacent, allySide, foeSide, etc.) to valid ActiveBattlePokemon targets.

Fields: targetList, VALUES, any, all (+13) · Methods: getTargetList

17 fields · 1 methodBattle Pipeline →
Start Results & Errors · ClassNoPartyError

BattleStartError returned when an actor has an empty or all-fainted party.

Fields: npc · Methods: getNpc, getMessageFor

1 field · 2 methods7 Start Errors →
Action Responses & Showdown Bridge · ObjectPassActionResponse

Turn response passing an active slot's turn when required by Showdown.

Methods: isValid, toShowdownString

0 fields · 2 methodsAction Responses →
Action Responses & Showdown Bridge · ClassShiftActionResponse

Turn response shifting a Pokémon's position in Triples battles.

Methods: isValid, toShowdownString

0 fields · 2 methodsAction Responses →
Action Responses & Showdown Bridge · ClassShowdownActionRequest

Deserialized Showdown |request| JSON payload containing active moves, forceSwitch flags, side roster, and teamPreview.

Fields: wait, active, forceSwitch, noCancel (+1) · Methods: getWait, setWait, getActive, setActive (+10)

5 fields · 14 methodsAction Responses →
Action Responses & Showdown Bridge · AbstractShowdownActionResponse

Abstract base class for every player or AI turn decision serialized back to Showdown.

Fields: type · Methods: getType, saveToBuffer, loadFromBuffer, isValid (+1)

1 field · 5 methodsAction Responses →
Action Responses & Showdown Bridge · EnumShowdownActionResponseType

Nine-value enum (SWITCH, MOVE, DEFAULT, FORCE_PASS, PASS, SHIFT, HEAL_ITEM, FORFEIT, FLEE_ATTEMPT) with network decoders.

Values: SWITCH, MOVE, DEFAULT, FORCE_PASS, PASS, SHIFT · Methods: getLoader

1 field · 1 methodAction Responses →
Action Responses & Showdown Bridge · ObjectShowdownInterpreter

Central protocol dispatcher mapping 80 unique Showdown protocol tokens to 65 instruction classes.

Fields: lastCauser, updateInstructionParser, splitInstructionParser, sideInstructionParser · Methods: getLastCauser, interpretMessage, interpret, broadcastOptionalAbility (+6)

4 fields · 10 methodsAction Responses →
Action Responses & Showdown Bridge · ClassShowdownMoveset

Container for a Pokémon's available InBattleMoves and gimmick options during a turn.

Fields: moves, trapped, canMegaEvo, canUltraBurst (+5) · Methods: getMoves, setMoves, getTrapped, setTrapped (+19)

9 fields · 23 methodsAction Responses →
Action Responses & Showdown Bridge · ObjectShowdownMovesetAdapter

Gson TypeAdapter deserializing Showdown move request JSON arrays.

Fields: gson · Methods: getGson, deserialize

1 field · 2 methodsAction Responses →
Action Responses & Showdown Bridge · ClassShowdownPokemon

Showdown side-slot snapshot (ident, details, condition HP/status, active, stats, moves, baseAbility, item, pokeball).

Fields: ident, details, condition, active (+9) · Methods: getIdent, setIdent, getDetails, setDetails (+22)

13 fields · 26 methodsAction Responses →
Action Responses & Showdown Bridge · ClassShowdownSide

Deserialized side roster sent inside a ShowdownActionRequest.

Fields: name, id, pokemon · Methods: getName, setName, getId, setId (+4)

3 fields · 8 methodsAction Responses →
Action Responses & Showdown Bridge · ClassShowdownThread

Dedicated daemon worker thread executing ShowdownService JavaScript engine calls off the main server tick thread.

Fields: latch, whenReady · Methods: launch, queue, run

2 fields · 3 methodsAction Responses →
Start Results & Errors · ClassSuccessfulBattleStart

BattleStartResult carrying the newly started PokemonBattle instance.

Fields: battle · Methods: getBattle, ifSuccessful

1 field · 2 methods7 Start Errors →
Action Responses & Showdown Bridge · ClassSwitchActionResponse

Turn response swapping an active slot to a benched party Pokémon by UUID.

Fields: newPokemonId · Methods: getNewPokemonId, setNewPokemonId, saveToBuffer, loadFromBuffer (+2)

1 field · 6 methodsAction Responses →
Core Battle & Formats · InterfaceTargetable

Interface implemented by ActiveBattlePokemon and BattleSide slots that can receive move targeting.

Methods: getAllActivePokemon, getActorPokemon, getSidePokemon, getFormat (+13)

0 fields · 17 methodsBattle Pipeline →
Core Battle & Formats · ObjectTeamManager

Manages multi-battle team invites and paired player squads prior to starting Multi battles.

Fields: MAX_TEAM_MEMBER_COUNT, playerToTeam, multiBattleTeams · Methods: getTeam, notificationPacket, expirationPacket, disbandTeam (+7)

3 fields · 11 methodsBattle Pipeline →
Actors & Battle Pokémon · ClassPlayerBattleActor

BattleActor representing a ServerPlayer with party storage, inventory bag access, and client packet sync.

Fields: initialPos, battleTheme, type · Methods: getInitialPos, getEntity, getBattleTheme, setBattleTheme (+6)

3 fields · 10 methods42 Battle AI Classes →
Actors & Battle Pokémon · ClassPokemonBattleActor

BattleActor representing a single wild PokemonEntity driven by a BattleAI implementation.

Fields: pokemon, fleeDistance, initialPos, type · Methods: getPokemon, getFleeDistance, getInitialPos, getName (+5)

4 fields · 9 methods42 Battle AI Classes →
Actors & Battle Pokémon · ClassTrainerBattleActor

BattleActor representing an NPC trainer with a fixed party, name, and configurable BattleAI skill level.

Fields: trainerName, type · Methods: getTrainerName, getName, nameOwned, getType

2 fields · 4 methods42 Battle AI Classes →
Dispatch & Instructions · InterfaceActionEffectInstruction

Contract for instructions that trigger a client-side ActionEffect timeline animation and optional battle hold.

Methods: getFuture, setFuture, getHolds, setHolds (+6)

0 fields · 10 methods80 Protocol Tokens →
Dispatch & Instructions · InterfaceBattleDispatch

Interface representing a single queued step in a PokemonBattle's server-to-client execution queue.

Methods: invoke

0 fields · 1 method80 Protocol Tokens →
Dispatch & Instructions · InterfaceCauserInstruction

Marker interface for instructions that record a causing effect/move for subsequent battle log messages.

0 fields · 0 methods80 Protocol Tokens →
Dispatch & Instructions · InterfaceDispatchResult

Interface governing when a BattleDispatch finishes (GO immediately, WaitDispatch timed delay, or UntilDispatch predicate).

Methods: canProceed

0 fields · 1 method80 Protocol Tokens →
Dispatch & Instructions · ClassInstructionSet

Ordered bundle of InterpreterInstructions parsed from one Showdown message batch and dispatched sequentially.

Fields: instructions · Methods: getInstructions, getSubsequentInstructions, getPreviousInstructions, getMostRecentInstruction (+4)

1 field · 8 methods80 Protocol Tokens →
Dispatch & Instructions · ClassUntilDispatch

DispatchResult pausing battle progression until a boolean predicate returns true.

Fields: condition, afterAction · Methods: getCondition, getAfterAction, setAfterAction, canProceed (+1)

2 fields · 5 methods80 Protocol Tokens →
Dispatch & Instructions · ClassWaitDispatch

DispatchResult pausing battle progression for a fixed real-time duration in seconds.

Fields: readyTime · Methods: getReadyTime, canProceed

1 field · 2 methods80 Protocol Tokens →
Actors & Battle Pokémon · ClassBattleMove

In-battle wrapper tracking a Move's temporary PP, disabled state, and Showdown identifier.

Fields: move, disabled · Methods: getMove, getDisabled, setDisabled

2 fields · 3 methods42 Battle AI Classes →
Actors & Battle Pokémon · ClassBattlePokemon

In-battle wrapper around a Pokemon instance tracking UUID, stat changes, health, held item, and post-battle sync.

Fields: originalPokemon, effectedPokemon, postBattlePokemonOperations, postBattleEntityOperations (+9) · Methods: getOriginalPokemon, getEffectedPokemon, getPostBattlePokemonOperations, setPostBattlePokemonOperations (+27)

13 fields · 31 methods42 Battle AI Classes →
Showdown Runners · InterfaceShowdownService

Service interface bridging Cobblemon's JVM server with the Pokémon Showdown JavaScript battle engine.

Methods: openConnection, closeConnection, startBattle, endBattle (+7)

0 fields · 11 methodsShowdown Mod v19 →
Showdown Runners · ObjectGraalLogger

SLF4J logging bridge capturing GraalJS Showdown stdout/stderr output.

Methods: publish, flush, close

0 fields · 3 methodsShowdown Mod v19 →
Showdown Runners · ClassGraalShowdownService

Default embedded GraalJS ShowdownService running Pokémon Showdown in-process inside the Minecraft JVM.

Fields: context, sendBattleMessageFunction, unbundler, gson · Methods: getContext, setContext, getSendBattleMessageFunction, setSendBattleMessageFunction (+18)

4 fields · 22 methodsShowdown Mod v19 →
Showdown Runners · ClassGraalShowdownUnbundler

Extracts data/cobblemon/showdown.zip to the runtime directory when showdownVersion changes.

Fields: gson · Methods: attemptUnbundle, loadShowdownMetadata, readShowdownMetadata

1 field · 3 methodsShowdown Mod v19 →
Showdown Runners · ClassSocketShowdownService

Alternative TCP socket ShowdownService client for connecting to an external Node.js Showdown process.

Fields: host, port, localPort, socket (+3) · Methods: getHost, getPort, getLocalPort, getGson (+16)

7 fields · 20 methodsShowdown Mod v19 →

Battle Launch Pipeline, All 5 BattleTypes & Showdown Runners

10 BattleRules & 8 Statuses →

Every Cobblemon 1.8.4 battle starts through BattleBuilder (pvp1v1, pvp2v2, pve, or pvn), validates actors into a BattleStartResult (SuccessfulBattleStart or ErroredBattleStart), registers the UUID in BattleRegistry.battleMap, packs teams via BattleRegistry.packTeam(), and streams commands to ShowdownService on the dedicated ShowdownThread (default GraalShowdownService extracting showdown.zip via GraalShowdownUnbundler, or optional external Node.js SocketShowdownService). Incoming protocol batches parse into an InstructionSet queued through BattleDispatch (WaitDispatch / UntilDispatch).

BattleTypes FieldShowdown Format IDActors / SideSlots / ActorActive Field Size
BattleTypes.SINGLESsingles111 active slot per side
BattleTypes.DOUBLESdoubles122 active slots per side
BattleTypes.TRIPLEStriples133 active slots per side
BattleTypes.MULTImulti212 active slots per side
BattleTypes.ROYALfreeforall111 active slot per side

All 10 ShowdownActionResponse Classes (9 Enum Types) & 7 Start Errors

Bag Item Scripts →

ShowdownActionResponseType defines 9 network decoder types (SWITCH, MOVE, DEFAULT, FORCE_PASS, PASS, SHIFT, HEAL_ITEM, FORFEIT, FLEE_ATTEMPT) backing 10 ShowdownActionResponse subclasses (including BagItemActionResponse for the 11 BagItems scripts and BattleCaptureAction for Poké Ball throws). Failed battle starts return one of 7 structured BattleStartError types.

Response ClassParent ClassVerified Turn Behaviour
BagItemActionResponseShowdownActionResponseTurn response applying an in-battle BagItem script from a player's inventory.
DefaultActionResponseShowdownActionResponseFallback response submitting Showdown's default action (used by timeouts/fallbacks).
FleeAttemptActionResponseShowdownActionResponseTurn response attempting to flee a wild PvE encounter.
ForcePassActionResponseShowdownActionResponseServer-generated forced pass action when a slot cannot act.
ForfeitActionResponseShowdownActionResponseTurn response forfeiting a battle immediately.
HealItemActionResponseShowdownActionResponseSpecialized BagItemActionResponse for healing/status items applied to a party target.
MoveActionResponseShowdownActionResponseTurn response selecting a move slot, optional target PNX, and gimmick flag.
PassActionResponseShowdownActionResponseTurn response passing an active slot's turn when required by Showdown.
ShiftActionResponseShowdownActionResponseTurn response shifting a Pokémon's position in Triples battles.
SwitchActionResponseShowdownActionResponseTurn response swapping an active slot to a benched party Pokémon by UUID.
BattleStartError ClassRejection Condition
AlreadyInBattleErrorBattleStartError returned when an actor is already participating in another battle.
BusyErrorBattleStartError returned when a player or Pokémon is busy (e.g. trading, evolving, or locked).
CanceledErrorBattleStartError returned when a CobblemonEvents.BATTLE_STARTED_PRE listener cancels the battle.
CommonBattleStartErrorReusable BattleStartError implementation for common rule/format rejections.
IncorrectActorCountErrorBattleStartError returned when actor count violates the BattleType actorsPerSide requirement.
InsufficientPokemonErrorBattleStartError returned when an actor lacks enough healthy Pokémon for the BattleType slot count.
NoPartyErrorBattleStartError returned when an actor has an empty or all-fainted party.

Complete 67-Class battles/ Bytecode Reference

Class & PackageSubsystem / KindInheritanceFields / MethodsBytecode Summary
ActiveBattlePokemon
battles.ActiveBattlePokemon
Core Battle & Formats
Class
—
implements Targetable
5 / 29Tracks a currently fielded slot on a BattleActor including its BattlePokemon and visual position.
Fields: actor: BattleActor, battlePokemon: BattlePokemon, battle: PokemonBattle, position: Pair<? extends ServerLevel, ? extends Vec3> · Methods: getActor, getBattlePokemon, setBattlePokemon, getBattle, getSide
AlreadyInBattleError
battles.AlreadyInBattleError
Start Results & Errors
Class
—
implements BattleStartError
2 / 3BattleStartError returned when an actor is already participating in another battle.
Fields: actorUUID: UUID, name: Component · Methods: getActorUUID, getName, getMessageFor
BagItemActionResponse
battles.BagItemActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse3 / 5Turn response applying an in-battle BagItem script from a player's inventory.
Fields: bagItem: BagItem, target: BattlePokemon, data: String · Methods: getBagItem, getTarget, getData, isValid, toShowdownString
BagItems
battles.BagItems
Core Battle & Formats
Object
—
implements DataRegistry
5 / 7DataRegistry loading all 11 data/cobblemon/bag_items/*.js scripts and mapping ItemStacks to in-battle BagItemLike actions.
Fields: id: ResourceLocation, type: PackType, observable: SimpleObservable<BagItems>, bagItems: PrioritizedList<BagItemLike> · Methods: getId, getType, getObservable, sync, getBagItems
BattleActorErrors
battles.BattleActorErrors
Start Results & Errors
Class
HashMap<BattleActor,0 / 11Aggregates per-actor and general BattleStartErrors for localized chat feedback.
Methods: get, getSize, size, containsKey, remove
BattleBuilder
battles.BattleBuilder
Core Battle & Formats
Object
—0 / 4Server factory building PvP 1v1 (pvp1v1), PvP 2v2 (pvp2v2), wild PvE (pve), and trainer PvN (pvn) battles with validation.
Methods: pvp1v1, pvp2v2, pve, pvn
BattleCaptureAction
battles.BattleCaptureAction
Core Battle & Formats
Class
—4 / 5Server action executing a Poké Ball capture attempt against a wild target inside an active battle.
Fields: battle: PokemonBattle, targetPokemon: ActiveBattlePokemon, pokeBallEntity: EmptyPokeBallEntity, pokemonName: MutableComponent · Methods: getBattle, getTargetPokemon, getPokeBallEntity, getPokemonName, attach
BattleFormat
battles.BattleFormat
Core Battle & Formats
Class
—10 / 9Serializable battle format specification bundling mod, BattleType, gen, adjustLevel, and ruleSet strings.
Fields: mod: String, battleType: BattleType, ruleSet: Set<String>, gen: int · Methods: getMod, getBattleType, getRuleSet, setRuleSet, getGen
BattleRegistry
battles.BattleRegistry
Core Battle & Formats
Object
—2 / 11Singleton tracking all active PokemonBattle instances by UUID, packing Showdown teams, ticking battles, and handling disconnects.
Fields: gson: Gson, battleMap: concurrent.ConcurrentHashMap<UUID, PokemonBattle> · Methods: getGson, onServerStarted, onPlayerDisconnect, packTeam, startShowdown
BattleRules
battles.BattleRules
Core Battle & Formats
Object
—10 / 0Constants defining all 10 official Showdown ruleset strings (Obtainable, +Past, +Unobtainable, Bag Clause, Wild Alpha, etc.).
Fields: OBTAINABLE: String, PAST: String, UNOBTAINABLE: String, BAG_CLAUSE: String
BattleSide
battles.BattleSide
Core Battle & Formats
Class
—3 / 9Represents one side of a PokemonBattle holding BattleActors, active slots, and side-wide state.
Fields: actors: BattleActor[], battle: PokemonBattle, contextManager: ContextManager · Methods: getActors, getActivePokemon, getBattle, setBattle, getContextManager
BattleStartError
battles.BattleStartError
Start Results & Errors
Interface
—0 / 1Interface for structured validation failures preventing battle launch.
Methods: getMessageFor
BattleStartResult
battles.BattleStartResult
Start Results & Errors
Abstract
—0 / 2Sealed result wrapper returned by BattleBuilder and BattleRegistry.startBattle (SuccessfulBattleStart or ErroredBattleStart).
Methods: ifSuccessful, ifErrored
BattleType
battles.BattleType
Core Battle & Formats
Interface
—0 / 6Interface defining a battle format's Showdown name, displayName, actorsPerSide, and slotsPerActor.
Methods: getName, getDisplayName, getActorsPerSide, getSlotsPerActor, getPokemonPerSide
BattleTypes
battles.BattleTypes
Core Battle & Formats
Object
—5 / 6Registry defining the 5 built-in BattleType formats: SINGLES (1×1), DOUBLES (1×2), TRIPLES (1×3), MULTI (2×1), and ROYAL (freeforall).
Fields: SINGLES: BattleType, DOUBLES: BattleType, TRIPLES: BattleType, MULTI: BattleType · Methods: getSINGLES, getDOUBLES, getTRIPLES, getMULTI, getROYAL
BusyError
battles.BusyError
Start Results & Errors
Class
—
implements BattleStartError
1 / 2BattleStartError returned when a player or Pokémon is busy (e.g. trading, evolving, or locked).
Fields: targetName: Component · Methods: getTargetName, getMessageFor
CanceledError
battles.CanceledError
Start Results & Errors
Class
—
implements BattleStartError
1 / 2BattleStartError returned when a CobblemonEvents.BATTLE_STARTED_PRE listener cancels the battle.
Fields: reason: MutableComponent · Methods: getReason, getMessageFor
ChallengeManager
battles.ChallengeManager
Core Battle & Formats
Object
RequestManager<ChallengeManager$BattleChallenge>2 / 10Manages timed PvP battle challenge requests and multi-battle invitations between players.
Fields: MAX_BATTLE_RADIUS: double, selectedLead: Map<UUID, UUID> · Methods: expirationPacket, notificationPacket, onDecline, onSend, onAccept
CommonBattleStartError
battles.CommonBattleStartError
Start Results & Errors
Enum
—
implements BattleStartError
0 / 0Reusable BattleStartError implementation for common rule/format rejections.
DefaultActionResponse
battles.DefaultActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse0 / 2Fallback response submitting Showdown's default action (used by timeouts/fallbacks).
Methods: isValid, toShowdownString
ErroredBattleStart
battles.ErroredBattleStart
Start Results & Errors
Class
BattleStartResult2 / 12BattleStartResult holding BattleActorErrors when battle creation fails validation.
Fields: generalErrors: Set<BattleStartError>, participantErrors: BattleActorErrors · Methods: getGeneralErrors, getParticipantErrors, ifErrored, forError, sendTo
FleeAttemptActionResponse
battles.FleeAttemptActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse0 / 2Turn response attempting to flee a wild PvE encounter.
Methods: isValid, toShowdownString
ForcePassActionResponse
battles.ForcePassActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse0 / 2Server-generated forced pass action when a slot cannot act.
Methods: isValid, toShowdownString
ForfeitActionResponse
battles.ForfeitActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse0 / 2Turn response forfeiting a battle immediately.
Methods: isValid, toShowdownString
HealItemActionResponse
battles.HealItemActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse1 / 6Specialized BagItemActionResponse for healing/status items applied to a party target.
Fields: item: String · Methods: getItem, setItem, saveToBuffer, loadFromBuffer, isValid
InBattleGimmickMove
battles.InBattleGimmickMove
Core Battle & Formats
Class
—3 / 7Special move descriptor for gimmick-enabled moves inside Showdown action requests.
Fields: move: String, target: MoveTarget, disabled: boolean · Methods: getMove, setMove, getTarget, setTarget, getDisabled
InBattleMove
battles.InBattleMove
Core Battle & Formats
Class
—7 / 18Deserialized move option inside a ShowdownActionRequest with id, pp, maxpp, target, disabled, and gimmick flags.
Fields: id: String, move: String, pp: int, maxpp: int · Methods: getId, setId, getMove, setMove, getPp
IncorrectActorCountError
battles.IncorrectActorCountError
Start Results & Errors
Class
—
implements BattleStartError
2 / 3BattleStartError returned when actor count violates the BattleType actorsPerSide requirement.
Fields: requiredCount: int, hadCount: int · Methods: getRequiredCount, getHadCount, getMessageFor
InsufficientPokemonError
battles.InsufficientPokemonError
Start Results & Errors
Class
—
implements BattleStartError
3 / 4BattleStartError returned when an actor lacks enough healthy Pokémon for the BattleType slot count.
Fields: actorEntity: Entity, requiredCount: int, hadCount: int · Methods: getActorEntity, getRequiredCount, getHadCount, getMessageFor
MoveActionResponse
battles.MoveActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse4 / 10Turn response selecting a move slot, optional target PNX, and gimmick flag.
Fields: moveName: String, targetPnx: String, gimmickID: String, VALID_GIMMICK_IDS: Set<String> · Methods: getMoveName, setMoveName, getTargetPnx, setTargetPnx, getGimmickID
MoveTarget
battles.MoveTarget
Core Battle & Formats
Enum
—17 / 1Enum mapping Showdown move target scopes (self, normal, allAdjacent, allySide, foeSide, etc.) to valid ActiveBattlePokemon targets.
Fields: targetList: Function1<Targetable, List<Targetable>>, VALUES: MoveTarget[], any: MoveTarget, all: MoveTarget · Methods: getTargetList
NoPartyError
battles.NoPartyError
Start Results & Errors
Class
—
implements BattleStartError
1 / 2BattleStartError returned when an actor has an empty or all-fainted party.
Fields: npc: NPCEntity · Methods: getNpc, getMessageFor
PassActionResponse
battles.PassActionResponse
Action Responses & Showdown Bridge
Object
ShowdownActionResponse0 / 2Turn response passing an active slot's turn when required by Showdown.
Methods: isValid, toShowdownString
ShiftActionResponse
battles.ShiftActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse0 / 2Turn response shifting a Pokémon's position in Triples battles.
Methods: isValid, toShowdownString
ShowdownActionRequest
battles.ShowdownActionRequest
Action Responses & Showdown Bridge
Class
—5 / 14Deserialized Showdown |request| JSON payload containing active moves, forceSwitch flags, side roster, and teamPreview.
Fields: wait: boolean, active: List<ShowdownMoveset>, forceSwitch: List<Boolean>, noCancel: boolean · Methods: getWait, setWait, getActive, setActive, getForceSwitch
ShowdownActionResponse
battles.ShowdownActionResponse
Action Responses & Showdown Bridge
Abstract
—1 / 5Abstract base class for every player or AI turn decision serialized back to Showdown.
Fields: type: ShowdownActionResponseType · Methods: getType, saveToBuffer, loadFromBuffer, isValid, toShowdownString
ShowdownActionResponseType
battles.ShowdownActionResponseType
Action Responses & Showdown Bridge
Enum
—1 / 1Nine-value enum (SWITCH, MOVE, DEFAULT, FORCE_PASS, PASS, SHIFT, HEAL_ITEM, FORFEIT, FLEE_ATTEMPT) with network decoders.
Enum: SWITCH, MOVE, DEFAULT, FORCE_PASS, PASS, SHIFT · Methods: getLoader
ShowdownInterpreter
battles.ShowdownInterpreter
Action Responses & Showdown Bridge
Object
—4 / 10Central protocol dispatcher mapping 80 unique Showdown protocol tokens to 65 instruction classes.
Fields: lastCauser: Map<UUID, BattleMessage>, updateInstructionParser: Map<String, Function4<PokemonBattle, InstructionSet, BattleMessage, Iterator<BattleMessage>, InterpreterInstruction>>, splitInstructionParser: Map<String, Function6<PokemonBattle, BattleActor, InstructionSet, BattleMessage, BattleMessage, Iterator<BattleMessage>, InterpreterInstruction>>, sideInstructionParser: Map<String, Function4<PokemonBattle, BattleActor, InstructionSet, BattleMessage, InterpreterInstruction>> · Methods: getLastCauser, interpretMessage, interpret, broadcastOptionalAbility, broadcastAbility
ShowdownMoveset
battles.ShowdownMoveset
Action Responses & Showdown Bridge
Class
—9 / 23Container for a Pokémon's available InBattleMoves and gimmick options during a turn.
Fields: moves: List<InBattleMove>, trapped: boolean, canMegaEvo: boolean, canUltraBurst: boolean · Methods: getMoves, setMoves, getTrapped, setTrapped, getCanMegaEvo
ShowdownMovesetAdapter
battles.ShowdownMovesetAdapter
Action Responses & Showdown Bridge
Object
—
implements JsonDeserializer<ShowdownMoveset>
1 / 2Gson TypeAdapter deserializing Showdown move request JSON arrays.
Fields: gson: Gson · Methods: getGson, deserialize
ShowdownPokemon
battles.ShowdownPokemon
Action Responses & Showdown Bridge
Class
—13 / 26Showdown side-slot snapshot (ident, details, condition HP/status, active, stats, moves, baseAbility, item, pokeball).
Fields: ident: String, details: String, condition: String, active: boolean · Methods: getIdent, setIdent, getDetails, setDetails, getCondition
ShowdownSide
battles.ShowdownSide
Action Responses & Showdown Bridge
Class
—3 / 8Deserialized side roster sent inside a ShowdownActionRequest.
Fields: name: UUID, id: String, pokemon: List<ShowdownPokemon> · Methods: getName, setName, getId, setId, getPokemon
ShowdownThread
battles.ShowdownThread
Action Responses & Showdown Bridge
Class
Thread2 / 3Dedicated daemon worker thread executing ShowdownService JavaScript engine calls off the main server tick thread.
Fields: latch: concurrent.CountDownLatch, whenReady: Queue<Function1<ShowdownService, Unit>> · Methods: launch, queue, run
SuccessfulBattleStart
battles.SuccessfulBattleStart
Start Results & Errors
Class
BattleStartResult1 / 2BattleStartResult carrying the newly started PokemonBattle instance.
Fields: battle: PokemonBattle · Methods: getBattle, ifSuccessful
SwitchActionResponse
battles.SwitchActionResponse
Action Responses & Showdown Bridge
Class
ShowdownActionResponse1 / 6Turn response swapping an active slot to a benched party Pokémon by UUID.
Fields: newPokemonId: UUID · Methods: getNewPokemonId, setNewPokemonId, saveToBuffer, loadFromBuffer, isValid
Targetable
battles.Targetable
Core Battle & Formats
Interface
—0 / 17Interface implemented by ActiveBattlePokemon and BattleSide slots that can receive move targeting.
Methods: getAllActivePokemon, getActorPokemon, getSidePokemon, getFormat, isAllied
TeamManager
battles.TeamManager
Core Battle & Formats
Object
RequestManager<TeamManager$TeamRequest>3 / 11Manages multi-battle team invites and paired player squads prior to starting Multi battles.
Fields: MAX_TEAM_MEMBER_COUNT: int, playerToTeam: Map<UUID, TeamManager$MultiBattleTeam>, multiBattleTeams: Map<UUID, TeamManager$MultiBattleTeam> · Methods: getTeam, notificationPacket, expirationPacket, disbandTeam, removeTeamMember
MultiPokemonBattleActor
battles.actor.MultiPokemonBattleActor
Actors & Battle Pokémon
Class
AIBattleActor1 / 3BattleActor controlling multiple wild Pokémon entities together on one side.
Fields: type: ActorType · Methods: getName, nameOwned, getType
PlayerBattleActor
battles.actor.PlayerBattleActor
Actors & Battle Pokémon
Class
BattleActor
implements EntityBackedBattleActor<ServerPlayer>
3 / 10BattleActor representing a ServerPlayer with party storage, inventory bag access, and client packet sync.
Fields: initialPos: Vec3, battleTheme: ResourceLocation, type: ActorType · Methods: getInitialPos, getEntity, getBattleTheme, setBattleTheme, getName
PokemonBattleActor
battles.actor.PokemonBattleActor
Actors & Battle Pokémon
Class
AIBattleActor
implements EntityBackedBattleActor<PokemonEntity>, FleeableBattleActor
4 / 9BattleActor representing a single wild PokemonEntity driven by a BattleAI implementation.
Fields: pokemon: BattlePokemon, fleeDistance: float, initialPos: Vec3, type: ActorType · Methods: getPokemon, getFleeDistance, getInitialPos, getName, nameOwned
TrainerBattleActor
battles.actor.TrainerBattleActor
Actors & Battle Pokémon
Class
AIBattleActor2 / 4BattleActor representing an NPC trainer with a fixed party, name, and configurable BattleAI skill level.
Fields: trainerName: String, type: ActorType · Methods: getTrainerName, getName, nameOwned, getType
ActionEffectInstruction
battles.dispatch.ActionEffectInstruction
Dispatch & Instructions
Interface
InterpreterInstruction0 / 10Contract for instructions that trigger a client-side ActionEffect timeline animation and optional battle hold.
Methods: getFuture, setFuture, getHolds, setHolds, getId
BattleDispatch
battles.dispatch.BattleDispatch
Dispatch & Instructions
Interface
—0 / 1Interface representing a single queued step in a PokemonBattle's server-to-client execution queue.
Methods: invoke
CauserInstruction
battles.dispatch.CauserInstruction
Dispatch & Instructions
Interface
—0 / 0Marker interface for instructions that record a causing effect/move for subsequent battle log messages.
DispatchResult
battles.dispatch.DispatchResult
Dispatch & Instructions
Interface
—0 / 1Interface governing when a BattleDispatch finishes (GO immediately, WaitDispatch timed delay, or UntilDispatch predicate).
Methods: canProceed
DispatchResultKt
battles.dispatch.DispatchResultKt
Dispatch & Instructions
Class
—1 / 1Class in Cobblemon 1.8.4 battles/dispatch (1 field, 1 method).
Fields: GO: DispatchResult · Methods: getGO
InstructionSet
battles.dispatch.InstructionSet
Dispatch & Instructions
Class
—1 / 8Ordered bundle of InterpreterInstructions parsed from one Showdown message batch and dispatched sequentially.
Fields: instructions: List<InterpreterInstruction> · Methods: getInstructions, getSubsequentInstructions, getPreviousInstructions, getMostRecentInstruction, findInstructionsCausedBy
InterpreterInstruction
battles.dispatch.InterpreterInstruction
Dispatch & Instructions
Interface
—0 / 1Contract for Showdown protocol instructions invoked against a PokemonBattle.
Methods: invoke
UntilDispatch
battles.dispatch.UntilDispatch
Dispatch & Instructions
Class
—
implements DispatchResult
2 / 5DispatchResult pausing battle progression until a boolean predicate returns true.
Fields: condition: Function0<Boolean>, afterAction: Function0<Unit> · Methods: getCondition, getAfterAction, setAfterAction, canProceed, andThen
WaitDispatch
battles.dispatch.WaitDispatch
Dispatch & Instructions
Class
—
implements DispatchResult
1 / 2DispatchResult pausing battle progression for a fixed real-time duration in seconds.
Fields: readyTime: long · Methods: getReadyTime, canProceed
BattleMove
battles.pokemon.BattleMove
Actors & Battle Pokémon
Class
—2 / 3In-battle wrapper tracking a Move's temporary PP, disabled state, and Showdown identifier.
Fields: move: Move, disabled: boolean · Methods: getMove, getDisabled, setDisabled
BattlePokemon
battles.pokemon.BattlePokemon
Actors & Battle Pokémon
Class
—13 / 31In-battle wrapper around a Pokemon instance tracking UUID, stat changes, health, held item, and post-battle sync.
Fields: originalPokemon: Pokemon, effectedPokemon: Pokemon, postBattlePokemonOperations: List<Function1<BattlePokemon, Unit>>, postBattleEntityOperations: List<Function1<PokemonEntity, Unit>> · Methods: getOriginalPokemon, getEffectedPokemon, getPostBattlePokemonOperations, setPostBattlePokemonOperations, getPostBattleEntityOperations
ShowdownService
battles.runner.ShowdownService
Showdown Runners
Interface
—0 / 11Service interface bridging Cobblemon's JVM server with the Pokémon Showdown JavaScript battle engine.
Methods: openConnection, closeConnection, startBattle, endBattle, send
GraalLogger
battles.runner.graal.GraalLogger
Showdown Runners
Object
logging.Handler0 / 3SLF4J logging bridge capturing GraalJS Showdown stdout/stderr output.
Methods: publish, flush, close
GraalShowdownService
battles.runner.graal.GraalShowdownService
Showdown Runners
Class
—
implements ShowdownService
4 / 22Default embedded GraalJS ShowdownService running Pokémon Showdown in-process inside the Minecraft JVM.
Fields: context: Context, sendBattleMessageFunction: Value, unbundler: GraalShowdownUnbundler, gson: Gson · Methods: getContext, setContext, getSendBattleMessageFunction, setSendBattleMessageFunction, getUnbundler
GraalShowdownUnbundler
battles.runner.graal.GraalShowdownUnbundler
Showdown Runners
Class
—1 / 3Extracts data/cobblemon/showdown.zip to the runtime directory when showdownVersion changes.
Fields: gson: Gson · Methods: attemptUnbundle, loadShowdownMetadata, readShowdownMetadata
SocketShowdownService
battles.runner.socket.SocketShowdownService
Showdown Runners
Class
—
implements ShowdownService
7 / 20Alternative TCP socket ShowdownService client for connecting to an external Node.js Showdown process.
Fields: host: String, port: int, localPort: int, socket: java.net.Socket · Methods: getHost, getPort, getLocalPort, getGson, openConnection