Jump to content

I need help registering


UnknownSquash

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

It's YOUR mod id. :|

@Mod(modid="this_string_here" ... )

Edited 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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Screen Shot 2018-01-08 at 4.20.51 PM.png

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I was trying to play a MOD in my preferred language, but I see that only some items are translated, and I go to debug and I get this information (the only thing that is translated is the bestiary):   [14sep.2024 17:14:36.415] [Render thread/WARN] [net.minecraft.client.resources.language.ClientLanguage/]: Skipped language file: mowziesmobs:lang/es_es.json (com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected name at line 394 column 2 path $.config.mowziesmobs.ice_crystal_attack_multiplier) [14sep.2024 17:14:36.421] [Render thread/WARN] [net.minecraft.client.resources.language.ClientLanguage/]: Skipped language file: iceandfire:lang/es_es.json (com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1349 column 4 path $.iceandfire.sound.subtitle.dragonflute)   Is that the reason why everything is not translated? , and is there any way to fix it? Thanks
    • I got my model to render from the models renderToBuffer method. But still not quite what I want. I want to render the model from my renderer's render method. I feel that having access to the renderer and its methods will open some doors for me later down the line. //EntityRendererProvider.Context pContext = ; I want this //ToaPlayerRenderer render = new ToaPlayerRenderer(pContext, false); // if I can get the above line to work, having the methods from the renderer class would be incredibly helpful down the line RenderType rendertype = model.renderType(p.getSkinTextureLocation()); // this should be something like render.getTextureLocation() VertexConsumer vertexconsumer = buffer.getBuffer(rendertype); model.renderToBuffer(stack, vertexconsumer, paLights, 1, 1, 1, 1, 1); // I don't want the render to happen here since it doesn't use the renderer //model.render(p, 1f, pTicks, stack, buffer, paLights); I want to render the model using this It is certainly getting closer though. Probably. I am still worried that even if pContext is initialized this new instance of the renderer class will still hit me with the classic and all too familiar "can't use static method in non-static context"
    • Hello, I am learning how to create Multipart Entities and I tried creating a PartEntity based on the EnderDragonPart code. However, when I tested summoning the entity in the game, the PartEntity appeared at position x 0, y 0, z 0 within the game. I tried to make it follow the main entity, and after testing again, the part entity followed the main entity but seemed to teleport back to x 0, y 0, z 0 every tick (I'm just guessing). I don't know how to fix this can someone help me? My github https://github.com/SteveKK666/Forge-NewWorld-1.20.1/tree/master/src/main/java/net/kk/newworldmod/entity/custom Illustration  https://drive.google.com/file/d/157SPvyQCE8GcsRXyQQkD4Dyhalz6LjBn/view?usp=drive_link Sorry for my English; I’m not very good at it. 
    • its still crashing with the same message
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.