Armor Set Bonuses

Started by Odahviing on Fri, 03/22/2019 - 15:45

Topic category: User side tutorials

Last seen on 21:18, 24. Mar 2019
Joined Jan 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Armor Set Bonuses
Fri, 03/22/2019 - 15:45

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 13:20, 24. Aug 2019
Joined Jun 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 03:21, 23. Aug 2019
Joined Feb 2016
User points:

Statistics:

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

Nice ^^

Last seen on 14:02, 24. Aug 2019
Joined May 2017
User points:

Statistics:

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

big oof

Last seen on 09:56, 20. Aug 2019
Joined Jun 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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.