Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

(1.14.4) New Enchantment not showing up


ImperialDragon99
 Share

Recommended Posts

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?

 
 
 
Link to comment
Share on other sites

2 minutes ago, ImperialDragon99 said:

public static final Enchantment soul_eater = new SoulEater();

This instance is never registered.

 

5 minutes ago, ImperialDragon99 said:

@Mod.EventBusSubscriber(modid = Main.modid)

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

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.