mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-11-26 18:18:53 -05:00
Added 'biomeAnticondition' to BiomeRequirement, closes #573
This commit is contained in:
1 parent
d100537d41
commit
dc4e3dc39c
1 file changed
+7
-5
+7
-5
@@ -25,11 +25,13 @@ import net.minecraft.world.biome.Biome
|
||||
* @since March 21st, 2022
|
||||
*/
|
||||
class BiomeRequirement : EntityQueryRequirement {
|
||||
val biomeCondition: RegistryLikeCondition<Biome> = 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<Biome>? = null
|
||||
val biomeAnticondition: RegistryLikeCondition<Biome>? = 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"
|
||||
|
||||
Reference in new issue
Block a user