Jump to content

[1.8] Registering Item Models With Metadata


shucke

Recommended Posts

So im trying to register 2 different items with metadata sensitve models.

Now it finds the model and all but the models for the second item appear on the first item.

I cant seem to find the error in this, mainly because i haven't done this before with 1.8.

So here is the registering code:

private void registerFishItemModels(){

	List<String> rawFishModelNames = new ArrayList();
	List<String> cookedFishModelNames = new ArrayList();

	for(int i = 0; i < FishRegistry.getFishTypeList().length; i++){
		FishType fish = FishRegistry.getFishFromID(i);
		if(fish == null)
			continue;

		String s = JUtils.capitalize(fish.fishName);

		String rawName = Fishing.ID + ":fish" + s + "Raw";
		registerItemModelWithMeta(FishingItems.rawFish, i, rawName);
		rawFishModelNames.add(rawName);

		if(fish.isCookable()){
			String cookedName = Fishing.ID + ":fish" + s + "Cooked";
			registerItemModelWithMeta(FishingItems.cookedFish, i, cookedName);
			cookedFishModelNames.add(cookedName);
		}
	}

	ModelBakery.addVariantName(FishingItems.rawFish, JUtils.convertStringList(rawFishModelNames));
	ModelBakery.addVariantName(FishingItems.cookedFish, JUtils.convertStringList(cookedFishModelNames));
}

private void registerItemModelWithMeta(Item item, int meta, String loc){
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(FishingItems.rawFish, meta, new ModelResourceLocation(loc, "inventory"));
}

 

*The JUtils class is just an helper class to convert a list to array

 

So the models for the cooked fish appear on the raw fish and non appear on the raw fish.

Any help would be greatly apreciated because i cant seem to figure it out.

Link to comment
Share on other sites

Dude... you need more sleep :)

 

	private void registerItemModelWithMeta(Item item, int meta, String loc){
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(
                           FishingItems.rawFish,                                                                           // aiiiiee
                           meta, new ModelResourceLocation(loc, "inventory"));

 

-TGG

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.