Beta 1.9 Prerelease 5
short
for an item's enchantment level crashes Minecraft. Therefore, no enchantment can have a level above 32767 or below -32768.
Enchantment | Formula | Effective Range | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Start a running total. For each enchant, add (level² + 6) / 2 if the enchant protects against the taken damage. For feather falling, add twice. Cap the total at 25. Add one, then divide by two. Now add a random number between 0 and the total. Cap the new total at 20. If the total is one or greater, set the new incoming damage equal to (damage * (25 - total)) / 25 .Since the level gets squared, negative levels behave as their absolute value. |
0 to 7
|
||||||||||||||||||||
Respiration | Take the first respiration enchant on each piece of armor. If the largest one is greater than zero, has a one in 1 + level chance to still decrease the air level each tick while in water. |
1 to 32767
|
||||||||||||||||||||
Aqua Affinity | Take the first aqua affinity enchant on each piece of armor. If the largest one is greater than zero, skip mining speed multiplier when underwater. | 1
|
||||||||||||||||||||
|
Start a running total. For each sharpness enchant, add level * 3 . For each smite/bane enchant, add level * 4 if the target is undead/arthropod, respectively. If the total is one or greater, deal a random amount of bonus damage between 1 and the total.Negative levels can offset the total. For example, Sharpness 5 with Smite -5 will deal 1-15 bonus damage to non-undead monsters, but no bonus damage to undead ones. You can never do less than zero bonus damage, however. |
|
||||||||||||||||||||
Knockback | Take the first knockback enchant on the tool. Add level bonus knockback to the attack.Bonus knockback is only applied when greater than zero. However, sprinting adds one bonus knockback. Therefore, negative levels can prevent sprinting knockback from working. |
-1 to 32767
|
||||||||||||||||||||
Fire Aspect | Take the first fire aspect enchant on the tool. If it's greater than zero, set the mob on fire for level * 4 seconds (level * 80 ticks). |
1 to 32767
|
||||||||||||||||||||
Looting | Take the first looting enchantment on the tool. Do something different for each mob:
level is greater than zero, drop between 0 and level more. |
-3 to 32767
|
||||||||||||||||||||
Efficiency | Take the first efficiency enchant on the tool. If greater than zero, add level² + 1 to your mining speed. |
1 to 32767
|
||||||||||||||||||||
Silk Touch | Take the first silk touch enchant on the tool. If greater than zero, broken blocks drop themselves instead of the normal drops. | 1
|
||||||||||||||||||||
Unbreaking | Take the first unbreaking enchant on the tool. If greater than zero, has a one in level + 1 chance to still take durability damage when used. |
1 to 32767
|
||||||||||||||||||||
Fortune | Take the first fortune enchantment on the tool. Do something different for each block:
|
-32768 to 32767 |
Relevant pieces of code:
EnchantmentHelper.getEnchantmentLevel
: Finds the level of a specific enchantment on an item. If the item has multiple copies of the enchantment, it always takes the first one. It's used directly by these helper functions:
getKnockbackModifier
- Called by
EntityPlayer.attackTargetEntityWithCurrentItem
- Called by
getFireAspectModifier
- Called by
EntityPlayer.attackTargetEntityWithCurrentItem
- Ultimately passed to
Entity.setFire
- Called by
getEfficiencyModifier
- Called by
EntityPlayer.getCurrentPlayerStrVsBlock
- Called by
getUnbreakingModifier
- Called by
ItemStack.damageItem
- Called by
getSilkTouchModifier
(boolean)- Called by
Block.harvestBlock
(overridden by many blocks)
- Called by
getFortuneModifier
- Called by
Block.harvestBlock
(overridden by many blocks) - Ultimately passed to
Block.dropBlockAsItemWithChance
,Block.quantityDroppedWithBonus
, andBlock.idDropped
(each of which are overridden by some blocks)
- Called by
getLootingModifier
- Called by
EntityLiving.onDeath
- Ultimately passed to
EntityLiving.dropFewItems
(overridden by many entities)
- Called by
EnchantmentHelper.getMaxEnchantmentLevel
: Takes multiple items, and finds the highest level of a specific enchantment present among those items. This ues getEnchantmentLevel
, so again only the first copy of each enchantment is considered for each item. It's used directly by these helper functions:
getRespiration
- Called by
EntityPlayer.decreaseAirSupply
- Called by
getAquaAffinityModifier
(boolean)- Called by
EntityPlayer.getCurrentPlayerStrVsBlock
- Called by
EnchantmentHelper.getEnchantmentModifierDamage
: Formula for reducing damage with protection enchantments.
- Called by
EntityPlayer.applyPotionDamageCalculations
EnchantmentHelper.getEnchantmentModifierLiving
: Formula for increasing damage with damage enchantments.
- Called by
EntityPlayer.attackTargetEntityWithCurrentItem
All of these EnchantmentHelper methods ultimately call CompoundTag.getShort
.
Information for later versions will follow
Is this planned to be updated for 1.17?