Jump to content

[1.6.4] Making enchantments incompatible with other enchantments


Recommended Posts

Posted

Hello,

 

So I've been working on a mod to add a new enchantment for digging tools that I want to make incompatible with Silk Touch. If I override the canApplyTogether method in my Enchantment class I can make it so a tool already enchanted with Silk Touch cannot have my enchantment applied to it but not vice-versa.

 

Here is my Enchantment Class:

 

package mm347.jake_enchants;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentDigging;
import net.minecraft.enchantment.EnumEnchantmentType;

public class EnchantmentSuperHeat extends EnchantmentDigging {

protected EnchantmentSuperHeat(int par1, int par2) {

	super(par1, par2);
	this.setName("superHeat");

}

public int getMinEnchantability(int par1) {
	return 1 + 10 *(par1 - 1);
}

    public int getMaxEnchantability(int par1) {
    	
        return super.getMinEnchantability(par1) + 50;
    }

public int getMaxLevel() {

	return 1;
}

public boolean canApplyTogether(Enchantment enchantment) {

	return super.canApplyTogether(enchantment) && enchantment.effectId != Enchantment.silkTouch.effectId;
}
}

 

TL;DR How do I ensure that my enchantment remains 100% incompatible with specific other enchantments?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.