Big_Bad_E Posted September 3, 2017 Share Posted September 3, 2017 So, with this new weird 1.12 API, I can't manage to get items to work. I have been messing around but can't seem to find my problem. Item Class: package MoBuildingBlocks.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemSword; import net.minecraftforge.event.RegistryEvent; public class ItemSaw extends ItemSword { public static Item ItemSaw; public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(ItemSaw=new ItemSword(Item.ToolMaterial.IRON).setUnlocalizedName("saw").setRegistryName("mobuildingblocks","saw")); } public ItemSaw(ToolMaterial material) { super(material); } } Common Proxy: package MoBuildingBlocks.Proxy; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import MoBuildingBlocks.Items.ItemSaw; import MoBuildingBlocks.Registrys.RegistryHandler; public class CommonProxy { public void preInit(FMLPreInitializationEvent event) { RegistryHandler.Common(); } public void Init(FMLInitializationEvent event) { } public void postInit(FMLPostInitializationEvent event) { } @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event, ToolMaterial material) { event.getRegistry().register(new ItemSaw(material)); } } Item Registry: package MoBuildingBlocks.Registrys; import net.minecraftforge.fml.common.registry.GameRegistry; import MoBuildingBlocks.Items.ItemSaw; public class ItemRegistry { @GameRegistry.ObjectHolder("mbb:saw") public static ItemSaw saw; } That's all the classes I have to do with the item, nothing in my main class except the PreInit, Init, and PostInit, and my ClientProxy is the same. The mod name is Mo' Building Blocks, the mod ID is mbb, the item is called Saw, the texture is in a folder called Items and it is called Saw. Quote Link to comment Share on other sites More sharing options...
CoderAtParadise Posted September 3, 2017 Share Posted September 3, 2017 You need to either register the event in preinit or annotate the class with @Mod.EventBusSubscriber Quote Did you really need to know? Link to comment Share on other sites More sharing options...
Draco18s Posted September 3, 2017 Share Posted September 3, 2017 event.getRegistry().register(ItemSaw=new ItemSword(... event.getRegistry().register(new ItemSaw(... Wot. Why do you have two different RegistryEvent handlers? Not that either one of them is actually subscribed to the event bus. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
Big_Bad_E Posted September 3, 2017 Author Share Posted September 3, 2017 (edited) Oh, lol I just realized that. I saw the subscribe thing when looking through examples but forgot that I registered both of them register it... darp Edited September 3, 2017 by Big_Bad_E Grammer... Quote Link to comment Share on other sites More sharing options...
Big_Bad_E Posted September 3, 2017 Author Share Posted September 3, 2017 Still not working... Item Class: package MoBuildingBlocks.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemSword; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber public class ItemSaw extends Item { public static Item ItemSaw; public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(ItemSaw=new Item().setUnlocalizedName("saw").setRegistryName("mobuildingblocks","saw")); } public ItemSaw(ToolMaterial material) { super(); } } I removed the register thing from my proxy Item Registry: package MoBuildingBlocks.Registrys; import net.minecraftforge.fml.common.registry.GameRegistry; import MoBuildingBlocks.Items.ItemSaw; public class ItemRegistry { @GameRegistry.ObjectHolder("mbb:saw") public static ItemSaw saw; } I have no other things related to the item in my other classes, which I may need it in one .-. Also if anyone knows what to do in my event.getRegistry to put it in a creative tab Quote Link to comment Share on other sites More sharing options...
Draco18s Posted September 3, 2017 Share Posted September 3, 2017 If you're using @GameRegistry.ObjectHolder then you don't need to do this: ItemSaw= The whole point of ObjectHolder annotations is to set the field for you. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
Recommended Posts
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.