Jump to content

[1.10.2] Is there a simple tutorial for creating items?


FrozenPeas

Recommended Posts

I have seen pieces from ShadowFacts and Choonster, but I have got stuck trying to figure out which pieces are mandatory and which are just for scale or convenience.

 

Some questions are:

Can Item creation be done with only one class file?

If not, is a proxy file mandatory?, my older 1.8 example does not have these, but many online examples do.

Is creativetab mandatory? I can't get that to work in any example, in my old example everything is done in one class, when I move to multiple classes the setCreativeTab(modname.creativeTab);

command doesn't like the creativeTab part.

 

What I am looking for is a tutorial that works in 1.10.

 

 

Link to comment
Share on other sites

Proxy files are mandatory: you need one (client) to register the item renderers.

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

MrCrayFish has a tutorial for Minecraft 1.9 that works with 1.10. You can find it here:

 

I'm not sure if he still does this but dont use getUnlocalizedName().substring(5), instead use getRegistryName() instead (After you set the registry name of course).

 

I know Chooster recommends this (using getRegistryName()) but it seems to me to be a bit tricky depending on where you are using it. Basically it doesn't return a string directly but rather a ResourceLocation, so you often have to use toString() method on it. And then it will put your mod ID in front like this "modid:my_item_name" which you might have to strip off.

 

I personally think you should use getRegistryName() when you need the registry name (i.e. the one-time set never changing name), and use the unlocalized name when you want an unlocalized name.

 

I guess the main thing that is safe about registry name is that technically other mods could change the unlocalized name of your mod's items. I personally haven't seen a lot of that, but I suppose there are mods out there and therefore a risk. So if you need a name to be the key to something, or help point to a file location, registry name is safer.

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

Link to comment
Share on other sites

I know Chooster recommends this (using getRegistryName()) but it seems to me to be a bit tricky depending on where you are using it. Basically it doesn't return a string directly but rather a ResourceLocation, so you often have to use toString() method on it. And then it will put your mod ID in front like this "modid:my_item_name" which you might have to strip off.

 

Do not strip that off!

Unlocalized names are GLOBAL, if you add an item with the unlocalized name "item.thingy.name" (or I should say, that's what shows up when you go to put it into your localization file) and localize it to "Awesome Hat" and then another mod comes along and creates an item with an unlocalized name of "item.thingy.name" localized to "Neat Wand" guess what?

 

Both items in-game will display with the same name, depending on which mod loads second.

 

Instead, if both mods left their mod ID in the unlocalized name, this would not happen.

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 know Chooster recommends this (using getRegistryName()) but it seems to me to be a bit tricky depending on where you are using it. Basically it doesn't return a string directly but rather a ResourceLocation, so you often have to use toString() method on it. And then it will put your mod ID in front like this "modid:my_item_name" which you might have to strip off.

 

Do not strip that off!

Unlocalized names are GLOBAL, if you add an item with the unlocalized name "item.thingy.name" (or I should say, that's what shows up when you go to put it into your localization file) and localize it to "Awesome Hat" and then another mod comes along and creates an item with an unlocalized name of "item.thingy.name" localized to "Neat Wand" guess what?

 

Both items in-game will display with the same name, depending on which mod loads second.

 

Instead, if both mods left their mod ID in the unlocalized name, this would not happen.

 

Well first of all, it seems strange that it is really global because the lang files are per-mod assets. You're saying that localization will be overwritten?

 

Unlocalized name is only intended to be used with translation, which I believe will still be per-mod according to the lang file for that mod. That's what I'm talking about. There is a place for using unlocalized name. If the concern is that another mod might actually change the unlocalized name of your mod's item, then that is when I'm suggesting you'd need to use registryName() and strip the modid from it (and add the "item." and ".name" to do the translation).

 

As I said, for other uses where you need a unique id, then in those cases you'd use registryName() as is.

 

Are you guys really saying to NEVER use unlocalized name?

 

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

Link to comment
Share on other sites

Well first of all, it seems strange that it is really global because the lang files are per-mod assets. You're saying that localization will be overwritten?
It's not strange at all. The lang files are simply piggybacking on the resource loading system which allows lang files in resource packs (mods are resource packs). If you are adding lang key for your mod, they are no different than vanilla lang keys.

Really? so you're saying that if another mod tries to get the unlocalized name for my mods item it doesn't realize that it is from my mod and look only at my lang file? It will look in all the lang files for all the mods that are loaded for a match to my item's name?

 

Unlocalized name is only intended to be used with translation, which I believe will still be per-mod according to the lang file for that mod.
How would that work? Anyone can call
I18n.translate

from anywhere. How does that know which lang file to use?

 

Well, the unlocalized name is called against the instance of my item which I assume the game knows was from my mod.

 

If it really doesn't do what I assumed, then there is really no safety in using a lang file at all because no matter how unique you try to make the unlocalized name it is not foolproof...

 

That's what I'm talking about. There is a place for using unlocalized name. If the concern is that another mod might actually change the unlocalized name of your mod's item, then that is when I'm suggesting you'd need to use registryName() and strip the modid from it (and add the "item." and ".name" to do the translation).
I have no idea what you are on about here but it sounds horrible.

 

Yes, which is why I'm arguing against it.

 

As I said, for other uses where you need a unique id, then in those cases you'd use registryName() as is.
Other cases? No. You use registry name if you want the ID. You never use anything else.

 

Right that's what I said. If there are no other cases then you mean never use unlocalized name ever?

 

Are you guys really saying to NEVER use unlocalized name?
Unlocalized name is if you want to display the name of the thing. That's it's only purpose and you should not use it for something else.

I think we're saying the same thing. That unlocalized name is for displaying the name, and you want to make it unique enough that it is unlikely to be copied.

 

However, you guys are scaring me off of using unlocalized name even for displaying the name. You're implying that translation won't just look in your mod's lang file for matches.

 

Anyway, I'll defer to you guys' recommendation. All I was trying to tell people was that there was still a place for using unlocalized name (for use with lang files), but I guess there isn't...

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

Link to comment
Share on other sites

Unlocalised names are still required for display purposes (as they always have been) but shouldn't be used for anything else.

 

They should be unique to your mod to avoid localisation conflicts with other mods. Including your mod ID in the unlocalised name (e.g. by using the registry name) is a good way to do this. This doesn't guarantee the uniqueness, but it makes it very likely to be unique unless another mod deliberately uses the same name.

 

All translations for the active locale are stored in a single map, regardless of which mod's lang file they were loaded from. They're not stored separately for each mod.

 

Usually the unlocalised name of an item will be the same as its registry name, but this isn't required. Some items like records have the same unlocalised name as each other but still have their own unique registry names.

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

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



×
×
  • Create New...

Important Information

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