Skip to content

Crash when capturing Pokémon due to invalid ResourceLocation handling #20

@CHAIGNE

Description

@CHAIGNE

Description

When a player captures a Pokémon, the server crashes due to an error in the PokedexRewardHistory class. The crash occurs during the Pokédex update process when Cobbledex attempts to handle rewards after a new Pokémon discovery.

crash-2025-04-26_14.17.24-server.txt

Environment Details

Minecraft Version: 1.20.1
Forge Version: Not specified
Cobbledex Version: 1.1.0
Cobblemon Version: 1.5.2+1.20.1

Steps to Reproduce

Install Cobblemon 1.5.2 and Cobbledex 1.1.0 on a Minecraft 1.20.1 Forge server
Connect to the server with a player
Throw a Poké Ball to capture a Pokémon ( probably with slowpoke, fletchling, weedle )
Server immediately crashes

Crash Details

The crash occurs in PokedexRewardHistory.java:65 in the checkRewards$common method. The error appears to be related to creating an invalid ResourceLocation. The stacktrace shows the following path:

at net.minecraft.resources.ResourceLocation.m_245185_(ResourceLocation.java:236)
at net.minecraft.resources.ResourceLocation.(ResourceLocation.java:38)
at net.minecraft.resources.ResourceLocation.(ResourceLocation.java:42)
at net.minecraft.resources.ResourceLocation.(ResourceLocation.java:46)
at com.rafacasari.mod.cobbledex.api.PokedexRewardHistory$Companion.checkRewards$common(PokedexRewardHistory.java:65)
at com.rafacasari.mod.cobbledex.Cobbledex$preInitialize$8.invoke(Cobbledex.java:117)

The crash is triggered by the Cobblemon event when a Pokémon capture attempt is made:

at com.cobblemon.mod.common.entity.pokeball.EmptyPokeBallEntity$shakeBall$1.invoke(EmptyPokeBallEntity.java:476)

Full Crash Log

I can provide the full crash log if needed for further investigation.

Expected Behavior

The player should be able to capture Pokémon without the server crashing, and Cobbledex should properly record the Pokédex entry.

Possible Solutions

Fix the ResourceLocation creation in the checkRewards$common method
Implement better error handling to prevent crashes in case of invalid resource names
Thank you for your assistance with this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions