Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(game.entity): entity type predicates
- Loading branch information
1 parent
bf48c41
commit b2215f0
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/org/auioc/mcmod/arnicalib/game/entity/EntityTypePredicates.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |