net.minecraft.enchantment

## Class Enchantment

- java.lang.Object
- - net.minecraft.enchantment.Enchantment

- Direct Known Subclasses:
    EnchantmentArrowDamage, EnchantmentArrowFire, EnchantmentArrowInfinite, EnchantmentArrowKnockback, EnchantmentDamage, EnchantmentDigging, EnchantmentDurability, EnchantmentFireAspect, EnchantmentKnockback, EnchantmentLootBonus, EnchantmentOxygen, EnchantmentProtection, EnchantmentThorns, EnchantmentUntouching, EnchantmentWaterWorker

      public abstract class Enchantment
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Enchantment` | `aquaAffinity` Increases underwater mining rate
    `static Enchantment` | `baneOfArthropods` Extra damage to spiders, cave spiders and silverfish
    `static Enchantment` | `blastProtection` Protection against explosions
    `int` | `effectId`
    `static Enchantment` | `efficiency` Faster resource gathering while in use
    `static Enchantment[]` | `enchantmentsBookList` The list of enchantments applicable by the anvil from a book
    `static Enchantment[]` | `enchantmentsList`
    `static Enchantment` | `featherFalling` Less fall damage
    `static Enchantment` | `fireAspect` Lights mobs on fire
    `static Enchantment` | `fireProtection` Protection against fire
    `static Enchantment` | `flame` Flame enchantment for bows.
    `static Enchantment` | `fortune` Can multiply the drop rate of items from blocks
    `static Enchantment` | `infinity` Infinity enchantment for bows.
    `static Enchantment` | `knockback` Knocks mob and players backwards upon hit
    `static Enchantment` | `looting` Mobs have a chance to drop more loot
    `static Enchantment` | `power` Power enchantment for bows, add's extra damage to arrows.
    `static Enchantment` | `projectileProtection` Protection against projectile entities (e.g.
    `static Enchantment` | `protection` Converts environmental damage to armour damage
    `static Enchantment` | `punch` Knockback enchantments for bows, the arrows will knockback the target when hit.
    `static Enchantment` | `respiration` Decreases the rate of air loss underwater; increases time between damage while suffocating
    `static Enchantment` | `sharpness` Extra damage to mobs
    `static Enchantment` | `silkTouch` Blocks mined will drop themselves, even if it should drop something else (e.g.
    `static Enchantment` | `smite` Extra damage to zombies, zombie pigmen and skeletons
    `static Enchantment` | `thorns`
    `EnumEnchantmentType` | `type` The EnumEnchantmentType given to this Enchantment.
    `static Enchantment` | `unbreaking` Sometimes, the tool's durability will not be spent when the tool is used

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addToBookList(Enchantment enchantment)` Add to the list of enchantments applicable by the anvil from a book
    `int` | `calcModifierDamage(int par1, DamageSource par2DamageSource)` Calculates de damage protection of the enchantment based on level and damage source passed.
    `float` | `calcModifierLiving(int par1, EntityLivingBase par2EntityLivingBase)` Calculates de (magic) damage done by the enchantment on a living entity based on level and entity passed.
    `boolean` | `canApply(ItemStack par1ItemStack)`
    `boolean` | `canApplyAtEnchantingTable(ItemStack stack)` This applies specifically to applying at the enchanting table.
    `boolean` | `canApplyTogether(Enchantment par1Enchantment)` Determines if the enchantment passed can be applyied together with this enchantment.
    `int` | `getMaxEnchantability(int par1)` Returns the maximum value of enchantability nedded on the enchantment level passed.
    `int` | `getMaxLevel()` Returns the maximum level that the enchantment can have.
    `int` | `getMinEnchantability(int par1)` Returns the minimal value of enchantability needed on the enchantment level passed.
    `int` | `getMinLevel()` Returns the minimum level that the enchantment can have.
    `String` | `getName()` Return the name of key in translation table of this enchantment.
    `String` | `getTranslatedName(int par1)` Returns the correct traslated name of the enchantment and the level in roman numbers.
    `int` | `getWeight()`
    `boolean` | `isAllowedOnBooks()` Is this enchantment allowed to be enchanted on books via Enchantment Table
    `Enchantment` | `setName(String par1Str)` Sets the enchantment name

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### enchantmentsList

          public static final Enchantment[] enchantmentsList

    - #### enchantmentsBookList

          public static final Enchantment[] enchantmentsBookList

      The list of enchantments applicable by the anvil from a book

    - #### protection

          public static final Enchantment protection

      Converts environmental damage to armour damage

    - #### fireProtection

          public static final Enchantment fireProtection

      Protection against fire

    - #### featherFalling

          public static final Enchantment featherFalling

      Less fall damage

    - #### blastProtection

          public static final Enchantment blastProtection

      Protection against explosions

    - #### projectileProtection

          public static final Enchantment projectileProtection

      Protection against projectile entities (e.g. arrows)

    - #### respiration

          public static final Enchantment respiration

      Decreases the rate of air loss underwater; increases time between damage while suffocating

    - #### aquaAffinity

          public static final Enchantment aquaAffinity

      Increases underwater mining rate

    - #### thorns

          public static final Enchantment thorns

    - #### sharpness

          public static final Enchantment sharpness

      Extra damage to mobs

    - #### smite

          public static final Enchantment smite

      Extra damage to zombies, zombie pigmen and skeletons

    - #### baneOfArthropods

          public static final Enchantment baneOfArthropods

      Extra damage to spiders, cave spiders and silverfish

    - #### knockback

          public static final Enchantment knockback

      Knocks mob and players backwards upon hit

    - #### fireAspect

          public static final Enchantment fireAspect

      Lights mobs on fire

    - #### looting

          public static final Enchantment looting

      Mobs have a chance to drop more loot

    - #### efficiency

          public static final Enchantment efficiency

      Faster resource gathering while in use

    - #### silkTouch

          public static final Enchantment silkTouch

      Blocks mined will drop themselves, even if it should drop something else (e.g. stone will drop stone, not cobblestone)

    - #### unbreaking

          public static final Enchantment unbreaking

      Sometimes, the tool's durability will not be spent when the tool is used

    - #### fortune

          public static final Enchantment fortune

      Can multiply the drop rate of items from blocks

    - #### power

          public static final Enchantment power

      Power enchantment for bows, add's extra damage to arrows.

    - #### punch

          public static final Enchantment punch

      Knockback enchantments for bows, the arrows will knockback the target when hit.

    - #### flame

          public static final Enchantment flame

      Flame enchantment for bows. Arrows fired by the bow will be on fire. Any target hit will also set on fire.

    - #### infinity

          public static final Enchantment infinity

      Infinity enchantment for bows. The bow will not consume arrows anymore, but will still required at least one arrow on inventory use the bow.

    - #### effectId

          public final int effectId

    - #### type

          public EnumEnchantmentType type

      The EnumEnchantmentType given to this Enchantment.

  - ### Method Detail

    - #### getWeight

          public int getWeight()

    - #### getMinLevel

          public int getMinLevel()

      Returns the minimum level that the enchantment can have.

    - #### getMaxLevel

          public int getMaxLevel()

      Returns the maximum level that the enchantment can have.

    - #### getMinEnchantability

          public int getMinEnchantability(int par1)

      Returns the minimal value of enchantability needed on the enchantment level passed.

    - #### getMaxEnchantability

          public int getMaxEnchantability(int par1)

      Returns the maximum value of enchantability nedded on the enchantment level passed.

    - #### calcModifierDamage

          public int calcModifierDamage(int par1,
                               DamageSource par2DamageSource)

      Calculates de damage protection of the enchantment based on level and damage source passed.

    - #### calcModifierLiving

          public float calcModifierLiving(int par1,
                                 EntityLivingBase par2EntityLivingBase)

      Calculates de (magic) damage done by the enchantment on a living entity based on level and entity passed.

    - #### canApplyTogether

          public boolean canApplyTogether(Enchantment par1Enchantment)

      Determines if the enchantment passed can be applyied together with this enchantment.

    - #### setName

          public Enchantment setName(String par1Str)

      Sets the enchantment name

    - #### getName

          public String getName()

      Return the name of key in translation table of this enchantment.

    - #### getTranslatedName

          public String getTranslatedName(int par1)

      Returns the correct traslated name of the enchantment and the level in roman numbers.

    - #### canApply

          public boolean canApply(ItemStack par1ItemStack)

    - #### canApplyAtEnchantingTable

          public boolean canApplyAtEnchantingTable(ItemStack stack)

      This applies specifically to applying at the enchanting table. The other method `canApply(ItemStack)` applies for all possible enchantments.
      Parameters:
        `stack` -
      Returns:

    - #### addToBookList

          public static void addToBookList(Enchantment enchantment)

      Add to the list of enchantments applicable by the anvil from a book
      Parameters:
        `enchantment` -

    - #### isAllowedOnBooks

          public boolean isAllowedOnBooks()

      Is this enchantment allowed to be enchanted on books via Enchantment Table
      Returns:
        false to disable the vanilla feature