[1.7.x/1.8][Forge] Making custom armor that adds potion effects and more

I often see requests for tutorials on custom armor that adds potion effects or is resistant to a certain type of damage, so I figured I'd make one. This tutorial assumes you know the basics of Java, Minecraft modding, and have your mod setup already. To begin, create a new class that extends ItemArmor and implements ISpecialArmor. *Note* I am not going to hold your hand and write this line by line for you. I am going to show you code from a mod I have been working on and will explain it in commented lines. Also, I have noticed a lot of off topic requests in this post. No, I am not going to make a bukkit plugin or mod specifically for you, nor am I going to help you with things that this title does not suggest.

If you just want armor that adds a potion effect, skip this part and read the next section!

A very important part of this is going to be some called "ArmorProperties", this allows us to modify that damage dealt to a player that is wearing this armor. It's constructor has three parts. Priority, AbsorbRatio, and AbsorbMax, in that order. Priority determines which piece of armor gets damaged first, I usually set it to 1 so all pieces get damaged at the same time. I'm not entirely sure what AbsorbRatio does(Sorry ), and AbsorbMax is the maximum amount of damage one piece of armor can absorb. *Note* this method gets called PER PIECE of armor, so if you want a full suit of armor to absorb all fire damage dealt to it do not just have the armor check for fire damage then return an instance of ArmorProperties that has AbsorbMax set to Integer.MAX_VALUE or else the user can just craft some boots then be fire proof.

For this example we are going to use a armor set I wrote called ItemPyrusArmor, that is very resistant to fire damage:

It is really that easy! However, you SHOULD NOT do anything with the player that would be disabled once the armor is taken off. For example, do not set player.capabilities.canFly to true then try to set it to false when the player is not wearing the armor because the method will no longer be called when the player is not wearing the armor. Potion effects are ok because the game will remove them once the timer runs out.

I hope this tutorial was able to help you guys out! If you need any help, feel free to post in the comments. Happy modding!

Would it be possible to change the way a mob behaves while wearing armor, like instead of having endermen ignore you while wearing a pumpkin, but having a creeper ignore you while wearing armor?

And what would the DamageSource be if it were an explosion? I tried using setExplosion() but it doesn't seem to be working correctly, as it affects all damage not including explosions too.
I apologize if any questions are dumb, but I only recently began modding.

Rollback Post to RevisionRollBack

Fact: Using flint and steel on a creeper causes them to stop in place and blow up.

Would it be possible to change the way a mob behaves while wearing armor, like instead of having endermen ignore you while wearing a pumpkin, but having a creeper ignore you while wearing armor?

And what would the DamageSource be if it were an explosion? I tried using setExplosion() but it doesn't seem to be working correctly, as it affects all damage not including explosions too.
I apologize if any questions are dumb, but I only recently began modding.

Using setExplosion() would set the damage source to an explosion, which may not be accurate. I believe there is a method or field that determines whether or not is an explosion, check around DamageSource.class