Posted January 6, 20187 yr I am a beginner at modding. I am registering my item, but it will never show up in the game when I run the code. I am probably doing many things wrong, I just don't know what.
January 7, 20187 yr Author I tried setting Registry name with the name of the item but it keeps on saying to change the item to a resource location and if I do it messes everything up. I read the documentation on RegistryLocation, but it never says how to set it.
January 7, 20187 yr item.setRegistryName("the name of the item"); How is this so difficult? 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.
January 7, 20187 yr Author but it can't be a string the parenthesis have to be a Registry Location and thats my problem
January 7, 20187 yr 23 minutes ago, UnknownSquash said: but it can't be a string the parenthesis have to be a Registry Location and thats my problem There are three overloads of IForgeRegistryEntry.Impl#setRegistryName (which is inherited by Item): (String) (ResourceLocation) (String, String) Even if it did require a ResourceLocation, it's not a very complicated class: it's simply a domain (your mod ID) and a path (the name of your Item). Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
January 7, 20187 yr 35 minutes ago, Choonster said: There are three overloads of IForgeRegistryEntry.Impl#setRegistryName (which is inherited by Item): (String) (ResourceLocation) (String, String) Even if it did require a ResourceLocation, it's not a very complicated class: it's simply a domain (your mod ID) and a path (the name of your Item). Which, coincidentally enough, is what the (string, string) method does. 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.
January 7, 20187 yr It's YOUR mod id. @Mod(modid="this_string_here" ... ) Edited January 7, 20187 yr by Draco18s 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.
January 7, 20187 yr Author I have the 1.11 version is that a problem, because that may be one of the reasons that this isn't workin with the info I am getting. I am probably still not doing it right but maybe I need to do different things based on the version I am on. Thanks.
January 7, 20187 yr 6 minutes ago, UnknownSquash said: I have the 1.11 version is that a problem, because that may be one of the reasons that this isn't workin with the info I am getting. I am probably still not doing it right but maybe I need to do different things based on the version I am on. Thanks. 1.11.x has these methods and it has the registry events. All of the advice you've received here still applies. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
January 7, 20187 yr Okay, there are a lot of things you'll need to learn. As a beginning modder, trying to create a simple item is a good place to start. But it still requires a number of details to be done right. But I'm also concerned that you look new to Java programming as well. For example, your code is a bit strange as the class has a name that indicates it is for an item, then you have a field for an item which you never create an instance for, but neither seem to deal with a class that extends Item properly, then you have an event-handling method which doesn't subscribe to an event. Here are some of the things you'll need to get working: 1) you need a custom item class that actually extends Item (or a sub-class of Item) so you can specify the behavior, textures and such. 2) you need a registry method like yours but the class it is in needs to subscribe to the event bus, and the method needs to be annotated as a subscriber. I have tutorial information on event handling here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html 3) In the registry method you need to create an instance (using "new" keyword for your custom item class) and assign it a registry name using the setRegistryName() method. 4) you need a public static final field for the item that is annotated with an @ObjectHolder annotation. This will ensure that the instance you use in your code is the singleton instance you actually registered. (which implies you also understand that item objects are singletons in Minecraft). 5) In addition to registering the item itself you need to register it's model. This is also done with an event-subscribing method. It also implies that you have your resources set up properly with a JSON file for the model which points to texture image files. 6) You'll probably want your object to show up in a creative tab, so you will need to call the setCreativeTab() method for your item, I recommend doing this in the constructor of your custom item, but can be done elsewhere once the instance is created. You might want to follow some tutorials. I have a fair bit of information at http://jabelarminecraft.blogspot.com/ and there is lots of other good stuff (and some bad stuff) if you google it. You're also welcome to look at example mods like mine https://github.com/jabelar/ExampleMod-1.12 or Choonster's https://github.com/Choonster-Minecraft-Mods/TestMod3. While it is not good to copy without understanding it, looking at other people's code can give you some ideas of what you might be doing wrong and what areas you need to learn more about. Edited January 7, 20187 yr by jabelar Check out my tutorials here: http://jabelarminecraft.blogspot.com/
January 8, 20187 yr 1 hour ago, jabelar said: textures and such. You do not need a custom class for textures. Sticks (ingots, nuggets...) are just Items. 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.
January 8, 20187 yr Author I have not added the texture yet, but I created this improved code. The item "Dentyne....Gum" has the same name as the registry name and I think that it is not registering the name but the item. I don't really know but I am assuming that this makes the RegistryName useless. And do I need to do any of this on another file? Thanks for all the info.
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.