Trainer templates
Native templates are datapack JSON resources under
data/<namespace>/brecher_trainers/trainers/<name>.json. They include schema
version, display identity, roster, dialogue, battle rules, AI difficulty,
appearance, and behavior.
Legacy RCT-shaped resources under trainers/ remain recognized throughout 3.x for
direct upgrades, but new content should use the native path. A native resource
overrides the same <namespace>:<name> from the legacy path.
Each resource is validated on its own: an invalid template is logged and skipped,
and every valid template still installs. A template that was installed before and
is now invalid is removed, and an invalid native resource does not fall back to a
legacy resource with the same ID. The previous template set stays installed only
when the catalogue as a whole cannot be trusted: a template directory could not be
listed, or the runtime registry refused the new rosters. Reload datapacks, then
require a /trainer migration report with no malformed rosters, unresolved
templates, or legacy-backed entities; the report includes the failing resource and
a concise reason.
Example
{
"schema_version": 1,
"display_name": "Ace Trainer",
"roster": [
{
"species": "cobblemon:pikachu",
"level": 35,
"moveset": ["thunderbolt"],
"evs": {"spa": 252, "spe": 252}
}
],
"dialogue": {
"on_battle_start": "dialogue.example.ace.start"
},
"battle_rules": {
"format": "singles",
"team_size": 3,
"team_preview": true,
"ai_difficulty": "hard",
"bag_item_mode": "max_3",
"bag_items": [{"item_id": "cobblemon:hyper_potion", "quantity": 2}]
},
"appearance": "minecraft:textures/entity/player/wide/steve.png",
"behavior": "stationary"
}
bag_item_mode (disabled, max_3 or unlimited) limits how many bag items
each side may use in a battle: the trainer from bag_items, and the challenger
from their own bag. A template can set an exact limit with max_item_uses
instead: -1 for unlimited, 0 for none, or 1–100. Set only one of the two.
Dialogue values are translation keys supplied by the datapack's companion
resource pack. team_preview is accepted for compatibility with spawner
configs but currently has no visible effect: template trainers start the battle
when clicked and have no rules screen to show the team on. TRIPLES remains
readable but runs as singles and emits one operator warning per process.
Limits and validation
Template JSON is limited to 1,048,576 characters, roster JSON to 262,144 characters, nesting to 64 levels, rosters to six Pokémon, moves to four per Pokémon, and bag items to ten entries.
Duplicate JSON keys, duplicate stat aliases, fractional integer fields, unknown future schemas, invalid resource identifier syntax, unknown stat names, IVs outside 0–31, EVs outside 0–252, and incompatible format/team/level bounds reject the template. Native templates also reject duplicate moves and EV totals above 510.
Templates are also checked against Cobblemon when they load. An unknown species, form, move, tera type or Poké Ball rejects the template, because no battle with it could start. An unknown ability or nature rejects a native template; a legacy template keeps loading with a warning and Cobblemon picks one at random, as RCT did. (RCT itself dropped an unknown move; 3.x rejects the template instead.)
Legacy resources under trainers/ read RCT's bag as bag_items and its
battleRules.maxItemUses as max_item_uses, both as RCT does: a bare item ID
means cobblemon:, a quantity of 0 or less is ignored, a repeated item keeps its
last quantity, and a negative limit is unlimited while any other limit is exact.
A bag entry that cannot be used (a non-Cobblemon item, or more than ten items) is
skipped with a warning and the template still loads; a quantity above 99 is held
as 99. An unknown or non-battle bag item rejects a native template and only warns
for a legacy one. RCT's battleFormat is read as format: GEN_9_SINGLES and
GEN_9_DOUBLES as singles and doubles, and GEN_9_TRIPLES as triples, which runs
as singles. A format with no equivalent (such as GEN_9_MULTI), or doubles for a
one-Pokémon team, battles in singles with a warning.
Legacy resources under trainers/ follow Radical Cobblemon Trainers' own rules:
a repeated move or aspect is dropped, keeping the first one, and EVs that total
more than 510 are applied in HP, Attack, Defence, Sp. Atk, Sp. Def, Speed order,
skipping any value that would pass 510 — the EVs Cobblemon would have given the
Pokémon under RCT. Both log a warning naming the template.
heldItem is a single item ID, an ordered list of fallback IDs, or null. The
first ID that names a registered item is held, so
["mega_showdown:audinite", "leftovers"] holds Audinite when Mega Showdown is
installed and Leftovers otherwise. An empty list or no registered ID means no held
item. An ID without a namespace means cobblemon:.
Species, moves, abilities, natures, and held items accept lowercase identifiers
such as pikachu or cobblemon:pikachu; trainer bag items require an explicit
cobblemon:<path> item ID. Move and ability IDs are matched by their Showdown
spelling, so cobblemon:rough_skin and roughskin are the same ability. Supported stat names are hp, attack/atk,
defence/defense/def, special_attack/spa,
special_defence/special_defense/spd, and speed/spe.
Trainers use bag items only when they help: HP items at half health or below (a Full Restore also when the Pokémon is hurt and has a status), Ethers and Elixirs once a move is down to a quarter of its PP, and Revives and Revival Herbs on a fainted team member.
Battle traits
Each roster entry may also set the traits a gym leader's saved team keeps from the owner's Pokémon. Leave a field out to keep Cobblemon's default.
| Field | Value |
|---|---|
friendship | 0–255; powers Return and Frustration |
hyper_trained_ivs | stat → 0–31, as ivs; requires all six ivs, which Hidden Power still uses |
tera_type | tera type ID, e.g. dragon |
gmax_factor | true or false |
dmax_level | 0–10 |
alpha | true or false |
pokeball | Poké Ball ID, e.g. ultra_ball |
pp_ups | move → 0–3 PP Ups; each move must be in moveset |
A trainer always starts a battle at full HP and PP.
Spawning a template
After a successful datapack reload, use /trainer spawn <namespace:id> to create
an independent entity instance backed by that template. Multiple entities may
share one template while retaining distinct entity UUIDs and battle state. The
command is authority-only and requires operator permission level 2.