#Custom enchant on custom item only

8 messages · Page 1 of 1 (latest)

mild sandal
#

I have a custom enchantment that for testing purpose have 0 effects.
For now the target is BOW but i only want this enchantment to have my custom item as target but can't find a way to do it

public class HarmonyEnchant extends TerraEnchantment {
    public HarmonyEnchant() {
        super(Enchantment.Rarity.RARE, EnchantmentTarget.BOW, new EquipmentSlot[]{EquipmentSlot.MAINHAND});
    }

    @Override
    public int getMinPower(int level) {
        return 50; // impossible to get vanilla
    }

    @Override
    public boolean isAvailableForEnchantedBookOffer() {
        return false;
    }

    public boolean isAvailableForRandomSelection() {
        return false;
    }
}
worthy star
#

isAcceptableItem

mild sandal
#

I've already tried so much things using this and mixins

#

But can't find a way to make it work

worthy star
mild sandal
#
public class HarmonyEnchant extends TerraEnchantment {
    public HarmonyEnchant() {
        super(Enchantment.Rarity.RARE, EnchantmentTarget.BREAKABLE, new EquipmentSlot[]{EquipmentSlot.MAINHAND});
    }

    @Override
    public int getMinPower(int level) {
        return 50; // impossible to get vanilla
    }

    @Override
    public boolean isAvailableForEnchantedBookOffer() {
        return false;
    }

    @Override
    public boolean isAvailableForRandomSelection() {
        return false;
    }

    @Override
    public boolean isAcceptableItem(ItemStack stack) {
        Item item = stack.getItem();
        return item instanceof RodOfDiscord;
    }
}

It's even worse now since the enchant can go on every items that have durabillity

#

Ok my bad creative mod diff