Armor Set Bonuses

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

Topic category: User side tutorials

Last seen on 06:27, 23. Sep 2019
Joined Jan 2018
User points:

Statistics:

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

0Upvote this forum topic
Last seen on 17:38, 27. Jan 2020
Joined Jun 2016
User points:

Statistics:

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

0Upvote this forum topic
Last seen on 13:51, 27. Jan 2020
Joined Feb 2016
User points:

Statistics:

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

Nice ^^

0Upvote this forum topic
Last seen on 13:23, 2. Oct 2019
Joined May 2017
User points:

Statistics:

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

big oof

0Upvote this forum topic
Last seen on 10:39, 28. Dec 2019
Joined Jun 2017
User points:

Statistics:

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

0Upvote this forum topic
Last seen on 22:32, 6. Dec 2019
Joined May 2019
User points:

Statistics:

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

0Upvote this forum topic
Last seen on 22:32, 6. Dec 2019
Joined May 2019
User points:

Statistics:

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

0Upvote this forum topic
Last seen on 17:08, 26. Jan 2020
Joined Jun 2016
User points:

Statistics:

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

0Upvote this forum topic