Search in sources :

Example 66 with PotionEffect

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

the class IncantationFisheye method cast.

// Todo: Make this only affect vision.
@SuppressWarnings("ConstantConditions")
@Override
public void cast(EntityPlayer sender, String[] args) {
    sender.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 275, 0));
    sender.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 275, 0));
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 67 with PotionEffect

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

the class ItemHoney method onFoodEaten.

@Override
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
    player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 450, 0));
    player.addPotionEffect(new PotionEffect(MobEffects.LUCK, 450, 0));
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 68 with PotionEffect

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

the class ItemTriskelionAmulet method onWornTick.

@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
    if (itemstack.getItemDamage() == 0 && player.ticksExisted % 40 == 0) {
        player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 120, 0, true, true));
        player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 120, 0, true, true));
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 69 with PotionEffect

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

the class FortuneMeetUberSilverfish method apply.

@Override
public boolean apply(EntityPlayer player) {
    for (int i = 0; i < 10; i++) {
        BlockPos pos = new BlockPos(player.posX + player.getRNG().nextGaussian() * 4, player.posY, player.posZ + player.getRNG().nextGaussian() * 4);
        EntitySilverfish silverfish = new EntitySilverfish(player.world);
        if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(silverfish)) {
            silverfish.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
            silverfish.onInitialSpawn(player.world.getDifficultyForLocation(pos), null);
            player.world.spawnEntity(silverfish);
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                silverfish.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                silverfish.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                silverfish.addPotionEffect(new PotionEffect(MobEffects.SPEED, 900, 1));
            if (player.getRNG().nextInt(10) < player.world.getDifficulty().ordinal())
                silverfish.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 900, 1));
            return true;
        }
    }
    return false;
}
Also used : EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish) PotionEffect(net.minecraft.potion.PotionEffect) BlockPos(net.minecraft.util.math.BlockPos)

Example 70 with PotionEffect

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

the class BrewSimpleModifier method apply.

@Override
public boolean apply(List<Object> brews, Object current) {
    if (current instanceof PotionEffect) {
        PotionEffect effect = (PotionEffect) current;
        if (effect.getDuration() < 9600) {
            int hue = MathHelper.clamp(effect.getDuration() + duration, 0, 9600);
            effect.combine(new PotionEffect(effect.getPotion(), hue, effect.getAmplifier()));
        }
        if (effect.getAmplifier() < 3) {
            int hue = MathHelper.clamp(effect.getAmplifier() + amplifier, 0, 3);
            effect.combine(new PotionEffect(effect.getPotion(), effect.getDuration(), hue));
        }
    } else if (current instanceof BrewEffect) {
        BrewEffect effect = (BrewEffect) current;
        if (effect.getDuration() < 9600) {
            int hue = MathHelper.clamp(effect.getDuration() + duration, 0, 9600);
            effect.setDuration(hue);
        }
        if (effect.getAmplifier() < 3) {
            int hue = MathHelper.clamp(effect.getAmplifier() + amplifier, 0, 3);
            effect.setAmplifier(hue);
        }
    }
    return true;
}
Also used : BrewEffect(com.bewitchment.common.brew.BrewEffect) PotionEffect(net.minecraft.potion.PotionEffect)

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