Unicopia/src/main/java/com/minelittlepony/unicopia/EquinePredicates.java

20 lines
813 B
Java
Raw Normal View History

package com.minelittlepony.unicopia;
2020-04-26 14:46:03 +02:00
import java.util.function.Predicate;
import com.minelittlepony.unicopia.entity.Equine;
import net.minecraft.entity.Entity;
2020-01-16 12:35:46 +01:00
import net.minecraft.entity.player.PlayerEntity;
public interface EquinePredicates {
2020-04-26 14:46:03 +02:00
Predicate<Entity> IS_PLAYER = e -> e instanceof PlayerEntity;
Predicate<Entity> RACE_INTERACT_WITH_CLOUDS = entity -> Equine.of(entity).getSpecies().canInteractWithClouds();
2020-04-26 14:46:03 +02:00
Predicate<Entity> PLAYER_UNICORN = IS_PLAYER.and(entity -> Equine.of(entity).getSpecies().canCast());
Predicate<Entity> PLAYER_CHANGELING = IS_PLAYER.and(entity -> Equine.of(entity).getSpecies() == Race.CHANGELING);
2020-04-26 14:46:03 +02:00
Predicate<Entity> PLAYER_PEGASUS = IS_PLAYER.and(entity -> ((PlayerEntity)entity).abilities.creativeMode || RACE_INTERACT_WITH_CLOUDS.test(entity));
}