Jump to content

Recommended Posts

Posted

Class: [EnchantmentList]

@ObjectHolder(Main.modid)
public class EnchantmentList {
    
    public static final Enchantment soul_eater = new SoulEater();
    
    @Mod.EventBusSubscriber(modid = Main.modid)
    public static class RegistrationHandler
    {
        
        /**
         * On event.
         *
         * @param event the event
         */
        @SubscribeEvent
        public static void onEvent(final RegistryEvent.Register<Enchantment> event)
        {
            // DEBUG
            System.out.println("Registering Enchantments");

            final IForgeRegistry<Enchantment> registry = event.getRegistry();
                        
            registry.register(new SoulEater());            
        }
    }
}

Class: [Soul Eater]

public class SoulEater extends Enchantment {

    public SoulEater() {
        super(Rarity.COMMON, EnchantmentType.WEAPON, new EquipmentSlotType[] {EquipmentSlotType.MAINHAND});
        setRegistryName(new ResourceLocation(Main.modid + ":soul_eater"));
    }
    
    @Override
    public int getMinEnchantability(int enchantmentLevel) {
        return 20 * enchantmentLevel;
    }
    
    @Override
    public int getMaxEnchantability(int enchantmentLevel) {
        return this.getMinEnchantability(enchantmentLevel) + 10;
    }
    
    @Override
    public int getMaxLevel() {
        return 1;
    }
    
    //@Override
    //protected boolean canApplyTogether(Enchantment ench) {
    //    return super.canApplyTogether(ench) && ench != Enchantments.BLAST_PROTECTION;
    //}

}

 

I watched a harry talks tutorial on making custom enchantments for 1.12.2 and I looked at Jabelar's Minecraft Forge Modding Tutorials. I cant seem to get the enchantment ingame. Am I doing something wrong?

 
 
 

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.