Search in sources :

Example 91 with PotionEffect

use of net.minecraft.potion.PotionEffect in project Random-Things by lumien231.

the class ModPotions method preInit.

public static void preInit(FMLPreInitializationEvent event) {
    imbueFire = new ImbueFire();
    imbuePoison = new ImbuePoison();
    imbueExperience = new ImbueExperience();
    imbueWither = new ImbueWither();
    imbueCollapse = new ImbueCollapse();
    collapse = new EffectCollapse();
    collapseType = new PotionType("rtcollapse", new PotionEffect(collapse, 450));
    collapseTypeLong = new PotionType("rtcollapse", new PotionEffect(collapse, 900));
    collapseTypeStrong = new PotionType("rtcollapse", new PotionEffect(collapse, 300, 1));
    collapseType.setRegistryName(new ResourceLocation("randomthings", "collapse"));
    collapseTypeLong.setRegistryName(new ResourceLocation("randomthings", "long_collapse"));
    collapseTypeStrong.setRegistryName(new ResourceLocation("randomthings", "strong_collapse"));
    ForgeRegistries.POTION_TYPES.register(collapseType);
    ForgeRegistries.POTION_TYPES.register(collapseTypeLong);
    ForgeRegistries.POTION_TYPES.register(collapseTypeStrong);
    // Brewing
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(ModItems.ingredients, 1, 0)), collapseType);
    PotionHelper.addMix(collapseType, Items.REDSTONE, collapseTypeLong);
    PotionHelper.addMix(collapseType, Items.GLOWSTONE_DUST, collapseTypeStrong);
}
Also used : ImbueWither(lumien.randomthings.potion.imbues.ImbueWither) ImbueCollapse(lumien.randomthings.potion.imbues.ImbueCollapse) ImbueExperience(lumien.randomthings.potion.imbues.ImbueExperience) PotionEffect(net.minecraft.potion.PotionEffect) ResourceLocation(net.minecraft.util.ResourceLocation) ImbuePoison(lumien.randomthings.potion.imbues.ImbuePoison) ImbueFire(lumien.randomthings.potion.imbues.ImbueFire) EffectCollapse(lumien.randomthings.potion.effects.EffectCollapse) PotionType(net.minecraft.potion.PotionType) ItemStack(net.minecraft.item.ItemStack)

Example 92 with PotionEffect

use of net.minecraft.potion.PotionEffect in project harvestcraft by MatrexsVigil.

the class ItemPamTopTierFood method onFoodEaten.

@Override
protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("strength"), ConfigHandler.buffTimeForTopTier, 0));
    par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("resistance"), ConfigHandler.buffTimeForTopTier, 0));
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 93 with PotionEffect

use of net.minecraft.potion.PotionEffect in project KalStuff by TEAMModding.

the class ItemDrink method addEffects.

protected void addEffects(ItemStack stack, World worldIn, EntityPlayer player) {
    if (!worldIn.isRemote && this.potionLength != 0) {
        for (Potion p : this.potions) {
            try {
                player.addPotionEffect(new PotionEffect(p, ((this.potionLength / (this.getMaxDamage(stack) + 1)) + player.getActivePotionEffect(p).getDuration()), 0));
            } catch (NullPointerException e) {
                player.addPotionEffect(new PotionEffect(p, (this.potionLength / (this.getMaxDamage(stack) + 1)), 0));
            }
            if (player.getActivePotionEffect(p).getDuration() > 7200) {
                player.removePotionEffect(p);
                player.addPotionEffect(new PotionEffect(p, 7200, 0));
            }
        }
    }
}
Also used : Potion(net.minecraft.potion.Potion) PotionEffect(net.minecraft.potion.PotionEffect)

Example 94 with PotionEffect

use of net.minecraft.potion.PotionEffect in project RFTools by McJty.

the class TeleportationTools method applyEffectForSeverity.

public static void applyEffectForSeverity(EntityPlayer player, int severity, boolean boostNeeded) {
    getPotions();
    switch(severity) {
        case 1:
            if (boostNeeded) {
                player.addPotionEffect(new PotionEffect(confusion, 100));
                player.addPotionEffect(new PotionEffect(harm, 5));
            }
            break;
        case 2:
            player.addPotionEffect(new PotionEffect(harm, 100));
            break;
        case 3:
            player.addPotionEffect(new PotionEffect(harm, 100));
            player.attackEntityFrom(DamageSource.GENERIC, 0.5f);
            break;
        case 4:
            player.addPotionEffect(new PotionEffect(harm, 200));
            player.attackEntityFrom(DamageSource.GENERIC, 0.5f);
            break;
        case 5:
            player.addPotionEffect(new PotionEffect(harm, 200));
            player.attackEntityFrom(DamageSource.GENERIC, 1.0f);
            break;
        case 6:
            player.addPotionEffect(new PotionEffect(harm, 300));
            player.attackEntityFrom(DamageSource.GENERIC, 1.0f);
            break;
        case 7:
            player.addPotionEffect(new PotionEffect(harm, 300));
            player.addPotionEffect(new PotionEffect(wither, 200));
            player.attackEntityFrom(DamageSource.GENERIC, 2.0f);
            break;
        case 8:
            player.addPotionEffect(new PotionEffect(harm, 400));
            player.addPotionEffect(new PotionEffect(wither, 300));
            player.attackEntityFrom(DamageSource.GENERIC, 2.0f);
            break;
        case 9:
            player.addPotionEffect(new PotionEffect(harm, 400));
            player.addPotionEffect(new PotionEffect(wither, 400));
            player.attackEntityFrom(DamageSource.GENERIC, 3.0f);
            break;
        case 10:
            player.addPotionEffect(new PotionEffect(harm, 500));
            player.addPotionEffect(new PotionEffect(wither, 500));
            player.attackEntityFrom(DamageSource.GENERIC, 3.0f);
            break;
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect)

Example 95 with PotionEffect

use of net.minecraft.potion.PotionEffect in project TecTech by Technus.

the class GT_MetaTileEntity_Hatch_OverflowElemental method vapePollution.

private void vapePollution(IGregTechTileEntity mte) {
    float xPos = mte.getXCoord() + 0.5f;
    float yPos = mte.getYCoord() + 0.5f;
    float zPos = mte.getZCoord() + 0.5f;
    int xDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetX;
    int yDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetY;
    int zDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetZ;
    AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xPos - .5 + xDirShift, yPos - .5 + yDirShift, zPos - .5 + zDirShift, xPos + .5 + xDirShift, yPos + 1.5 + yDirShift, zPos + .5 + zDirShift);
    for (Object entity : mte.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, aabb)) {
        float damagingFactor = (float) Math.log(overflowDisperse);
        ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.confusion.id, 1, (int) (damagingFactor * 20)));
        ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id, 2, (int) (damagingFactor * 15)));
        ((EntityLivingBase) entity).attackEntityFrom(elementalPollution, damagingFactor);
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) 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