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,

I have recently tried to get back into modding after the 1.12 update.  I have looked at the documentation and it seems to show a new way to register items.  I have followed it's instructions to the best of my ability but it still doesn't work.  Can anyone tell me what im doing wrong?

Spoiler

package com.drok.progressiveg;

import com.drok.progressiveg.common.items.ItemAK47;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod.EventBusSubscriber
public class Register {

	public static Item ak47 = new ItemAK47();
	
	@SubscribeEvent
    public void registerItems(RegistryEvent.Register<Item> event) {
		GunMod.log("Registering Items");
		
        event.getRegistry().registerAll(
        			ak47
        		);
        
        GunMod.log("Registered Items");
    }
    
    @SubscribeEvent
    public void registerBlocks(RegistryEvent.Register<Block> event) {
        event.getRegistry().registerAll(
        		
        		);
    }
	
}

 


package com.drok.progressiveg;

import com.drok.progressiveg.common.items.*;

import net.minecraft.block.*;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.*;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@Mod(useMetadata = true, modid = "progressiveg")
public class GunMod
{
    
    public static final CreativeTabs TAB = new CreativeTabs(CreativeTabs.getNextID(), "guns")
    {
        @SideOnly(Side.CLIENT)
        public ItemStack getTabIconItem()
        {
            return new ItemStack(Register.ak47);
        }
    };
    
    
    public static void log(String msg) {
    	System.out.println("[Progressive Guns]" + msg);
    	
    }
    
    @EventHandler
    public void preinit(FMLPreInitializationEvent event)
    {
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    }
    
    @EventHandler
    public void postinit(FMLPostInitializationEvent event)
    {
    }
    
    
    
}

 

 

9 minutes ago, drok0920 said:

@SubscribeEvent

public void registerItems(RegistryEvent.Register<Item> event) {

GunMod.log("Registering Items");

event.getRegistry().registerAll( ak47 );

GunMod.log("Registered Items");

}

 

@SubscribeEvent

public void registerBlocks(RegistryEvent.Register<Block> event) {

event.getRegistry().registerAll( );

}

These methods need to be static.

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

  • Author
2 minutes ago, Kokkie said:

These methods need to be static.

Ok it worked thank you.  I cant believe it was that simple of a fix.

  • Author
1 minute ago, Dylem said:

I don't say that you need to do the same, but I really like @Choonster way of handling items

here is his file on github : github.com

Yes i plan on making it more organized like the example you provided.  I just wanted to get it to register first.

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.