diff --git a/CHANGELOG.md b/CHANGELOG.md index 1003484a94..9412590802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ - Fixed Pokémon battles stalling when a sidemod cancels the `THROWN_POKEBALL_HIT` hit event - Fixed choice feature tab completion in `spawnpokemon/pokegive/pokeedit` commands - Fixed MoLang that's targeting players intermittedly failing when they have died, needing them to relog +- Fixed all pots of mod on NeoForge ### Developer - Bumped NeoForge to `21.1.195` to get access to MixinExtras `0.5` and the expressions annotation diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt index b40e8987be..eae1b22062 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt @@ -845,54 +845,35 @@ object CobblemonBlocks : PlatformRegistry, ResourceKey, ResourceKey, ResourceKey { event -> event.register(CobblemonBlocks.resourceKey) { helper -> - CobblemonBlocks.register { identifier, block -> helper.register(identifier, block) } + CobblemonBlocks.register { identifier, block -> + if (block !is FlowerPotBlock) helper.register(identifier, block) + } + } + } + + MOD_BUS.addListener(EventPriority.LOW) { event -> + // Register the pots after registering main blocks to solve race condition when pottable blocks are still not registered + event.register(CobblemonBlocks.resourceKey) { helper -> + CobblemonBlocks.register { identifier, block -> + if (block is FlowerPotBlock) { + helper.register(identifier, block) + + val pottedIdentifier = RegistryAccessResolver.getAccess() + .registryOrThrow(Registries.BLOCK) + .getKeyOrNull(block.potted)!! + + (Blocks.FLOWER_POT as FlowerPotBlock).addPlant(pottedIdentifier) { block } + } + } } } }