Skip to content

fix: preserve Pokémon data through the pool, repair /wt and make command feedback configurable - #10

Open
M4RC0Sx wants to merge 1 commit into
Polymeta:mainfrom
M4RC0Sx:main
Open

fix: preserve Pokémon data through the pool, repair /wt and make command feedback configurable#10
M4RC0Sx wants to merge 1 commit into
Polymeta:mainfrom
M4RC0Sx:main

Conversation

@M4RC0Sx

@M4RC0Sx M4RC0Sx commented Aug 29, 2026

Copy link
Copy Markdown

Summary

Three independent fixes found while deploying the mod on a 1.21.1 Fabric server
running Cobblemon 1.7.3.

Pokémon lose their form and species features in the pool (fixes #8)

The pool stored each Pokémon as a property string built with
PokemonPropertyExtractor.ALL and restored it with PokemonProperties.parse().create().

Applying properties cannot round-trip a Pokémon. commonApply writes only the
fields it knows about and then calls updateAspects(), which recomputes the
aspects from the species features instead of restoring the ones that were saved.
Everything an aspect encodes is therefore lost on the way out: an Alolan Meowth
comes back as a Kantonian one, and species features contributed by other mods are
dropped entirely.

Pool entries are now JSON produced by Cobblemon's own Pokemon.CODEC, which is
lossless — the same approach GTS uses to store its listings.

Two notes on the change:

  • Existing pools keep working. Entries written before this change are plain
    JSON strings, and PokemonCodec.decode still parses those the old way, so no
    migration is needed and nothing is thrown away on first load.
  • decode assigns a fresh UUID. The codec restores the depositor's UUID, and
    that must not reach a second player's party; the previous parse().create()
    path always produced a new one, so this preserves the old behaviour.

/wt alone reports an unknown command

The alias is registered as literal("wt").redirect(tradeCommand). A Brigadier
redirect only forwards further arguments — it does not inherit the target node's
own executes. So /wt pool and /wt <slot> worked while a bare /wt failed.
The alias now carries the target's command and requirement.

Command feedback was not translatable

Three messages were hardcoded as English Component.literal calls across seven
call sites, and four of those are player-facing: "The WonderTrade pool is being regenerated!" appears in every path of /wondertrade. On a non-English server
they broke through the configured language.

They now come from three new MessageConfig keys — poolRegenerating,
poolRegenerated and configReloaded — with defaults matching the style of the
existing messages. Existing configs pick them up on the next load.

While in there: Reload registered regeneratepool as a redirect to the reload
command, colliding with RegeneratePool's own literal. It was dead code —
CommandNode.addChild merges onto the existing node and never copies a redirect,
so it was silently discarded — but it is confusing, so it is gone.

Testing

Verified in-game on a live server: regional forms and custom species features now
survive a full deposit/withdraw cycle, /wt opens the party GUI, and the three new
messages render from the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forms in the Pool

1 participant