Enchantment compatibility with enchantments from other mods

Started by Seshua on Sat, 05/14/2022 - 00:29

Topic category: Help with modding (Java Edition)

Last seen on 16:02, 17. Jun 2022
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Enchantment compatibility with enchantments from other mods
Sat, 05/14/2022 - 00:29

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:18, 29. Jun 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 16:02, 17. Jun 2022
Joined Apr 2020
Points:

User statistics:

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