use of net.minecraft.entity.monster.EndermiteEntity in project Champions by TheIllusiveC4.
the class InfestedAffix method spawnParasites.
private static void spawnParasites(LivingEntity livingEntity, int amount, @Nullable LivingEntity target, ServerWorld world) {
boolean isEnder = livingEntity instanceof EndermanEntity || livingEntity instanceof ShulkerEntity || livingEntity instanceof EndermiteEntity || livingEntity instanceof EnderDragonEntity;
EntityType<?> type = isEnder ? ChampionsConfig.infestedEnderParasite : ChampionsConfig.infestedParasite;
for (int i = 0; i < amount; i++) {
Entity entity = type.create(world, null, null, null, livingEntity.getPosition(), SpawnReason.MOB_SUMMONED, false, false);
if (entity instanceof LivingEntity) {
ChampionCapability.getCapability((LivingEntity) entity).ifPresent(champion -> champion.getServer().setRank(RankManager.getLowestRank()));
livingEntity.getEntityWorld().addEntity(entity);
if (entity instanceof MobEntity) {
((MobEntity) entity).spawnExplosionParticle();
((MobEntity) entity).setRevengeTarget(target);
((MobEntity) entity).setAttackTarget(target);
}
}
}
}
Aggregations