Cobblemon Trainer Battle Commands (TBCS)
This mod adds a command system for managing Pokémon trainers and starting battles, which can serve as an interface for other modifications (such as Easy NPC).
This mod is mainly intended for map creators and modpack developers.
Main Command Features
The following commands are available:
tbcs attach <trainerID> <entity>— attaches the specified trainer to the given entity (each trainer can only be attached to one entity)tbcs battle <battle_format> <participants1> vs <participants2> [rules <battle_rules>] [onwin <win_commands>]— starts a battle between the specified participants with the given format, rules, and win commands (the last two parameters are optional)
Note: All commands require permission level 2.
Battle Rule Configuration
Battle rules are specified in JSON format. Currently, only one property is supported:
maxItemUses— specifies how many items each participant can use in a battle
Win Commands
Reward commands are also described using a JSON object with a more flexible structure. The win command object can contain properties for each battle side (1 or 2) with arrays of commands to execute when the corresponding side wins.
These commands have access to special selectors that allow selecting any battle participant. Selectors follow the format @<number>, where the number indicates the participant's position relative to the side for which the command is executed.
Practical Examples
Attaching a trainer to the closest villager:
tbcs attach tbcs:mytrainer1 @e[type=minecraft:villager,limit=1,sort=nearest]
Starting a single battle with a trainer:
tbcs battle GEN_9_SINGLES @s vs tbcs:mytrainer1
Starting a battle with item usage limitation:
tbcs battle GEN_9_SINGLES @s vs tbcs:mytrainer1 rules {maxItemUses: 1}
Battle with a victory reward:
tbcs battle GEN_9_SINGLES @s vs tbcs:mytrainer1 rules {maxItemUses: 1} onwin {1: ['give @1 minecraft:diamond']}
Team battle with multiple rewards:
tbcs battle GEN_9_MULTI @s tbcs:mytrainer1 vs tbcs:mytrainer2 tbcs:mytrainer3 onwin {1: ['give @1 minecraft:diamond', '@2 say We defeated them!']}
Trainer Configuration
Data Structure
Trainers are defined using JSON files. The trainer structure is provided by RCTApi and mostly matches the structure from the Radical Cobblemon Trainers modification.
File Locations
When loading a world, trainer files are searched in all paths specified in trainerPaths (relative to the world directory). Trainer identifiers are formed based on file names.
Compatibility
The mod is compatible with other mods using RCTApi. Copies of trainers from these mods may automatically register in TBCS when they are installed.
Configuration
The configuration file is located at config/tbcs-server.toml and contains settings for trainer paths, supported mods, and command permission levels.
Video Demo
[
]
Dependencies
Required for the mod to work:
- Cobblemon
- Radical Cobblemon Trainers API
- Forge Config API Port (Fabric only)