Modscraper Modscraper Minecraft
Wild Battle API logo

Wild Battle API

Mod

by Raguto

Shared wild battle AI API for Cobblemon.

Type

Mod

CurseForge Downloads

906,560

CurseForge ID

1478863

Modrinth Downloads

190,650

Modrinth ID

v7VZE8kh

Last Updated

Sep 7, 2026

Description

### [Please consider supporting me on ko-fi if you like the mod and can afford it, I appreciate even 1 dollar. ](https://ko-fi.com/raguto)Ko-fi --- _**I grant permission to anyone seeking to add my mod to a modpack**_ --- # Wild Battle API Wild Battle API is a shared wild battle AI framework for Cobblemon. For players and pack authors, it provides configurable smarter wild battle behavior with built-in presets and admin tools. For developers, it exposes a supported public API for registering custom wild `BattleAI` implementations without replacing Cobblemon internals directly. Wild Battle API installs a delegating AI on wild battle actors at battle start. On each AI decision: - Higher-priority providers are checked first. - The first provider that returns a non-null `BattleAI` is used. - Returning `null` defers to lower-priority providers. - If no provider claims the context, the actor's original Cobblemon AI is used as fallback. This lets multiple mods cooperate safely while keeping a reliable fallback path when no custom provider applies. ## Included Features - Shared API for wild battle AI extensions - Priority-based provider resolution - Safe fallback to the actor's original Cobblemon AI - Built-in configurable smart wild AI behavior - Difficulty presets from `easy` to `extreme` - Admin UI and debug commands - Fabric and NeoForge support for Minecraft `1.21.1` ## Admin Commands Wild Battle API includes operator/admin commands for testing and configuration. Commands: - `/wildbattleapi ui` - `/wildbattleapi difficulty ` - `/wildbattleapi debug on` - `/wildbattleapi debug off` - `/wildbattleapi debug status` Aliases: - `/wba ui` - `/wba difficulty ` - `/wba debug on|off|status` These commands require permission level `2`. Developer Usage ## Developer Usage ### Supported Public API Use only these classes for third-party integrations: - `com.github.raguto.wildbattleapi.api.WildBattleAPI` - `com.github.raguto.wildbattleapi.api.WildAIProvider` - `com.github.raguto.wildbattleapi.api.WildAIContext` Do not depend on internal packages such as `impl`, `mixin`, `config`, or `network`. ### Runtime Dependency Install Wild Battle API anywhere your dependent mod loads. In normal modpacks, that means both client and server. Mod ID: - `wild_battle_api` Also declare it as a dependency in your mod metadata. Fabric (`fabric.mod.json`): ```json { "depends": { "wild_battle_api": "*" } } ``` NeoForge (`META-INF/neoforge.mods.toml`): ```toml [[dependencies.your_mod_id]] modId = "wild_battle_api" type = "required" versionRange = "[1.0.0,)" ordering = "AFTER" side = "BOTH" ``` Adjust the minimum version to the first Wild Battle API version your mod supports. ### Compile-Time Dependency If you are not consuming a published Maven artifact, compile against the loader-specific jar directly. Fabric example: ```gradle dependencies { modCompileOnly files("libs/wild_battle_api-fabric-1.0.0.jar") } ``` NeoForge example: ```gradle dependencies { compileOnly files("libs/wild_battle_api-neoforge-1.0.0.jar") } ``` Use the loader-appropriate jar for your environment. ### Registering a Provider Register your provider once during your mod's common initialization. ```java import com.github.raguto.wildbattleapi.api.WildBattleAPI; import com.github.raguto.wildbattleapi.api.WildAIContext; public final class MyWildAIRegistration { public static void init() { WildBattleAPI.registerProvider(150, context -> { if (shouldUseMyAI(context)) { return new MyCustomWildBattleAI(); } return null; }); } private static boolean shouldUseMyAI(WildAIContext context) { return context.getBattle() != null && context.getActor() != null; } } ``` You can also register at the default priority: ```java WildBattleAPI.registerProvider(context -> null); ``` ### Priority Guidance - `0`: catch-all or default provider - `50`: standard override - `100+`: high-priority or boss-specific override - `200+`: hard override, use carefully If your provider only handles specific cases, return `null` for everything else. ### Implementing Your Own BattleAI You may provide any class that implements Cobblemon's `BattleAI`. ```java import com.cobblemon.mod.common.api.battles.model.PokemonBattle; import com.cobblemon.mod.common.api.battles.model.ai.BattleAI; import com.cobblemon.mod.common.battles.ActiveBattlePokemon; import com.cobblemon.mod.common.battles.BattleSide; import com.cobblemon.mod.common.battles.PassActionResponse; import com.cobblemon.mod.common.battles.ShowdownActionResponse; import com.cobblemon.mod.common.battles.ShowdownMoveset; import com.cobblemon.mod.common.net.messages.client.battle.BattleHealthChangePacket; import org.jetbrains.annotations.Nullable; public final class MyCustomWildBattleAI implements BattleAI { @Override public ShowdownActionResponse choose( ActiveBattlePokemon activeBattlePokemon, PokemonBattle battle, BattleSide side, @Nullable ShowdownMoveset moveset, boolean forceSwitch ) { if (forceSwitch || moveset == null) { return PassActionResponse.INSTANCE; } // Replace this with your own move or switch logic. return PassActionResponse.INSTANCE; } @Override public void onHealthChange(BattleHealthChangePacket packet) { // Optional state tracking. } } ``` ### WildAIContext `WildAIContext` gives providers the information needed to decide whether to claim a wild battle actor. Always available: - `getActor()` - `getPokemonList()` - `getBattle()` - `isForceSwitch()` Nullable depending on the current decision: - `getActiveBattlePokemon()` - `getAiSide()` - `getMoveset()` Guard nullable fields before using them. ### Integration Notes - Keep provider logic fast and predictable. - Return `null` when your mod does not want to claim the current context. - Avoid throwing exceptions from provider or AI logic. - Test in both dedicated server and integrated singleplayer. - If multiple mods register providers, higher numeric priority is checked first. ## Licensing Wild Battle API code and binaries are All Rights Reserved. Third-party usage and distribution permissions are defined by the author policy on the mod page.

