What is the highest effective enchantment level?

After reading this question, I wondered if the enchantment was actually effective up to a certain level, or does it just keep going up to the maximum enchantment level?

[Edited Clarification]: As an example, if I created a sword with the "Sharpness" enchantment at level 1, and for every level I increased the enchantment, would it become more powerful for every level I increased it, or would it stop at a certain level?


Solution 1:

Outdated answer for pre-1.13:

The maximum effective enchantment will be dependent per enchantment. The following relies on excerpts taken from the source using 1.9 Mod Coder Pack

To restate from the linked question: the technical minimum and maximum is -32,768 to 32,767 due to the level being read as a short. Inputting any values outside that range will cause it to overflow to be within that range.

Regular/Fire/Blast/Projectile Protection, Feather Falling

All of these enchantments are grouped up together and reduce incoming damage taken. The base damage reduction modifier will be modified depending on the type of enchantment as well as the level:

Protection            = enchantmentLevel
Fire Protection       = enchantmentLevel * 2
Blast Protection      = enchantmentLevel * 2
Projectile Protection = enchantmentLevel * 2
Feather Falling       = enchantmentLevel * 3

This is done per-item and totalled up. If I had two Fire Protection II enchantments, the final value is 8 ((2 * 2) + (2 * 2)). If I had one Fire Protection III and one Protection II, the final value is 8 (2 + (3 * 2)). This does take into consideration having multiple "protection" enchantments on the same piece of armor (such that a Protection V and Blast Protection III iron chestplate will indeed further reduce damage than having only one or the other).

Once this initial modifier value is obtained, it is pushed through the following formula:

newDamageTaken = oldDamageTaken * (1.0 - clamp_float(modifier, 0.0F, 20.0F) / 25)

Due to the clamp between 0.0 and 20.0, the highest total modifier value is only 20.0, and the minimum is also 0.0. Negative enchantment levels will essentially do nothing for these enchantments.

As such, the following are the highest viable enchantment levels for damage reduction, provided it's the only enchantment used (as mixing them will change the highest value, since they are all clumped into the same modifier value):

Protection            = 20
Fire Protection       = 10
Blast Protection      = 10
Projectile Protection = 10
Feather Falling       = 7

Maximum range of levels for individual effectiveness of secondary benefits:

Fire Protection (reducing "set on fire" duration) = minimum 1, maximum 32767
Blast Protection (knockback resistance)           = minimum 1, maximum 32767

Note that secondary benefits are not a total of levels, but the highest enchantment level available among armor pieces. If there are multiple of the same enchantment on the item, then only the first in the list will be checked.

Respiration

The following code determines whether or not the player will lose air underwater.

level > 0 && this.rand.nextInt(level + 1) > 0 ? currentAir : currentAir - 1;

Provided the enchantment level is 1+, a random integer value between 0 and level + 1 is chosen. If that chosen value is higher than 0, then the player will not lose air. Therefore, the minimum level is 1 and the maximum is 32,767 (greatly decreasing the chances of 0 being chosen).

Aqua Affinity

The following code determines whether or not the player's block-breaking speed will be divided by 5.0:

if (this.isInsideOfMaterial(Material.water) && !EnchantmentHelper.hasAquaAffinity(this))
{
    efficiency /= 5.0F;
}

Therefore, both the minimum and maximum levels for Aqua Affinity is 1.

Depth Strider

The following code obtains the player's Depth Strider enchantment level, and if it's greater than 3.0, it will be reduced back to 3.0.

float depthStrider = (float)EnchantmentHelper.func_185294_d(this);

if (depthStrider > 3.0F)
{
    depthStrider = 3.0F;
}

...

if (depthStrider > 0.0F)
{
    // Modify current speed
}

Because the player's speed will only be modified if the enchantment level is greater than 0, the minimum is 1 and maximum is 3.

Frost Walker

Provided the player's Frost Walker level is higher than 0, the following modification is done to the level before being used:

