Jump to content

Recommended Posts

Posted

I've been trying to create a new item, and GameRegistry isn't working. I can't find any tutorials online, and the tutorials on this forum are still in 1.8.

-a3ology

Posted

What do you mean with "GameRegistry isn't working"? It is working fine for me...

 

A few methods have been marked deprecated though, if that's what you mean?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

What do you mean with "GameRegistry isn't working"? It is working fine for me...

 

A few methods have been marked deprecated though, if that's what you mean?

public class Items {

public static Item test_item;

public static void init(){

	test_item = new Item().setUnlocalizedName("test_item");

}

public static void register(){

	GameRegistry.registerItem(test_item, test_item.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"));

}

}

 

This hasn't been working. It's probably because I haven't modded since the first version of 1.8, and I've forgot quite a bit. A tutorial would still be nice for 1.9.

-a3ology

Posted

Stop using unlocalized name and start using setRegistryName.  Don't ever use getUnlocalizedName().substring(5) for anything, ever.  Stop doing it.  That's bad.  Really really bad, perpetuated by a shitty tutorial that follows tons of bad practices and should be taken down.

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.

Posted

Stop using unlocalized name and start using setRegistryName.  Don't ever use getUnlocalizedName().substring(5) for anything, ever.  Stop doing it.  That's bad.  Really really bad, perpetuated by a shitty tutorial that follows tons of bad practices and should be taken down.

 

Hi Draco, do you by any chance know of an example on how to use the RegistryName. I have been trying to update my mod to 1.9, but I cant get the item texture to load.

 

    ModelLoader.setCustomModelResourceLocation(LotsOMobsItems.DeerHide, 0, new ModelResourceLocation(LotsOMobsItems.DeerHide.getRegistryName().toString(), "inventory"));

 

Thats the line Im trying to register the model with.

       

        public static void itemInit()

        {

DeerHide = registerItem(new ItemMaterials("DeerHide"));

}

 

private static <T extends Item> T registerItem(T item) {

GameRegistry.register(item);

return item;

}

And here I register them.

Posted

There's already a lengthy thread here about the new way to set registry names before registering things. Find it and read it.

 

Meshing is discouraged (and client-side only anyway). There's some other set custom resource method to use instead (avoiding some tricky timing issues). D7 and Choonster have recommended it so many times in these threads that they probably keep a stock admonition in a text file ready for pasting...

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Stop using unlocalized name and start using setRegistryName.  Don't ever use getUnlocalizedName().substring(5) for anything, ever.  Stop doing it.  That's bad.  Really really bad, perpetuated by a shitty tutorial that follows tons of bad practices and should be taken down.

You got a better tutorial I could use? I would gladly use it.

-a3ology

Posted

myItem.setRegistryName("myItemIsCool");

GameRegistry.register(myItem);

 

Also, getRegistryName() already returns a string, you don't need to .ToString() it.

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.

Posted

Also, getRegistryName() already returns a string, you don't need to .ToString() it.

 

It used to, but it now returns a

ResourceLocation

under the new registry system.

 

Edit: I can't spell.

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.

Posted

Also, getRegistryName() already returns a string, you don't need to .ToString() it.

 

It used to, but it now returns a

ResourceLocation

under the new registry system.

 

Ah, interesting.

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.

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.