Search in sources :

Example 1 with EntityAreaEffectCloud

use of net.minecraft.entity.EntityAreaEffectCloud in project NetherEx by LogicTechCorp.

the class EntitySporeCreeper method spawnLingeringCloud.

private void spawnLingeringCloud() {
    Collection<PotionEffect> collection = getActivePotionEffects();
    if (!collection.isEmpty()) {
        EntityAreaEffectCloud cloud = new EntityAreaEffectCloud(world, posX, posY, posZ);
        cloud.setRadius(2.5F);
        cloud.setRadiusOnUse(-0.5F);
        cloud.setWaitTime(10);
        cloud.setDuration(cloud.getDuration() / 2);
        cloud.setRadiusPerTick(-cloud.getRadius() / (float) cloud.getDuration());
        for (PotionEffect effect : collection) {
            cloud.addEffect(new PotionEffect(effect));
        }
        world.spawnEntity(cloud);
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityAreaEffectCloud(net.minecraft.entity.EntityAreaEffectCloud)

Example 2 with EntityAreaEffectCloud

use of net.minecraft.entity.EntityAreaEffectCloud in project Cavern2 by kegare.

the class FissureHelper method fireAreaEffect.

public static void fireAreaEffect(World world, BlockPos pos, @Nullable EntityLivingBase entity) {
    EntityAreaEffectCloud areaEffectCloud = new EntityAreaEffectCloud(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D);
    areaEffectCloud.setOwner(entity);
    areaEffectCloud.setRadius(2.5F);
    areaEffectCloud.setRadiusOnUse(-0.5F);
    areaEffectCloud.setWaitTime(10);
    areaEffectCloud.setDuration(20 * 30);
    areaEffectCloud.addEffect(new PotionEffect(getRandomPotion(RANDOM.nextDouble() < 0.35D), 20 * 30, RANDOM.nextInt(2)));
    world.spawnEntity(areaEffectCloud);
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityAreaEffectCloud(net.minecraft.entity.EntityAreaEffectCloud)

Example 3 with EntityAreaEffectCloud

use of net.minecraft.entity.EntityAreaEffectCloud in project takumicraft by TNTModders.

the class EntityWitchCreeper method takumiExplode.

@Override
public void takumiExplode() {
    PotionType type = PotionTypes.HARMING;
    switch(this.rand.nextInt(4)) {
        case 0:
            break;
        case 1:
            type = PotionTypes.POISON;
            break;
        case 2:
            type = PotionTypes.SLOWNESS;
            break;
        case 3:
            type = PotionTypes.WEAKNESS;
            break;
    }
    EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.posX, this.posY, this.posZ);
    entityareaeffectcloud.setRadius(5F);
    entityareaeffectcloud.setRadiusOnUse(-0.5F);
    entityareaeffectcloud.setWaitTime(10);
    entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration());
    entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / entityareaeffectcloud.getDuration());
    entityareaeffectcloud.addEffect(type.getEffects().get(0));
    this.world.spawnEntity(entityareaeffectcloud);
}
Also used : EntityAreaEffectCloud(net.minecraft.entity.EntityAreaEffectCloud) PotionType(net.minecraft.potion.PotionType)

Example 4 with EntityAreaEffectCloud

use of net.minecraft.entity.EntityAreaEffectCloud in project takumicraft by TNTModders.

the class EntityDarkCreeper method takumiExplodeEvent.

@Override
public boolean takumiExplodeEvent(Detonate event) {
    for (Entity entity : event.getAffectedEntities()) {
        if (entity instanceof EntityLivingBase) {
            boolean done = false;
            for (int i = 0; i < 50 && !done; i++) {
                done = this.teleportTo((EntityLivingBase) entity);
            }
            Potion potion = MobEffects.BLINDNESS;
            switch(this.rand.nextInt(6)) {
                case 0:
                    break;
                case 1:
                    potion = MobEffects.NAUSEA;
                    break;
                case 2:
                    potion = MobEffects.SLOWNESS;
                    break;
                case 3:
                    potion = MobEffects.HUNGER;
                    break;
                case 4:
                    potion = MobEffects.UNLUCK;
                    break;
                case 5:
                    if (this.rand.nextBoolean() && this.getPowered()) {
                        potion = MobEffects.LEVITATION;
                    }
                    break;
            }
            EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(entity.world, entity.posX, entity.posY, entity.posZ);
            entityareaeffectcloud.setRadius(5F);
            entityareaeffectcloud.setRadiusOnUse(-0.5F);
            entityareaeffectcloud.setWaitTime(10);
            entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration());
            entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / entityareaeffectcloud.getDuration());
            entityareaeffectcloud.addEffect(new PotionEffect(potion, potion == MobEffects.LEVITATION ? 100 : 1200, this.getPowered() ? 1 : 0));
            this.world.spawnEntity(entityareaeffectcloud);
        }
    }
    return true;
}
Also used : Entity(net.minecraft.entity.Entity) Potion(net.minecraft.potion.Potion) PotionEffect(net.minecraft.potion.PotionEffect) EntityAreaEffectCloud(net.minecraft.entity.EntityAreaEffectCloud) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Aggregations

EntityAreaEffectCloud (net.minecraft.entity.EntityAreaEffectCloud)4 PotionEffect (net.minecraft.potion.PotionEffect)3 Entity (net.minecraft.entity.Entity)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 Potion (net.minecraft.potion.Potion)1 PotionType (net.minecraft.potion.PotionType)1