So having read the wiki, I can see that there is a limit to how many enchants you can actually have on each armour piece, and if you somehow go beyond that they will stop working?
So does this mean if you get Protection 5 on each piece, it just won't work? Or it will be the same as Protection 4?
What about Protection 4 plus Fire Protection 3 on each piece? Will that work? Will they cancel each other out?
And finally does Unbreaking 4 and above affect anything?
I am just trying to figure out how this works as I want to add custom armour rewards to my server.
The only limit is a cap of 20 EPF for all pieces of armor combined, against whatever specific forms of damage are reduced, so if you have Protection 5 on all pieces (5 * 4 = 20) you'll max out damage reduction for all forms of damage that enchantments are effective against and the same goes for Protection 20 on a single piece (20 * 1 = 20). If you also add Fire or Blast Protection to either of these you will still get their secondary benefits of reduced burn time and knockback from explosions (these also scale past level 4; at level 7+ they should completely eliminate them unless there is a cap (at least in 1.6.4 the code shows that there isn't) since then the calculated reduction (level * 15%) exceeds 100%):
When a player or mob wearing armor is subjected to damage, the EPFs of all applicable enchantments are added together, capped at 20, and then damage is reduced as damage = damage * ( 1 - cappedEPF / 25 ), giving a maximum reduction of 80% at EPF 20.
Because of the caps in the calculation, it is possible to achieve maximum protection against specific types of damage with just three pieces of armor. For example, two pieces of armor with Blast Protection IV (EPF 8 each) and a single piece with Protection IV (EPF 4) would give a total EPF of 20 versus explosions. Any additional EPF would be wasted against explosions (but might be useful against other types of damage, if applicable).
Likewise, even without commands or mods Feather Falling and Protection stack with no penalty (they are both internally a type of "Protection" enchantment, the only case where two such enchantments can legitimately be put on a single piece, except for a short time in 1.14). This also goes for melee damage enchantments, but not Power, Unbreaking (even if you put two instances on the same item the game will only choose the first enchantment listed), Mending, or most other enchantments (Fortune and Silk Touch can be used on the same tool but Fortune will only work on blocks that Silk Touch doesn't. Levels are also meaningless for enchantments that simply grant an effect when used, like Mending, Silk Touch, and Aqua Affinity).
I understand but not completely. If I have Prot IV, Unb IV, Fire Prot IV on every piece, and then Feather Falling IV on boots, will ALL of it work?
Yes; the only limit is applied after the game calculates all the protections, and none override any others during the calculations; this is from direct analysis of the game's code; it adds up the effects of every enchantment applicable to the type of damage (note that this is from 1.6.4 but the only thing that has changed since then is that the maximum EPF was reduced from 25 to 20 and the random factor of 50-100% was removed, and the effectiveness of the types of protection were changed. It certainly did work the same way in 1.14 and I haven't seen any reports to the contrary; "god" armor crafted in 1.14 still works in later versions):
/**
* Returns the modifier of protection enchantments on armors equipped on player.
*/
public static int getEnchantmentModifierDamage(ItemStack[] par0ArrayOfItemStack, DamageSource par1DamageSource)
{
enchantmentModifierDamage.damageModifier = 0;
enchantmentModifierDamage.source = par1DamageSource;
applyEnchantmentModifierArray(enchantmentModifierDamage, par0ArrayOfItemStack);
if (enchantmentModifierDamage.damageModifier > 25) enchantmentModifierDamage.damageModifier = 25;
return Math.min(20, (enchantmentModifierDamage.damageModifier + 1 >> 1) + enchantmentRand.nextInt((enchantmentModifierDamage.damageModifier >> 1) + 1));
}
/**
* Executes the enchantment modifier on the array of ItemStack passed.
*/
private static void applyEnchantmentModifierArray(IEnchantmentModifier par0IEnchantmentModifier, ItemStack[] par1ArrayOfItemStack)
{
ItemStack[] var2 = par1ArrayOfItemStack;
int var3 = par1ArrayOfItemStack.length;
for (int var4 = 0; var4 < var3; ++var4)
{
ItemStack var5 = var2[var4];
applyEnchantmentModifier(par0IEnchantmentModifier, var5);
}
}
/**
* Executes the enchantment modifier on the ItemStack passed.
*/
private static void applyEnchantmentModifier(IEnchantmentModifier par0IEnchantmentModifier, ItemStack par1ItemStack)
{
if (par1ItemStack != null)
{
NBTTagList var2 = par1ItemStack.getEnchantmentTagList();
if (var2 != null)
{
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
short var4 = ((NBTTagCompound)var2.tagAt(var3)).getShort("id");
short var5 = ((NBTTagCompound)var2.tagAt(var3)).getShort("lvl");
if (Enchantment.enchantmentsList[var4] != null) par0IEnchantmentModifier.calculateModifier(Enchantment.enchantmentsList[var4], var5);
}
}
}
}
What all this means is that the game calls "getEnchantmentModifierDamage" with all the pieces of armor that the player (or mob) is wearing, which in turn calls "applyEnchantmentModifierArray", which adds up the effects of every single enchantment on every single piece; the method "applyEnchantmentModifier" checks each enchantment and uses it to apply the appropriate calculations:
/**
* Generic method use to calculate modifiers of offensive or defensive enchantment values.
*/
public void calculateModifier(Enchantment par1Enchantment, int par2)
{
this.damageModifier += par1Enchantment.calcModifierDamage(par2, this.source);
}
public int calcModifierDamage(int par1, DamageSource par2DamageSource)
{
if (par2DamageSource.canHarmInCreative()) return 0;
float var3 = (float)(6 + par1 * par1) / 3.0F;
// Protection
if (this.protectionType == 0) return MathHelper.floor_float(var3 * 0.75F);
// Fire Protection
if (this.protectionType == 1 && par2DamageSource.isFireDamage()) return MathHelper.floor_float(var3 * 1.25F);
// Feather Falling
if (this.protectionType == 2 && par2DamageSource == DamageSource.fall) return MathHelper.floor_float(var3 * 2.5F);
// Blast Protection
if (this.protectionType == 3 && par2DamageSource.isExplosion()) return MathHelper.floor_float(var3 * 1.5F);
// Projectile Protection
if (this.protectionType == 4 && par2DamageSource.isProjectile() return MathHelper.floor_float(var3 * 1.5F);
return 0;
}
"calculateModifier" (called by "applyEnchantmentModifier") adds up the modifier for each enchantment by calling "calcModifierDamage", which individually checks for every type of Protection and the damage it can apply to, which is only limited by the final calculations after everything is done ( <= 25 EPF, then randomized to 50-100% of that (rounded up so the max is 13-20 EPF), then limited to 20. Since 1.9 it is simply limited to 20, making maxed-out enchantments more effective (a constant 80% damage reduction instead of a random 52-80%)
But the way you're saying it is that if you have 4x Prot 5, it will take up all of the EPF, so surely adding like Fire Prot III will do nothing?
That is true, but you can mix e.g. Blast Protection and Fire Protection and you'll be able to get the benefits of both (in addition to their non-damage reduction benefits when you have Protection). The way you previously worded things also made it sound like they wouldn't work at all:
So does this mean if you get Protection 5 on each piece, it just won't work? Or it will be the same as Protection 4?
What about Protection 4 plus Fire Protection 3 on each piece? Will that work? Will they cancel each other out?
The answers to both are no; Protection 4 on all pieces only gives you 16 EPF while Protection 5 gives 20; as mentioned before, you can even have one piece with Protection 20, or two with Protection 10. Likewise, you can put multiple enchantments on one piece and they will all work for the particular damage sources they protect against, with Protection affecting everything so if you do get 20 EPF from this alone there is no point in having anything else, unless you want the reduced burn time from Fire Protection or increased explosion knockback resistance from Blast Protection (in your second example the total EPF is 16 for all damage except for fire damage, which is 40 prior to being capped; the effect on burn time is -45% as the highest level on any piece is used, so a single piece with Fire Protection 4 would be better, and still reach 24 EPF).
Out of curiosity, if I have Prot IV on all pieces, and Fire Prot III on just boots and helmet, if someone starts hitting me with a Fire Aspect diamond sword, will any of the enchants not work? Because surely against this sword, both the Prot and Fire Prot would have to work at the same time, but they won't be able to because of the EPF limit?
All of the enchantments will work, it's just that the protection is limited to 80% against all types of damage.
They get added up first and then the limit is applied.
So just the Prot IV * 4 will give you 64% (I think) against both the normal damage and the fire damage, the Fire Prot III * 2 would add 48% for a total of 112% protection against fire but since the limit is 80% you get 64% protection against the sword damage and 80% protection against the fire.
Plus, the Fire Prot will make the fire go out faster.
--
Or, if you prefer to think of it that way, only 1/3 of the Fire Protection is used because that's all that is needed to bring you up to max protection against fire damage. You still get the full burn time reduction though. So a single Fire Prot II would give you the same protection against fire damage (you'd get less burn time reduction from Fire Prot II but a single Fire Prot III would be as effective in every way as the 2 in your example).
So having read the wiki, I can see that there is a limit to how many enchants you can actually have on each armour piece, and if you somehow go beyond that they will stop working?
So does this mean if you get Protection 5 on each piece, it just won't work? Or it will be the same as Protection 4?
What about Protection 4 plus Fire Protection 3 on each piece? Will that work? Will they cancel each other out?
And finally does Unbreaking 4 and above affect anything?
I am just trying to figure out how this works as I want to add custom armour rewards to my server.
The only limit is a cap of 20 EPF for all pieces of armor combined, against whatever specific forms of damage are reduced, so if you have Protection 5 on all pieces (5 * 4 = 20) you'll max out damage reduction for all forms of damage that enchantments are effective against and the same goes for Protection 20 on a single piece (20 * 1 = 20). If you also add Fire or Blast Protection to either of these you will still get their secondary benefits of reduced burn time and knockback from explosions (these also scale past level 4; at level 7+ they should completely eliminate them unless there is a cap (at least in 1.6.4 the code shows that there isn't) since then the calculated reduction (level * 15%) exceeds 100%):
Likewise, even without commands or mods Feather Falling and Protection stack with no penalty (they are both internally a type of "Protection" enchantment, the only case where two such enchantments can legitimately be put on a single piece, except for a short time in 1.14). This also goes for melee damage enchantments, but not Power, Unbreaking (even if you put two instances on the same item the game will only choose the first enchantment listed), Mending, or most other enchantments (Fortune and Silk Touch can be used on the same tool but Fortune will only work on blocks that Silk Touch doesn't. Levels are also meaningless for enchantments that simply grant an effect when used, like Mending, Silk Touch, and Aqua Affinity).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
I understand but not completely. If I have Prot IV, Unb IV, Fire Prot IV on every piece, and then Feather Falling IV on boots, will ALL of it work?
Yes; the only limit is applied after the game calculates all the protections, and none override any others during the calculations; this is from direct analysis of the game's code; it adds up the effects of every enchantment applicable to the type of damage (note that this is from 1.6.4 but the only thing that has changed since then is that the maximum EPF was reduced from 25 to 20 and the random factor of 50-100% was removed, and the effectiveness of the types of protection were changed. It certainly did work the same way in 1.14 and I haven't seen any reports to the contrary; "god" armor crafted in 1.14 still works in later versions):
What all this means is that the game calls "getEnchantmentModifierDamage" with all the pieces of armor that the player (or mob) is wearing, which in turn calls "applyEnchantmentModifierArray", which adds up the effects of every single enchantment on every single piece; the method "applyEnchantmentModifier" checks each enchantment and uses it to apply the appropriate calculations:
"calculateModifier" (called by "applyEnchantmentModifier") adds up the modifier for each enchantment by calling "calcModifierDamage", which individually checks for every type of Protection and the damage it can apply to, which is only limited by the final calculations after everything is done ( <= 25 EPF, then randomized to 50-100% of that (rounded up so the max is 13-20 EPF), then limited to 20. Since 1.9 it is simply limited to 20, making maxed-out enchantments more effective (a constant 80% damage reduction instead of a random 52-80%)
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
But the way you're saying it is that if you have 4x Prot 5, it will take up all of the EPF, so surely adding like Fire Prot III will do nothing?
That is true, but you can mix e.g. Blast Protection and Fire Protection and you'll be able to get the benefits of both (in addition to their non-damage reduction benefits when you have Protection). The way you previously worded things also made it sound like they wouldn't work at all:
The answers to both are no; Protection 4 on all pieces only gives you 16 EPF while Protection 5 gives 20; as mentioned before, you can even have one piece with Protection 20, or two with Protection 10. Likewise, you can put multiple enchantments on one piece and they will all work for the particular damage sources they protect against, with Protection affecting everything so if you do get 20 EPF from this alone there is no point in having anything else, unless you want the reduced burn time from Fire Protection or increased explosion knockback resistance from Blast Protection (in your second example the total EPF is 16 for all damage except for fire damage, which is 40 prior to being capped; the effect on burn time is -45% as the highest level on any piece is used, so a single piece with Fire Protection 4 would be better, and still reach 24 EPF).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
Out of curiosity, if I have Prot IV on all pieces, and Fire Prot III on just boots and helmet, if someone starts hitting me with a Fire Aspect diamond sword, will any of the enchants not work? Because surely against this sword, both the Prot and Fire Prot would have to work at the same time, but they won't be able to because of the EPF limit?
All of the enchantments will work, it's just that the protection is limited to 80% against all types of damage.
They get added up first and then the limit is applied.
So just the Prot IV * 4 will give you 64% (I think) against both the normal damage and the fire damage, the Fire Prot III * 2 would add 48% for a total of 112% protection against fire but since the limit is 80% you get 64% protection against the sword damage and 80% protection against the fire.
Plus, the Fire Prot will make the fire go out faster.
--
Or, if you prefer to think of it that way, only 1/3 of the Fire Protection is used because that's all that is needed to bring you up to max protection against fire damage. You still get the full burn time reduction though. So a single Fire Prot II would give you the same protection against fire damage (you'd get less burn time reduction from Fire Prot II but a single Fire Prot III would be as effective in every way as the 2 in your example).
Just testing.