Limiting weapon enchantments count

Started by TeamGustavKlara on Sat, 12/05/2020 - 11:24

Topic category: Help with MCreator software

Last seen on 20:19, 7. Dec 2020
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Limiting weapon enchantments count
Sat, 12/05/2020 - 11:24

I want to make a weapon that supports multiple different custom enchantments, but can only have one enchantment on it at a time. So if i enchanted the weapon with an enchantment, that weapon could no longer be enchanted with any other enchantments. I don't see any way of doing this, other then something with the "can be applied with" and setting that to something that doesnt exist.

Last seen on 17:09, 9. Sep 2021
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
@Override         protected…
Sun, 12/06/2020 - 12:43

@Override
        protected boolean canApplyTogether(Enchantment ench) {
         
            if (!(ench == ThunderingEnchantment.enchantment))
                return true;
            return false;
        }

You can edit the enchantment code to make it so if the enchantment is not thundering you can apply the enchantment.

Just change the name of ThunderingEnchantment to whatever your enchantment is called + "Enchantment.enchantment"