Z
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
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:
Crops drop seeds at 3 + level rate, meaning a negative enchantment level will actually prevent seeds from dropping (while still providing the crop).
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.
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).
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.
Nether wart requires a minimum of 1, but can have a maximum of 32,767.
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).
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.