Search in sources :

Example 1 with EndermiteEntity

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);
            }
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) EndermanEntity(net.minecraft.entity.monster.EndermanEntity) MobEntity(net.minecraft.entity.MobEntity) ShulkerEntity(net.minecraft.entity.monster.ShulkerEntity) EndermiteEntity(net.minecraft.entity.monster.EndermiteEntity) Entity(net.minecraft.entity.Entity) LivingEntity(net.minecraft.entity.LivingEntity) EnderDragonEntity(net.minecraft.entity.boss.dragon.EnderDragonEntity) EnderDragonEntity(net.minecraft.entity.boss.dragon.EnderDragonEntity) EndermanEntity(net.minecraft.entity.monster.EndermanEntity) EndermiteEntity(net.minecraft.entity.monster.EndermiteEntity) ShulkerEntity(net.minecraft.entity.monster.ShulkerEntity) MobEntity(net.minecraft.entity.MobEntity)

Aggregations

Entity (net.minecraft.entity.Entity)1 LivingEntity (net.minecraft.entity.LivingEntity)1 MobEntity (net.minecraft.entity.MobEntity)1 EnderDragonEntity (net.minecraft.entity.boss.dragon.EnderDragonEntity)1 EndermanEntity (net.minecraft.entity.monster.EndermanEntity)1 EndermiteEntity (net.minecraft.entity.monster.EndermiteEntity)1 ShulkerEntity (net.minecraft.entity.monster.ShulkerEntity)1