LeChevalierD_Or Posted October 22, 2017 Share Posted October 22, 2017 (edited) Hello I have a problem in 1.12 at the line "GameRegistry.register (item); can you help me here is my code: package com.cubicdeath.blocks; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class CubicDeath_Blocks{ public CubicDeath_Blocks() { initItems(); registerItem(logo); registerRender(logo, 0); } public Item logo; public void initItems() { logo = new Item().setRegistryName("logo").setUnlocalizedName("logo"); } @SideOnly(Side.CLIENT) public void registerItem(Item item) { GameRegistry.register(item); } public void registerRender(Item item, int meta) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation("test", item.getUnlocalizedName().substring(5)), "inventory")); } } Edited October 22, 2017 by LeChevalierD_Or Quote Link to comment Share on other sites More sharing options...
Draco18s Posted October 22, 2017 Share Posted October 22, 2017 Quote 1.12 Quote "GameRegistry.register (item); You're doing everything wrong. You need to use the Registry events. http://mcforge.readthedocs.io/en/latest/concepts/registries/#registering-things 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...
LeChevalierD_Or Posted October 23, 2017 Author Share Posted October 23, 2017 Hello, Thank you for your answer. here is my code now: package com.cubicdeath.blocks; import net.minecraft.block.Block; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; public class CubicDeath_Blocks{ @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { event.getResult().registerAll(Block1); } } Can you now give me the whole code with a block and features so that I can understand better. Thank you in advance . Quote Link to comment Share on other sites More sharing options...
LeChevalierD_Or Posted October 23, 2017 Author Share Posted October 23, 2017 sorry if I make spelling mistakes but I'm french =) Quote Link to comment Share on other sites More sharing options...
Draco18s Posted October 23, 2017 Share Posted October 23, 2017 (edited) 1 hour ago, LeChevalierD_Or said: public class CubicDeath_Blocks{ @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { event.getResult().registerAll(Block1); } } Your original code had you trying to register an item named logo. In this code you're trying to register a block named Block1 (which doesn't exist). Edited October 23, 2017 by Draco18s 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...
LeChevalierD_Or Posted October 23, 2017 Author Share Posted October 23, 2017 Yes precisely I ask you how to create it and give it features and a skin ? Quote Link to comment Share on other sites More sharing options...
tebreca Posted October 23, 2017 Share Posted October 23, 2017 I send this to some other people too but, In the new 1.12.2 version you need to use the new way of registering with the new RegistryEvent<T> Try and read the documentation on at mcforge.readthedocs.io/en/latest/concepts/registries/ If you arent known with events check out this https://mcforge.readthedocs.io/en/latest/events/intro/ I could advice you to check out this repo from Harry'sTechreviews: a youtuber, you can also check out his video on it https://github.com/HarryTechRevs/MinecraftModding/tree/HarryTechRevs-1.12.2-Tutorials/main/java/harry/mod Quote Link to comment Share on other sites More sharing options...
tebreca Posted October 23, 2017 Share Posted October 23, 2017 Just now, tebreca said: I send this to some other people too but, In the new 1.12.2 version you need to use the new way of registering with the new RegistryEvent<T> Try and read the documentation on at mcforge.readthedocs.io/en/latest/concepts/registries/ If you arent known with events check out this https://mcforge.readthedocs.io/en/latest/events/intro/ I could advice you to check out this repo from Harry'sTechreviews: a youtuber, you can also check out his video on it https://github.com/HarryTechRevs/MinecraftModding/tree/HarryTechRevs-1.12.2-Tutorials/main/java/harry/mod 1 hour ago, LeChevalierD_Or said: Hello, Thank you for your answer. here is my code now: package com.cubicdeath.blocks; import net.minecraft.block.Block; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; public class CubicDeath_Blocks{ @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { event.getResult().registerAll(Block1); } } Can you now give me the whole code with a block and features so that I can understand better. Thank you in advance . also you need to register your class as a @EventBusSubscriber is pretty easy with just the @mod.eventbussubsriber annonation Quote Link to comment Share on other sites More sharing options...
LeChevalierD_Or Posted October 23, 2017 Author Share Posted October 23, 2017 Unfortunately I do not have any more code I am in total incomprehension = ( Quote Link to comment Share on other sites More sharing options...
tebreca Posted October 23, 2017 Share Posted October 23, 2017 11 minutes ago, LeChevalierD_Or said: Unfortunately I do not have any more code I am in total incomprehension = ( thats bad though, but i can only help you with sending a website which helps a lot if you understand java good enough, https://shadowfacts.net/tutorials/forge-modding-112/ succes with modding, always ask help if you need there will be people around who can help you Quote Link to comment Share on other sites More sharing options...
LeChevalierD_Or Posted October 24, 2017 Author Share Posted October 24, 2017 Thanks I'm reading =) . Quote Link to comment Share on other sites More sharing options...
tebreca Posted October 24, 2017 Share Posted October 24, 2017 7 minutes ago, LeChevalierD_Or said: Thanks I'm reading =) . succes Quote Link to comment Share on other sites More sharing options...
LeChevalierD_Or Posted October 24, 2017 Author Share Posted October 24, 2017 (edited) Hi, I would like to know if until I get well: package com.cubicdeath.blocks; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; 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 net.minecraftforge.registries.IForgeRegistry; @Mod(modid = Main.modId, name = Main.name, version = Main.version) public class Main { public static final String modId = "cubicdeath_block"; public static final String name = "CubicDeath Block"; public static final String version = "1.0.0"; @Mod.Instance(modId) public static Main instance; @SidedProxy(serverSide = "com.cubicdeath.blocks.CommonProxy", clientSide = "com.cubicdeath.blocks.ClientProxy") public static CommonProxy proxy; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { System.out.println(name + " Et en chargement..."); } @Mod.EventHandler public void init(FMLInitializationEvent event) { } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } @Mod.EventBusSubscriber public static class RegistrationHandler { @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { Main.register(event.getRegistry()); } @SubscribeEvent public static void registerItems(ModelRegistryEvent event) { Main.registerModels(); } } public static void register(IForgeRegistry<Item> registry) { } public static void registerModels() { } } Edited October 24, 2017 by LeChevalierD_Or Quote Link to comment Share on other sites More sharing options...
LeChevalierD_Or Posted October 24, 2017 Author Share Posted October 24, 2017 (edited) Hi, there seems to be a problem but I do not know how to help you. Explanations: When I run the game via eclipse and I go in the CreativeTabs "BuildingsBlocks" I can not find my item CopperIngot = ( Please help me =) Here is a folder where there are all my classes =) Thank you in advance ... error.zip Edited October 24, 2017 by LeChevalierD_Or Quote Link to comment Share on other sites More sharing options...
Draco18s Posted October 24, 2017 Share Posted October 24, 2017 public static void register(IForgeRegistry<Item> registry) { //something goes here maybe? I dunno. Maybe something to register my items? } 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...
LeChevalierD_Or Posted October 24, 2017 Author Share Posted October 24, 2017 (edited) Il y a 4 minutes, Draco18s a dit: ?? what RegisterItems? Edited October 24, 2017 by LeChevalierD_Or Quote Link to comment Share on other sites More sharing options...
LeChevalierD_Or Posted October 24, 2017 Author Share Posted October 24, 2017 5 minutes ago, Draco18s said: ?? WHAT registers Items Quote Link to comment Share on other sites More sharing options...
Draco18s Posted October 24, 2017 Share Posted October 24, 2017 Your methods do jack diddly squat. They are empty. They need to not be empty. 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...
LeChevalierD_Or Posted October 24, 2017 Author Share Posted October 24, 2017 So can I delete them? Quote Link to comment Share on other sites More sharing options...
Draco18s Posted October 24, 2017 Share Posted October 24, 2017 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...
LeChevalierD_Or Posted October 25, 2017 Author Share Posted October 25, 2017 Help me please... Quote Link to comment Share on other sites More sharing options...
Ugdhar Posted October 25, 2017 Share Posted October 25, 2017 I believe your biggest problem is likely a lack of java knowledge. You really do need to know at least intermediate java/OOP in order to make mods for Minecraft. Otherwise you will struggle a LOT with the simplest of blocks and items, nevermind making anything actually cool/different/exciting. http://www.minecraftforge.net/forum/topic/49497-1112-is-using-registryevent-this-way-ok/ This post shows how to register items, blocks, and their models. If someone just writes the code for you and/or gives you the complete answer, you will be right back here stuck again unless you have some programming skills. I'm not trying to be mean, just stating what is true. There are a lot of guys on here that have been here a long time, and you won't get a nice answer out of them if you lack even rudimentary java skills, as this forum is not a place to learn how to program. Quote Link to comment Share on other sites More sharing options...
LeChevalierD_Or Posted October 25, 2017 Author Share Posted October 25, 2017 4 hours ago, Ugdhar said: Je crois que votre plus gros problème est probablement un manque de connaissances Java. Vous avez vraiment besoin de connaître au moins intermédiaire Java / OOP afin de faire des mods pour Minecraft. Sinon, vous aurez beaucoup de mal avec le plus simple des blocs et des objets, sans jamais faire quoi que ce soit de vraiment cool / différent / excitant. http://www.minecraftforge.net/forum/topic/49497-1112-is-using-registryevent-this-way-ok/ Ce message montre comment enregistrer des éléments, des blocs et leurs modèles. Si quelqu'un vous écrit simplement le code et / ou vous donne la réponse complète, vous serez à nouveau coincé ici à moins que vous n'ayez des compétences en programmation. Je n'essaie pas d'être méchant, juste en disant ce qui est vrai. Il y a beaucoup de gars ici depuis longtemps et vous n'obtiendrez pas une bonne réponse si vous n'avez même pas de compétences java rudimentaires, car ce forum n'est pas un endroit pour apprendre à programmer. Negative I have a very good knowledge of JAVA but not in forge! Quote Link to comment Share on other sites More sharing options...
Draco18s Posted October 25, 2017 Share Posted October 25, 2017 20 hours ago, Draco18s said: They are empty. They need to not be empty. 20 hours ago, Draco18s said: not be empty. 20 hours ago, LeChevalierD_Or said: So can I delete them? You tell me. 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...
LeChevalierD_Or Posted October 25, 2017 Author Share Posted October 25, 2017 (edited) public static void register(IForgeRegistry<Item> registry) { registry.registerAll(ingotCopper); } public static void registerModels() { ingotCopper.registerItemModel(); } } if that's what you expect from me I've already put it in another class! Edited October 25, 2017 by LeChevalierD_Or Quote 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.