Search in sources :

Example 46 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Wizardry by TeamWizardry.

the class PotionLowGrav method fall.

@SubscribeEvent
public void fall(LivingFallEvent event) {
    EntityLivingBase entity = event.getEntityLiving();
    if (!entity.isPotionActive(this))
        return;
    PotionEffect effect = entity.getActivePotionEffect(this);
    if (effect == null)
        return;
    event.setDistance((float) (event.getDistance() / (effect.getAmplifier() + 0.5)));
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 47 with PotionEffect

use of net.minecraft.potion.PotionEffect in project BaseMetals by MinecraftModDevelopmentMods.

the class MMDToolEffects method applyEffectsForStarsteel.

private static void applyEffectsForStarsteel(final EntityPlayer player) {
    if (!starsteelUpdateCache.containsKey(player)) {
        return;
    }
    final int num = starsteelUpdateCache.get(player).getAndSet(0);
    if (num == 0) {
        return;
    }
    final PotionEffect jumpBoost = new PotionEffect(MobEffects.JUMP_BOOST, EFFECT_DURATION, num - 1, false, false);
    player.addPotionEffect(jumpBoost);
    if (num > 1) {
        final PotionEffect speedBoost = new PotionEffect(MobEffects.SPEED, EFFECT_DURATION, num - 2, false, false);
        player.addPotionEffect(speedBoost);
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 48 with PotionEffect

use of net.minecraft.potion.PotionEffect in project BaseMetals by MinecraftModDevelopmentMods.

the class MMDToolEffects method applyEffectsForColdiron.

private static void applyEffectsForColdiron(final EntityPlayer player) {
    if (hasFullSuit(player, MaterialNames.COLDIRON)) {
        final PotionEffect fireProtection = new PotionEffect(MobEffects.FIRE_RESISTANCE, EFFECT_DURATION, 0, false, false);
        player.addPotionEffect(fireProtection);
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 49 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Wizardry by TeamWizardry.

the class ModuleEffectCrasherFall method run.

@Override
public boolean run(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    Entity targetEntity = spell.getVictim();
    if (targetEntity instanceof EntityLivingBase) {
        double strength = spellRing.getAttributeValue(AttributeRegistry.POTENCY, spell);
        double duration = spellRing.getAttributeValue(AttributeRegistry.DURATION, spell) * 10;
        if (!spellRing.taxCaster(spell))
            return false;
        ((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(ModPotions.CRASH, (int) duration, (int) strength, true, true));
    }
    return true;
}
Also used : Entity(net.minecraft.entity.Entity) PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 50 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Wizardry by TeamWizardry.

the class ModuleEffectLowGravity method run.

@Override
@SuppressWarnings("unused")
public boolean run(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
    World world = spell.world;
    Entity targetEntity = spell.getVictim();
    BlockPos targetPos = spell.getTargetPos();
    Entity caster = spell.getCaster();
    double potency = spellRing.getAttributeValue(AttributeRegistry.POTENCY, spell);
    double time = spellRing.getAttributeValue(AttributeRegistry.DURATION, spell);
    if (!spellRing.taxCaster(spell))
        return false;
    if (targetEntity != null) {
        spell.world.playSound(null, targetEntity.getPosition(), ModSounds.TELEPORT, SoundCategory.NEUTRAL, 1, 1);
        ((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(ModPotions.LOW_GRAVITY, (int) time, (int) potency, true, false));
    }
    return true;
}
Also used : Entity(net.minecraft.entity.Entity) PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World)

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