Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.