Enchantment compatibility with enchantments from other mods

Started by Seshua on

Topic category: Help with modding (Java Edition)

Last seen on 01:18, 28. Mar 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Enchantment compatibility with enchantments from other mods

Okay so I made a pickaxe enchantment and in the options for it I've selected all the pickaxe enchantments that I want it to be able to have together except for silk touch, I don't want it to be able to be used with silk touch, But I do want it to be able to be used with enchantments from other mods. With these settings that isn't the case, it will only accept the enchantments that I have selected in my enchantment. Does anyone know a solution for this?

Last seen on 05:05, 30. Oct 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mcreator unfortunately only…
Sat, 05/14/2022 - 01:25

Mcreator unfortunately only allows for a Whitelist regarding enchantments, meaning only enchantments on the "list" are compatible with each other.  What would be considerably more useful would be a Blacklist function.  Thankfully it only requires a minor code edit to make this work.

 

Start off by listing all of the enchantments you DON'T want compatible with your new enchantment.  Include your new enchantment in this list.  Save.

 

Open your enchantment with the code editor and you will find something like this:

    @Override
    protected boolean checkCompatibility(Enchantment ench) {
        if (ench == Enchantments.SHARPNESS)
            return true;
        if (ench == Enchantments.SMITE)
            return true;
        if (ench == Enchantments.BANE_OF_ARTHROPODS)
            return true;
        if (ench == ValModModEnchantments.WOUNDING.get())
            return true;
        return false;
    }

For each enchantment listed change "return true" to "return false".

At the bottom, change "return false" to "return true"

Save and Lock.

 

 

This reverses the Whitelist functionality into a Blacklist.  In the above example, my new weapon enchantment is compatible with all other enchantments except the ones listed.

 

Last seen on 01:18, 28. Mar 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thankyou so much Valirane!…
Sat, 05/14/2022 - 01:30

Thankyou so much Valirane! Absolute Hero!

 

It was kinda devasting when I loaded my mod up with Cyclic just to find out I couldn't combine enchantments xD

Last seen on 14:02, 11. Nov 2023
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Does this still work for the…
Sat, 11/05/2022 - 09:23

Does this still work for the new versions of Mcreator? The code is kinda different from the one you showed