Search in sources :

Example 1 with DolphinEntity

use of net.minecraft.entity.passive.DolphinEntity in project upgrade-aquatic by team-abnormals.

the class EntityEvents method onEntitySpawned.

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onEntitySpawned(EntityJoinWorldEvent event) {
    if (event.getWorld().isRemote)
        return;
    Entity entity = event.getEntity();
    if (entity instanceof DrownedEntity) {
        ((CreatureEntity) entity).goalSelector.addGoal(3, new AvoidEntityGoal<>((CreatureEntity) entity, TurtleEntity.class, 6.0F, 1.0D, 1.2D));
    }
    if (entity instanceof AbstractFishEntity) {
        ((AbstractFishEntity) entity).goalSelector.addGoal(2, new AvoidEntityGoal<>((CreatureEntity) entity, PikeEntity.class, 8.0F, 1.6D, 1.4D, UAEntityPredicates.IS_HIDING_IN_PICKERELWEED::test));
        if (entity instanceof TropicalFishEntity) {
            ((AbstractFishEntity) entity).goalSelector.addGoal(2, new AvoidEntityGoal<>((CreatureEntity) entity, LionfishEntity.class, 8.0F, 1.6D, 1.4D, EntityPredicates.IS_ALIVE::test));
        }
    }
    if (entity instanceof WaterMobEntity && !(entity instanceof IMob)) {
        if (!(entity instanceof DolphinEntity)) {
            ((MobEntity) entity).goalSelector.addGoal(1, new AvoidEntityGoal<>((CreatureEntity) entity, ThrasherEntity.class, 20.0F, 1.4D, 1.6D, EntityPredicates.IS_ALIVE::test));
        }
        if (entity instanceof DolphinEntity) {
            ((MobEntity) entity).targetSelector.addGoal(0, (new HurtByTargetGoal((DolphinEntity) entity, ThrasherEntity.class)).setCallsForHelp());
            ((MobEntity) entity).goalSelector.addGoal(1, new MeleeAttackGoal((DolphinEntity) entity, 1.2D, true));
        }
    }
}
Also used : PikeEntity(com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity) DolphinEntity(net.minecraft.entity.passive.DolphinEntity) PhantomEntity(net.minecraft.entity.monster.PhantomEntity) WaterMobEntity(net.minecraft.entity.passive.WaterMobEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ThrasherEntity(com.minecraftabnormals.upgrade_aquatic.common.entities.thrasher.ThrasherEntity) SquidEntity(net.minecraft.entity.passive.SquidEntity) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) AbstractFishEntity(net.minecraft.entity.passive.fish.AbstractFishEntity) LionfishEntity(com.minecraftabnormals.upgrade_aquatic.common.entities.LionfishEntity) DrownedEntity(net.minecraft.entity.monster.DrownedEntity) CreatureEntity(net.minecraft.entity.CreatureEntity) TurtleEntity(net.minecraft.entity.passive.TurtleEntity) TropicalFishEntity(net.minecraft.entity.passive.fish.TropicalFishEntity) MobEntity(net.minecraft.entity.MobEntity) Entity(net.minecraft.entity.Entity) TurtleEntity(net.minecraft.entity.passive.TurtleEntity) AbstractFishEntity(net.minecraft.entity.passive.fish.AbstractFishEntity) ThrasherEntity(com.minecraftabnormals.upgrade_aquatic.common.entities.thrasher.ThrasherEntity) HurtByTargetGoal(net.minecraft.entity.ai.goal.HurtByTargetGoal) DolphinEntity(net.minecraft.entity.passive.DolphinEntity) CreatureEntity(net.minecraft.entity.CreatureEntity) PikeEntity(com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity) LionfishEntity(com.minecraftabnormals.upgrade_aquatic.common.entities.LionfishEntity) UAEntityPredicates(com.minecraftabnormals.upgrade_aquatic.api.util.UAEntityPredicates) EntityPredicates(net.minecraft.util.EntityPredicates) UAEntityPredicates(com.minecraftabnormals.upgrade_aquatic.api.util.UAEntityPredicates) IMob(net.minecraft.entity.monster.IMob) MeleeAttackGoal(net.minecraft.entity.ai.goal.MeleeAttackGoal) TropicalFishEntity(net.minecraft.entity.passive.fish.TropicalFishEntity) DrownedEntity(net.minecraft.entity.monster.DrownedEntity) WaterMobEntity(net.minecraft.entity.passive.WaterMobEntity) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

UAEntityPredicates (com.minecraftabnormals.upgrade_aquatic.api.util.UAEntityPredicates)1 LionfishEntity (com.minecraftabnormals.upgrade_aquatic.common.entities.LionfishEntity)1 PikeEntity (com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity)1 ThrasherEntity (com.minecraftabnormals.upgrade_aquatic.common.entities.thrasher.ThrasherEntity)1 CreatureEntity (net.minecraft.entity.CreatureEntity)1 Entity (net.minecraft.entity.Entity)1 LivingEntity (net.minecraft.entity.LivingEntity)1 MobEntity (net.minecraft.entity.MobEntity)1 HurtByTargetGoal (net.minecraft.entity.ai.goal.HurtByTargetGoal)1 MeleeAttackGoal (net.minecraft.entity.ai.goal.MeleeAttackGoal)1 DrownedEntity (net.minecraft.entity.monster.DrownedEntity)1 IMob (net.minecraft.entity.monster.IMob)1 PhantomEntity (net.minecraft.entity.monster.PhantomEntity)1 DolphinEntity (net.minecraft.entity.passive.DolphinEntity)1 SquidEntity (net.minecraft.entity.passive.SquidEntity)1 TurtleEntity (net.minecraft.entity.passive.TurtleEntity)1 WaterMobEntity (net.minecraft.entity.passive.WaterMobEntity)1 AbstractFishEntity (net.minecraft.entity.passive.fish.AbstractFishEntity)1 TropicalFishEntity (net.minecraft.entity.passive.fish.TropicalFishEntity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1