fix: preserve Pokémon data through the pool, repair /wt and make command feedback configurable - #10
Open
M4RC0Sx wants to merge 1 commit into
Open
fix: preserve Pokémon data through the pool, repair /wt and make command feedback configurable#10M4RC0Sx wants to merge 1 commit into
M4RC0Sx wants to merge 1 commit into
Conversation
… make all command feedback configurable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ALLand restored it withPokemonProperties.parse().create().Applying properties cannot round-trip a Pokémon.
commonApplywrites only thefields it knows about and then calls
updateAspects(), which recomputes theaspects 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 islossless — the same approach GTS uses to store its listings.
Two notes on the change:
JSON strings, and
PokemonCodec.decodestill parses those the old way, so nomigration is needed and nothing is thrown away on first load.
decodeassigns a fresh UUID. The codec restores the depositor's UUID, andthat must not reach a second player's party; the previous
parse().create()path always produced a new one, so this preserves the old behaviour.
/wtalone reports an unknown commandThe alias is registered as
literal("wt").redirect(tradeCommand). A Brigadierredirect only forwards further arguments — it does not inherit the target node's
own
executes. So/wt pooland/wt <slot>worked while a bare/wtfailed.The alias now carries the target's command and requirement.
Command feedback was not translatable
Three messages were hardcoded as English
Component.literalcalls across sevencall sites, and four of those are player-facing:
"The WonderTrade pool is being regenerated!"appears in every path of/wondertrade. On a non-English serverthey broke through the configured language.
They now come from three new
MessageConfigkeys —poolRegenerating,poolRegeneratedandconfigReloaded— with defaults matching the style of theexisting messages. Existing configs pick them up on the next load.
While in there:
Reloadregisteredregeneratepoolas a redirect to the reloadcommand, colliding with
RegeneratePool's own literal. It was dead code —CommandNode.addChildmerges 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,
/wtopens the party GUI, and the three newmessages render from the config.