Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.