diff --git a/src/main/java/org/auioc/mcmod/arnicalib/game/entity/EntityTypePredicates.java b/src/main/java/org/auioc/mcmod/arnicalib/game/entity/EntityTypePredicates.java new file mode 100644 index 00000000..89b147e1 --- /dev/null +++ b/src/main/java/org/auioc/mcmod/arnicalib/game/entity/EntityTypePredicates.java @@ -0,0 +1,25 @@ +package org.auioc.mcmod.arnicalib.game.entity; + +import java.util.function.Predicate; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; + +public class EntityTypePredicates { + + public static final Predicate> IS_FRIENDLY = (type) -> getCategory(type).isFriendly(); + public static final Predicate> IS_PERSISTENT = (type) -> getCategory(type).isPersistent(); + + public static final Predicate> IS_MISC = (type) -> getCategory(type) == MobCategory.MISC; + public static final Predicate> IS_MONSTER = (type) -> getCategory(type) == MobCategory.MONSTER; + public static final Predicate> IS_CREATURE = (type) -> getCategory(type) == MobCategory.CREATURE; + public static final Predicate> IS_AMBIENT = (type) -> getCategory(type) == MobCategory.AMBIENT; + public static final Predicate> IS_AXOLOTLS = (type) -> getCategory(type) == MobCategory.AXOLOTLS; + public static final Predicate> IS_UNDERGROUND_WATER_CREATURE = (type) -> getCategory(type) == MobCategory.UNDERGROUND_WATER_CREATURE; + public static final Predicate> IS_WATER_CREATURE = (type) -> getCategory(type) == MobCategory.WATER_CREATURE; + public static final Predicate> IS_WATER_AMBIENT = (type) -> getCategory(type) == MobCategory.WATER_AMBIENT; + + private static MobCategory getCategory(EntityType entityType) { + return entityType.getCategory(); + } + +}