Search in sources :

Example 71 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.

the class SpellSelfHeal method performEffect.

@Override
public void performEffect(RayTraceResult rtrace, EntityLivingBase caster, World world) {
    if (caster != null) {
        caster.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 160, 0, false, true));
        caster.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 160, 0, false, false));
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 72 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.

the class PotionBloodDrained method performEffect.

@Override
public void performEffect(EntityLivingBase entity, int amplifier) {
    IBloodReserve br = entity.getCapability(CapabilityBloodReserve.CAPABILITY, null);
    float amount = br.getPercentFilled();
    if (amount > 0 && amount < TRESHOLD) {
        if (br.getDrinkerUUID() != null)
            entity.attackEntityFrom(new DamageSourceDrain(entity.world.getPlayerEntityByUUID(br.getDrinkerUUID())), 0.5f);
        if (br.getDrinkerUUID() != null)
            entity.setRevengeTarget(entity.world.getPlayerEntityByUUID(br.getDrinkerUUID()));
        entity.addPotionEffect(new PotionEffect(this, 200, amplifier));
    } else {
        entity.removePotionEffect(this);
        br.setDrinker(null);
    }
}
Also used : IBloodReserve(com.bewitchment.api.capability.transformations.IBloodReserve) PotionEffect(net.minecraft.potion.PotionEffect)

Example 73 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.

the class RitualConjurationWitch method onFinish.

@Override
public void onFinish(EntityPlayer player, TileEntity tile, World world, BlockPos pos, NBTTagCompound data) {
    if (!world.isRemote) {
        EntityWitch witch = new EntityWitch(world);
        witch.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), (float) (Math.random() * 360), 0);
        witch.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(witch)), (IEntityLivingData) null);
        world.spawnEntity(witch);
        if (Math.random() < 0.1)
            witch.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 6000, 2, false, false));
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) BlockPos(net.minecraft.util.math.BlockPos) EntityWitch(net.minecraft.entity.monster.EntityWitch)

Example 74 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.

the class BrewUtils method serialize.

public static NBTTagCompound serialize(Collection<Object> collection) {
    List<BrewEffect> brewEffects = new ArrayList<>();
    List<PotionEffect> potionEffects = new ArrayList<>();
    for (Object brew : collection) {
        if (brew instanceof BrewEffect) {
            brewEffects.add((BrewEffect) brew);
        } else if (brew instanceof PotionEffect) {
            potionEffects.add((PotionEffect) brew);
        }
    }
    NBTTagCompound compound = new NBTTagCompound();
    appendPotions(compound, mixPotions(potionEffects));
    appendBrews(compound, mixBrews(brewEffects));
    return compound;
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 75 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Cavern2 by kegare.

the class EntityCavenicSpider method attackEntityAsMob.

@Override
public boolean attackEntityAsMob(Entity entity) {
    if (super.attackEntityAsMob(entity)) {
        if (entity instanceof EntityLivingBase) {
            EntityLivingBase target = (EntityLivingBase) entity;
            int sec = getBlindnessAttackPower();
            if (sec > 0 && !target.isPotionActive(MobEffects.BLINDNESS)) {
                target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, sec * 20));
            }
            sec = getPoisonAttackPower();
            if (sec > 0 && !target.isPotionActive(MobEffects.POISON)) {
                target.addPotionEffect(new PotionEffect(MobEffects.POISON, sec * 20));
            }
        }
        return true;
    }
    return false;
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Aggregations

PotionEffect (net.minecraft.potion.PotionEffect)367 EntityLivingBase (net.minecraft.entity.EntityLivingBase)115 EntityPlayer (net.minecraft.entity.player.EntityPlayer)89 ItemStack (net.minecraft.item.ItemStack)62 BlockPos (net.minecraft.util.math.BlockPos)48 Entity (net.minecraft.entity.Entity)36 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)35 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)34 World (net.minecraft.world.World)26 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)24 Potion (net.minecraft.potion.Potion)21 IBlockState (net.minecraft.block.state.IBlockState)20 ArrayList (java.util.ArrayList)19 WorldServer (net.minecraft.world.WorldServer)19 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)17 List (java.util.List)14 Random (java.util.Random)14 NBTTagList (net.minecraft.nbt.NBTTagList)14 TileEntity (net.minecraft.tileentity.TileEntity)13 SPacketEntityEffect (net.minecraft.network.play.server.SPacketEntityEffect)9