Posted June 24, 20178 yr 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) { } }
June 24, 20178 yr 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
June 24, 20178 yr 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.
June 24, 20178 yr 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
June 24, 20178 yr 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.