Tags
Creators
Details
4.1.5
Compatibility
Changes
The ghost Pokemon bug was caused by AdaptiveSpawnManager calling event.cancel() on CobblemonEvents.ENTITY_SPAWN without cleaning up the entity itself.
event.cancel() only sets a flag on the event object. If Cobblemon adds the entity to the world before firing the event (or doesn't properly check the
cancellation flag), the entity remains in the world as a ghost: it exists server-side but was never fully initialized by Cobblemon's spawn pipeline. This
means:
- No model/animation data synced to clients — the entity is invisible
- No Cobblemon behavior state initialized — the entity is stuck, can't be battled
- Never cleaned up — ghost entities accumulate over time
The fix adds event.entity.discard() after every event.cancel() call. discard() marks the entity for removal from the world. It's safe in both scenarios:
- If the entity is already in the world → it gets properly removed, destroy packet sent to clients
- If the entity was never added to the world → it's a no-op (just sets a flag on a garbage-collectible object)
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:qPJLoYyi:E0zVh2ed"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:qPJLoYyi:E0zVh2ed"
}

