Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.9] Understanding new way of declaring items.


Recommended Posts

So I am am suffering from either a sever case of just stupid, or you use it if you don't use it. I am hoping the latter.


I haven't touched Java in maybe 6 or so months, but last time I did was to create a simple minecraft mod to rebalance the game as I wanted. I am in the process of recreating and rebalancing said mod and just tidying it all up as I am planning on using it in a more modern pack and figured I would release to the public this time around. Now last time I did all this was in the early days of 1.8, so I assumed that the old way to add an item was mostly the same, and so I did this:


package com.squirrelkiller.utilities.init;

import com.squirrelkiller.utilities.Reference;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {

public static Item bedding;
public static Item bed_frame;

public static void init() {
	bedding = new Item().setUnlocalizedName("bedding");
	bed_frame = new Item().setUnlocalizedName("bed_frame");

public static void registerModItem() {
	GameRegistry.registerItem(bedding, bedding.getUnlocalizedName().substring(5));
	GameRegistry.registerItem(bed_frame, bed_frame.getUnlocalizedName().substring(5));

public static void registerRenders() {

public static void registerRender(Item item) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));



Well this actually turns out to now be wrong, and it suggests that I use IForgeRegistry. Well it turns out I am just stupid as I am staring blankly at this basically drooling like an idiot trying to figure out how exactly to use this newer method. I am reading the Javadoc for it and I can tell it will make my life so much easier, but I think I am just over thinking it, can someone just show me how this works. I know this is stupid, but I feel like I am just stupid right now and forgetting how to java.

Link to comment
Share on other sites




, as do most other singleton classes stored in registries (e.g.








Instead of specifying the registry name in the


call, set the registry name using


(or one of the overloads provided by the


subclass) and then register it using the single-argument overload of




Don't use unlocalised names to determine the registry names, the whole point of the original implementation of the registry name methods in 1.8.9 was to stop people doing that.


You can see how I register items in my mod here. Most of my items use


to set their registry and unlocalised names, but some have completely separate names (e.g. records) that they set manually.


Don't use unlocalised names for model locations, the default model loaded for an


is specified by its registry name.


Don't use


to register models, use




in preInit.


I would advise against registering client-only things like models in the same class as you register common things like


s. I recommend creating a separate class to handle model registration, like this one.

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

  • 2 weeks later...

Excuse me for bumping up and old post.


But How does one register for an item with subtypes, I have a mod that I that will have a few hundred items in its subtype, each with its own unlocalized name for the Language Translation


That hasn't changed in 1.9 and has little to do with the new registry system, since every


is registered in the same way.




to return the appropriate unlocalised name based on any aspect of the


(stack size, metadata, NBT, capabilities).

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.

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.


  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.