From dc4e3dc39c38569cb0d96bf8a1df6bde65ed322a Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 13 Oct 2023 09:18:31 +1000 Subject: [PATCH] Added 'biomeAnticondition' to BiomeRequirement, closes #573 --- .../evolution/requirements/BiomeRequirement.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/evolution/requirements/BiomeRequirement.kt b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/evolution/requirements/BiomeRequirement.kt index de8ea46a26..410bea2c4d 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/evolution/requirements/BiomeRequirement.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/evolution/requirements/BiomeRequirement.kt @@ -25,11 +25,13 @@ import net.minecraft.world.biome.Biome * @since March 21st, 2022 */ class BiomeRequirement : EntityQueryRequirement { - val biomeCondition: RegistryLikeCondition = BiomeIdentifierCondition(Identifier("plains")) - override fun check(pokemon: Pokemon, queriedEntity: LivingEntity) = biomeCondition.fits( - queriedEntity.world.getBiome(queriedEntity.blockPos).value(), - queriedEntity.world.registryManager.get(RegistryKeys.BIOME) - ) + val biomeCondition: RegistryLikeCondition? = null + val biomeAnticondition: RegistryLikeCondition? = null + override fun check(pokemon: Pokemon, queriedEntity: LivingEntity): Boolean { + val biome = queriedEntity.world.getBiome(queriedEntity.blockPos).value() + val registry = queriedEntity.world.registryManager.get(RegistryKeys.BIOME) + return (biomeCondition == null || biomeCondition.fits(biome, registry)) && (biomeAnticondition == null || !biomeAnticondition.fits(biome, registry)) + } companion object { const val ADAPTER_VARIANT = "biome"