Jump to content

I Need Help Registering Items in [1.10]


averysumner

Recommended Posts

A few years ago I made minecraft mods, then I quit. I come back to see that on the new 1.10 forge registerItem has been deprecated. I do not at all understand how the new registry system works. Can someone help me?

There are 10 types of people in this world. Those who know binary and those who don't.

Link to comment
Share on other sites

The deprecated

GameRegistry

methods tell you their replacements in their doc comments.

 

The registration process is the same for any

IForgeRegistryEntry

implementation (e.g.

Block

,

Item

,

Biome

):

  • Call
    setRegistryName

    to set the registry name of the object

  • Call
    GameRegistry.register(IForgeRegistryEntry)

    to register it

 

The main change from the old system is that

GameRegistry.register

won't create an

ItemBlock

for your

Block

, you need to create and register it yourself.

 

Some older tutorials will tell you to use the unlocalised name as the registry name or model location, don't do this. Registry names are IDs, they must be unique and can't change. Unlocalised names are only for translation/display purposes, don't have to be unique and may change at any time. The default model loaded for every

Item

is the one with its registry name, so use this as the default model location for your items.

 

If the registry and unlocalised names of an object are the same, set the registry name and then set the unlocalised name to the registry name (

setRegistryName("foo"); setUnlocalisedName(getRegistryName());

). This has the benefit of including your mod ID in the unlocalised name, preventing localisation conflicts with other mods. If the unlocalised name changes later on, set it separately instead of using the registry name.

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

Where are you now supposed to set the in-game name for the Item? I seem to have pretty much all the things in place, but it is still displayed as item.epsetestmod.pocketCalculator.name

I have a

private final String name = "someName";

and a getter for it (getName). Also doesn't work with the

name

being public.

Read the docs they said. There no be docs :o

Link to comment
Share on other sites

Where are you now supposed to set the in-game name for the Item? I seem to have pretty much all the things in place, but it is still displayed as item.epsetestmod.pocketCalculator.name

I have a

private final String name = "someName";

and a getter for it (getName). Also doesn't work with the

name

being public.

 

Nothing changed with regards to unlocalised and localised names, you still set the unlocalised name with

setUnlocalizedName()

and then defined the localised name in the .lang file. What version did you last mod in?

Link to comment
Share on other sites

EDIT: read the IronChests source code. It works. What I saw is actually what is supposed to happen  :-X

 

Well, that thing is something I read somewhere. I already had this line:

this.setUnlocalizedName(name);

but I still don't get an in-game name for my Item.  ???

Read the docs they said. There no be docs :o

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.