Armor Set Bonuses

Started by Odahviing on

Topic category: User side tutorials

Last seen on 21:12, 14. Jul 2023
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Armor Set Bonuses

I finally figured out a way to do this! :D 

This was done in MCreator 1.7.3 (as my mod is for MC 1.7.10). For newer versions this should still work, but I'm not promising for now.

This tutorial is for potion effects as set bonuses, but if you search for the code and imports you can do loads of things!

1. Create your armor as normal.

2. Open your armor element in the Code tab.

3. At the start of your code, you should see a bunch of lines that say 'import -something-'. Right beneath those, you should add:

import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;

 

4. Scroll down and find the lines that say public void onArmorTick() (or something similar). There is a different one for each piece of armor, but we only need one (I used the leggings armor here).

5. Add the following code inside the brackets, replacing the names appropriately. You should replace 'AssassinArmor' with the name of your armor mod element on the three lines..

if (entity.getCurrentArmor(2) != null && entity.getCurrentArmor(2).getItem().equals(mcreator_assassinArmor.body)) {
                    if (entity.getCurrentArmor(3) != null && entity.getCurrentArmor(3).getItem().equals(mcreator_assassinArmor.helmet)) {
                         if (entity.getCurrentArmor(0) != null && entity.getCurrentArmor(0).getItem().equals(mcreator_assassinArmor.boots)) {

                            ///This is where we put the potion effects
                         }
                    }
                   }

6. Where the writing in bold is above, add the following line:

entity.addPotionEffect(new PotionEffect(1, 15, 1));

Replace the numbers to your liking. The first number is the potion effect to give (a list is here). The second number is the duration in ticks (20 ticks = 1 second). The last is the amplifier (this is one higher than the level you want, for example I put 1 meaning I will get a level 2 effect.

The above example gives Speed 2. You can copy and edit this line to add more effects. 

Save and enjoy!!

Last seen on 14:52, 1. Oct 2020
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You don't need custom code…
Wed, 05/15/2019 - 16:47

You don't need custom code for this. You can simply have a procedure for 'on helmet (or any armour piece of your set) tick event' that checks for the other pieces using the procedure block that determines this, and if all pieces are present, it applies the bonus.

Last seen on 20:43, 14. Feb 2024
Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nice ^^
Mon, 05/20/2019 - 16:13

Nice ^^

Last seen on 07:58, 13. Apr 2020
Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
big oof
Thu, 08/15/2019 - 14:00

big oof

Last seen on 11:35, 27. Mar 2023
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can don't to all this…
Thu, 08/15/2019 - 14:18

You can don't to all this. You can just put 4 "if" blocks together (each one with one of the armor piece) and than make what you want at the end.

Last seen on 22:32, 6. Dec 2019
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Actually putting four if…
Sat, 08/24/2019 - 18:10

Actually putting four if statements returns me an error, however the compilation fails even if I use the code above.

Last seen on 22:32, 6. Dec 2019
Joined May 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Edit: I got it to work, 0 is…
Sat, 08/24/2019 - 18:17

Edit: I got it to work, 0 is the boots, 1 for leggings, 2 for chestplate and 3 for helmet.You only need 3 if statements.

Last seen on 07:51, 16. Jul 2020
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Coul'd you please send and…
Wed, 10/16/2019 - 16:46

Coul'd you please send and explain me the code? I need this for Armors and i don't understand this coding relly good, because i never coded before.