Posted July 6, 20178 yr I have the error above. It says the error is on line 72 which says Public void init (FMLInitializationEvent e){ registerItems (); } The registerItems method is made with this code Public void registerItems (RegistryEvent.Register <Item> event){ event.getRegistry ().register (new Item ().setRegistryName ("testmod", "testitem")); event.getRegistry ().register (new ItemSword (Item.ToolMaterial.DIAMOND).setRegistryName ("flashmod", "flash_sword"));
July 6, 20178 yr Do not manually call registerItems. Just annotate it with SubscribeEvent and its class with Mod#EventBusSubscriber and it will automatically be called as long as it's static (it currently isn't). Edited July 6, 20178 yr by That_Martin_Guy
July 6, 20178 yr Do you know java? Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
July 6, 20178 yr public void registerItems(RegistryEvent.Register<Item>event) You wrote the type and parameter name in the same word twice in different classes. This will never work. Also, you need to store the items in variables, you can't just do create new objects and be done with it. If you ever want to check if the player is holding your sword, for example, you can't because you don't have it stored in a variable.
July 6, 20178 yr Author I do know java. I had commented that part out in main and moved to init. 14 minutes ago, That_Martin_Guy said: public void registerItems(RegistryEvent.Register<Item>event) You wrote the type and parameter name in the same word twice in different classes. This will never work. Also, you need to store the items in variables, you can't just do create new objects and be done with it. If you ever want to check if the player is holding your sword, for example, you can't because you don't have it stored in a variable. How do I do that?
July 6, 20178 yr Making variables is the most fundemental property of any programming language. Please, do look up a java tutorial before starting to mod. You will not make any progress otherwise.
July 6, 20178 yr Author I KNOW FRICKIN JAVA. I HAVE BEEN DOING FOR YEARS I AM NEW TO MODDING , THIS WOULD GO ALOT FASTER IF PEOPLE WOULD HELP NOT JUDGE PEOPLE ON HOW THEY THINK THEIR LEVEL OF JAVA IS. Edited July 6, 20178 yr by Chuckinator
July 6, 20178 yr 27 minutes ago, Chuckinator said: Quote Also, you need to store the items in variables, you can't just do create new objects and be done with it. How do I do that? 6 minutes ago, Chuckinator said: I KNOW FRICKIN JAVA. That doesn't look like you know java, and people don't want to waste their time teaching people basic java concepts, so please try to explain exactly what you are struggling with, rather than just complaining that people are judging you. The more information you give, the more we can help.
July 6, 20178 yr 30 minutes ago, Chuckinator said: I KNOW FRICKIN JAVA. I HAVE BEEN DOING FOR YEARS No you don't, not when you ask questions like "how do I make a variable?" 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.
July 6, 20178 yr Also, you tried to make an import static, nice java knowledge mate... Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
July 6, 20178 yr 10 minutes ago, Kokkie said: Also, you tried to make an import static, nice java knowledge mate... Imports can be static. Also, let's not go out of our way to call out this guy on every mistake he makes. Whether he's new to java or not, we should not get abusive.
July 6, 20178 yr 4 minutes ago, That_Martin_Guy said: Imports can be static. Also, let's not go out of our way to call out this guy on every mistake he makes. Whether he's new to java or not, we should not get abusive. Sorry, didn't look well enough... And please don't talk about abusive... Sorry that was just.. Something... Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
July 6, 20178 yr Author 57 minutes ago, Draco18s said: No you don't, not when you ask questions like "how do I make a variable?" I asked that because I already had the variable there.
July 6, 20178 yr Ah, now I see that variable. Your code is all over the place as far as I can tell from these files, and it's a bit hard to find them. All you should have to do, besides the things we've already told you about, is pass the variable into event#getRegistry#register. Also, not directly related, but don't use Item#registerItems. This is minecraft code to be used on minecraft items only. Do not call this method yourself. You should not even import it. Also also, correct me if I'm wrong, but you don't need/should use GameRegistry#ObjectHolder. It just makes the code look ugly AFAIK (again, could be wrong).
July 6, 20178 yr 1 hour ago, That_Martin_Guy said: Also also, correct me if I'm wrong, but you don't need/should use GameRegistry#ObjectHolder. It just makes the code look ugly AFAIK (again, could be wrong). I think using @ObjectHolder is the intended way of using registries, and seeing that every test mod using registries uses them @ObjectHolder, it would make sense to use it as well. Also, the docs say this is the recommended way. Edited July 6, 20178 yr by larsgerrits Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
July 6, 20178 yr Author 2 hours ago, That_Martin_Guy said: Ah, now I see that variable. Your code is all over the place as far as I can tell from these files, and it's a bit hard to find them. All you should have to do, besides the things we've already told you about, is pass the variable into event#getRegistry#register. Also, not directly related, but don't use Item#registerItems. This is minecraft code to be used on minecraft items only. Do not call this method yourself. You should not even import it. Also also, correct me if I'm wrong, but you don't need/should use GameRegistry#ObjectHolder. It just makes the code look ugly AFAIK (again, could be wrong). Whats with the hastags? And I dont know what passing a variable through is?
July 6, 20178 yr 9 minutes ago, Chuckinator said: Whats with the hastags? It means a field/method etc. is static. 10 minutes ago, Chuckinator said: And I dont know what passing a variable through is? You need to call 2 hours ago, That_Martin_Guy said: event#getRegistry#register using the variable as a parameter. Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
July 6, 20178 yr 20 minutes ago, Kokkie said: It means a field/method etc. is static No, no it does not. It means the exact opposite. 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.
July 6, 20178 yr RegisterEvent.Register#getRegistry() is a method. You need to call it like a method. Edited July 6, 20178 yr by larsgerrits Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
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.