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

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?

 
 
 
  • Author
7 minutes ago, diesieben07 said:

This instance is never registered.

 

The registry event fires on the mod event bus, you are registering for Forge's main event bus here.

Thanks for your help I managed to get it to work

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.