Jump to content

Recommended Posts

Posted (edited)

Hi All! I have been working to try and get metadata items working, as my mod is going to have a lot of different crafting items, and that is quite a few JSON files. So I have got it so more than 1 item appears in the creative tab from 1 item, but they are showing as nothing, not even the default no texture texture, and they have the same name "item.test_material.name". So I was hoping that somebody could shed some light and whereabouts I am going wrong.

 

Registering Item Models:

Spoiler

	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {
		for (Item item : ItemInit.ITEMS) {
			if (item instanceof IHasModel) {
				if (!item.getHasSubtypes()) {
					((IHasModel)item).registerModels(0, "", "inventory");
				} else {
					NonNullList<ItemStack> subItems = NonNullList.create();
					item.getSubItems(CreativeTabs.SEARCH, subItems);
	
					for (int i = 0; i < subItems.size(); i++) {
						subItems.get(i).getItem().setUnlocalizedName(subItems.get(i).getItem().getUnlocalizedName() + "_" + i);
						((IHasModel)subItems.get(i).getItem()).registerModels(i, "", "test=" + i);
					}
	
				}
			}
		}

 

 

 

My test_material.json:

Spoiler

{
    "forge_marker": 1,
    "defaults": {
        "model": "builtin/generated"
    },
    "variants": {
        "test": {
            "1":     {"textures": {"layer0": "geoex:items/chunk_banded_iron"} },
            "2":     {"textures": {"layer0": "geoex:items/chunk_limestone"} }
        }
    }
}

 

 

 

Hmm, not sure what else you would need to look at really, but here is a link to my Github Repo if you need anything else: https://github.com/Lurmey/geological-expansion/tree/master/GeologicalExpansion/src/main

 

Edit:

This is what is called when I do .registerModels(), where it passes through the item and the item inserts itself into the call of this function:

Spoiler

public class ClientProxy extends CommonProxy {

	public void registerItemRenderer(Item item, int meta, String variantName, String id) {
		ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + variantName, id));
	}

 

 

 

Edited by GammaS_
Posted
36 minutes ago, GammaS_ said:

subItems.get(i).getItem().setUnlocalizedName(subItems.get(i).getItem().getUnlocalizedName() + "_" + i);

This will not work. Ever.

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.