float range = (float)Math.min(16, 2 + level);

The smallest of the two values will be chosen, meaning the minimum is 1 and maximum is 14.

Thorns

The following code determines whether or not the enchantment will work in the first place.

level <= 0 ? false : random.nextFloat() < 0.15F * (float)level;

As long as the enchantment level is 1 or higher, there is a 0.15 * level chance of the enchantment working. From this alone, a maximum enchantment level of 7 will ensure damage it dealt.

But the following code determines the damage to deal:

level > 10 ? level - 10 : 1 + random.nextInt(4);

If the enchantment level is greater than 10, the damage dealt is equal to level - 10. However, it does not clamp this final value.

Therefore, the minimum is 1 and the maximum is 32,767 (which will deal 32,757 damage).

Efficiency

Provided the enchantment level is higher than 0, the following modifies the player's efficiency based on the Efficiency enchantment:

efficiency += (float)(level * level + 1);

Therefore, the minimum is 1 and the maximum is 32,767. The maximum is relevant per-block, so the "harder" the block the higher the level is needed to instant-mine it.

Silk Touch

Like Aqua Affinity, all that is checked is if the enchantment level is higher than 0, therefore the minimum and maximum is 1.

Fortune

This one is much more difficult to go through because it differs per-block. Under unlisted circumstances, assume that the minimum is -32,768 and maximum is 32,767.

Some notable examples:

  1. Crops drop seeds at 3 + level rate, meaning a negative enchantment level will actually prevent seeds from dropping (while still providing the crop).
  2. Glowstone dust is clamped between 1 and 4, with +1 per level, which would mean the minimum level for effectiveness is 1 and the maximum is 3.
  3. Gravel will set the input fortune level to 3 if it's higher. Negative levels work fine, so minimum is -32,768 (greatly reducing the chance of flint dropping).
  4. Melons will choose the lowest value between 1 + level and 9. Since there's no clamping, the minimum is -32,768 (no melons drop) and maximum is 8.
  5. Nether wart requires a minimum of 1, but can have a maximum of 32,767.
  6. All ores require a minimum of 1, but can have a maximum of 32,767, except redstone ore (where minimum is -32,768 to drop nothing).
  7. Sea lanterns are clamped between 1 and 5, with +1 per level, which would mean the minimum level for effectiveness is 1 and the maximum is 4.

Unbreaking

Nothing particularly special here, just the usual minimum of 1, maximum of 32,767.

Luck of the Sea

Nothing special either, minimum of -32,768, maximum of 32,767.

Lure

Minimum of -32,768, maximum of 8. Due to the way the time reduction works, any higher than 8 prevents anything from "biting". A negative level will indeed drastically increase the amount of time it takes to catch anything.

Mending

Like Aqua Affinity, all that is checked is if the enchantment level is higher than 0, therefore the minimum and maximum is 1.

Power, Punch

Both have a minimum of 1 and maximum of 32,767.

Flame

Like Aqua Affinity, all that is checked is if the enchantment level is higher than 0, therefore the minimum and maximum is 1. It will always set the fire duration to 100 ticks.

Infinity

Like Aqua Affinity, all that is checked is if the enchantment level is higher than 0, therefore the minimum and maximum is 1.

Sharpness, Smite, Bane of Arthropods

Just like the Protection enchantments, these are grouped together into one single modifier.

The following formulas provide the damage modifier to apply to the struck mob:

Sharpness          = 1.0F + Math.max(0, level - 1) * 0.5F
Smite              = level * 2.5F
Bane of Arthropods = level * 2.5F

Therefore for Sharpness, the minimum effectiveness level is 1 while the maximum is 32,767. Negative values will do nothing for Sharpness.

For Smite and Bane of Arthropods though, the level can be negative but the final resulting damage cannot be lower than 0. But since the player can receive an item to deal basically any amount of damage, the minimum value is indeed -32,768 for Smite and Bane of Arthropods.

