Skip to content

Commit

Permalink
feat(game.entity): entity type predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Oct 5, 2022
1 parent bf48c41 commit b2215f0
Showing 1 changed file with 25 additions and 0 deletions.
@@ -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<EntityType<?>> IS_FRIENDLY = (type) -> getCategory(type).isFriendly();
public static final Predicate<EntityType<?>> IS_PERSISTENT = (type) -> getCategory(type).isPersistent();

public static final Predicate<EntityType<?>> IS_MISC = (type) -> getCategory(type) == MobCategory.MISC;
public static final Predicate<EntityType<?>> IS_MONSTER = (type) -> getCategory(type) == MobCategory.MONSTER;
public static final Predicate<EntityType<?>> IS_CREATURE = (type) -> getCategory(type) == MobCategory.CREATURE;
public static final Predicate<EntityType<?>> IS_AMBIENT = (type) -> getCategory(type) == MobCategory.AMBIENT;
public static final Predicate<EntityType<?>> IS_AXOLOTLS = (type) -> getCategory(type) == MobCategory.AXOLOTLS;
public static final Predicate<EntityType<?>> IS_UNDERGROUND_WATER_CREATURE = (type) -> getCategory(type) == MobCategory.UNDERGROUND_WATER_CREATURE;
public static final Predicate<EntityType<?>> IS_WATER_CREATURE = (type) -> getCategory(type) == MobCategory.WATER_CREATURE;
public static final Predicate<EntityType<?>> IS_WATER_AMBIENT = (type) -> getCategory(type) == MobCategory.WATER_AMBIENT;

private static MobCategory getCategory(EntityType<?> entityType) {
return entityType.getCategory();
}

}

0 comments on commit b2215f0

Please sign in to comment.