Compatibility

Mod Loaders

Fabric Neoforge

Game Versions

1.21.1

Recommended Gear

Affiliate

Hardware and extras that pair well with this mod.

As an Amazon Associate I earn from qualifying purchases.

Screenshots

Similar Mods

Included in Modpacks (87)

Show fewer
All the Mons - ATMons All the Mons - ATMons Cobblemon Realms Cobblemon Realms coEBLmon coEBLmon MineColonies - Cobblemon Conquest MineColonies - Cobblemon Conquest Pixelax Pixelax Cobblemon - RPG Edition | Cobblemon & RPG [Cobblemon 1.7.3] Cobblemon - RPG Edition | Cobblemon & RPG [Cobblemon 1.7.3] CobbleGems CobbleGems The Cobblemon Colonies The Cobblemon Colonies Monumental Experience - Creatures Across the World Monumental Experience - Creatures Across the World Immersive Cobblemon | With Distant Horizons, CobbleBrain, Cobblemon Addons & Quests (Cobblemon v1.7.3) Immersive Cobblemon | With Distant Horizons, CobbleBrain, Cobblemon Addons & Quests (Cobblemon v1.7.3) Cobblemon - Master Mon Cobblemon - Master Mon Cobblemon & Origins SMP Cobblemon & Origins SMP Soulheart Cobblemon Soulheart Cobblemon Cobblemon Realms Lite Cobblemon Realms Lite Tinker's Tavern: Cobblemon Tinker's Tavern: Cobblemon PikaVerse MC PikaVerse MC Randoms Packs Randoms Packs PokeSMP PokeSMP CobbleCraft CobbleCraft Cobblemon Vulkan Cobblemon Vulkan WildLouna WildLouna CobbleCafe Oficial CobbleCafe Oficial Dyonizel Modpack Dyonizel Modpack Cobblemon Dimensions Cobblemon Dimensions Servidor Universo PokeNet | Cobblemon Servidor Universo PokeNet | Cobblemon Synergy Pokemon Synergy Pokemon Sleepymon [COBBLEMON] Sleepymon [COBBLEMON] Cobblemon Unbound Cobblemon Unbound Cobblemon Vulkan (Performance Pack) Cobblemon Vulkan (Performance Pack) SinnoH Sanctum Old SinnoH Sanctum Old CobbleStories - A Create Adventure CobbleStories - A Create Adventure ReCraft S8 Project infinity 0.1 ReCraft S8 Project infinity 0.1 POKEPURAM-SMP POKEPURAM-SMP Steam and Stardust Steam and Stardust Chime Mon Chime Mon CobbleValley CobbleValley Cobbled Saint Cobbled Saint CobbleWobble - Cobblemon CobbleWobble - Cobblemon Karma's Cobblemon Mechanical Magic Karma's Cobblemon Mechanical Magic Athy's Cobbleswamp Athy's Cobbleswamp RotomWorks RotomWorks SCSMP 2 SCSMP 2 Hollycraft SMP Hollycraft SMP Elysium [ASCENSION] Elysium [ASCENSION] Cobblemon: Age Of Industry Cobblemon: Age Of Industry Wildera SMP Wildera SMP PossessedArmor's Random Starters Cobblemon PossessedArmor's Random Starters Cobblemon Goon Crew Collection Goon Crew Collection Eevee Isles Eevee Isles Cobblemon Perfected Cobblemon Perfected The Poke Isles Official Modpack The Poke Isles Official Modpack Cobble Lemon Cobble Lemon KaijuuCraft KaijuuCraft Cobblemon Coliseum Modpack Cobblemon Coliseum Modpack Cobbled Kingdom Mons Cobbled Kingdom Mons COBBLEPOKEMON COBBLEPOKEMON The Hunter Project The Hunter Project Cobblezados Cobblezados CobbleCafe Oficial CobbleCafe Oficial Cozymon Adventure Cozymon Adventure Tales of Horizon Tales of Horizon AeroCobble AeroCobble Cobblemon Grand Journey Cobblemon Grand Journey Electricmon Electricmon ZenCobblemon ZenCobblemon Cobblemon Generations SMP Cobblemon Generations SMP Hypheria Hypheria Doghouse Tales Doghouse Tales CobbleAdventures Official Modpack CobbleAdventures Official Modpack Cody's Cobblemon Adventure Cody's Cobblemon Adventure Cobbled RPG Cobbled RPG KastiCraft Cobblemon x Create KastiCraft Cobblemon x Create quaniiiboiii cobblemon quaniiiboiii cobblemon Leyends of Teagarden Leyends of Teagarden Cobblemon Forever Edition Cobblemon Forever Edition The Cobblemon Collective The Cobblemon Collective Cobbleish Cobbleish Opium Cobblemon Opium Cobblemon Mr. Aura's Cobblemon Mr. Aura's Cobblemon Poketod SMP Poketod SMP Voidbound Chronicles Voidbound Chronicles Cobble X Friends Cobble X Friends Official Yakuza modpack Official Yakuza modpack COBBLERUNE COBBLERUNE depenas depenas Rocks & Monsters Rocks & Monsters CobbleLock CobbleLock

External Resources