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));
}
}
}
Aggregations