Knockback

A minimum level of 1 is required, with a maximum of 32,767.

Fire Aspect

The minimum level is 1. The maximum is technically still 32,767, but the following modifies the duration:

entityIn.setFire(level * 4);

Since the Fire tag is also saved as a short, 32767 * 4 would exceed the maximum and overflow. Therefore, the maximum level without causing overflow is 8,191.

Looting

The minimum is 1 with a maximum of 32,767.


Two new enchantments, though referred to as "curses", were added to 1.11.

Curse of Binding

All that's checked is if the level is greater than 0, so the effective minimum and maximum is 1. This goes for both a player trying to move armor, as well as mobs trying to swap out for better equipment in their ArmorItems list while their CanPickUpLoot flag is true.

Curse of Vanishing

Just like the Binding curse, only a level greater than 0 is checked (thus a minimum and maximum effective level of 1). This goes for both the player inventory and the HandItems/ArmorItems lists for mobs.

Solution 2:

Updated answer for 1.13+

This answer shows how enchantments will behave when their maximum enchantment level is exceeded with commands. See this answer for the maximum displayable enchantment level on the item tooltip.

For these enchantments… Their minimum
effective value is…
Their maximum
effective value is…
Some additional notes are…
Aqua Affinity, Channeling, Curse of Vanishing, Flame, Infinity, Mending, Multishot, Piercing, Silk Touch 1 1 These enchantments only make changes based on their presence/absence, and are not affected by the enchantment level.
  • Bane of Arthropods
  • Impaling
  • Smite
  • 1.17+: 1
  • 1.16−: -2 147 483 648
  • 1.17+: 255
  • 1.16−: 2 147 483 647
In 1.17+, levels higher than 255 are clamped. In 1.16−, there was no imposed limit by game code.
  • Sharpness
  • Thorns
  • 0
  • 1
  • 1.17+: 255
  • 1.16−: 2 147 483 647
  • Sharpness 0 technically does add a small amount of damage to the item.
    • Protection
    • Fire Protection
    • Blast Protection
    • Projectile Protection
    1
    • 20
    • 10
    • 255
    • 10
    Higher levels are capped at their respective maximum.
    Depth Strider 1 3
    Feather Falling 1 7
    Frost Walker 1 14
    • Loyalty
    • Piercing
    1 127 Higher levels cause the enchantment to cease to function.
    Lure 1 5 Higher levels will cause the fishing mechanic to cease to function. The fishing rod can still be cast, but nothing can ever be caught.
    Quick Charge 1 5 Higher levels prevent the crossbow from charging. It can still be fired if charged, but cannot be charged again.
    Efficiency, Fire Aspect, Fortune, Knockback, Looting, Luck of the Sea, Power, Punch, Respiration, Soul Speed, Sweeping Edge, Unbreaking 1 255 Higher levels are capped.

    If I missed an enchantment, please add a comment!

    For more information, see the reference used to create this chart: Max effective values for enchantments

    Solution 3:

    Outdated answer: 1.12−

    It stops becoming more Powerful

    To test this I gave myself higher level sharpness swords.

    /give @a minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:1000}]}
    
    /give @a minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:5000}]}
    /give @a minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:10000}]}
    
    /give @a minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:100000}]}
    
    /give @a minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:32767}]}
    

    After I reached level 32767 as posted in the other question, here was the Attack Damage of my sword:

    enter image description here When I even added one more enchantment level this is what happened: enter image description here

    It went negative then subtracted one whole enchantment level!

    Edit:

    When I switched it around either up one negative or down one negative this is what happens starting at 32768:

    Down one number: /give @a minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:-32766}]}

    enter image description here

    (I tested going down because with negative numbers you can't tell up from down). It didn't flip when I subtracted two from a negative number like it did for one with the positive number, however it did flip after one higher number was added to the number:

    /give @a minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:-32769}]}
    

    enter image description here