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

Hello,

So i basically want to create a item with 20 different models.

1. First of all when creating a ModelResourceLocation what is the use of the variant parameter (when registering a item model)?

2. I have a capability added to my item. Can i somehow change the model of the item depending on the capability? The meta won't really work because i need more than 16 models.

  • Author
10 minutes ago, diesieben07 said:

When only using an item model (not a blockstate) it must be "inventory". Otherwise you can set it to a variant and it will pick that variant from the blockstate json.

Yeah i knew how it works with blockstates but i thought it may also work with items.

 

11 minutes ago, diesieben07 said:

ItemStack metadata is a full short (16 bits)

So i just registered a item model with the metadata of 16 and it seems to work ingame.

This is what i have done:

	@SubscribeEvent
	public static void registerItemModels(ModelRegistryEvent event) {
		registerCustomItemModel(ModItems.DUNGEON_PLACER, 16, ModItems.DUNGEON_PLACER.getRegistryName().toString() + "_d" + 16, "inventory");
	}

	private static void registerCustomItemModel(Item item, int meta, String modelLocation, String variant) {
		ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(modelLocation, variant));
	}

Is there any reason not to do this?

  • Author
10 minutes ago, diesieben07 said:

Also note however that in 1.14.4 it is encouraged you flatten your items, so maybe you want to do that already to aid in updating (i.e. make 20 items instead of 1 with 20 metadata values). 

Iirc in 1.12.2 there is an item limit and you still recommend creating 20 items. Can't this cause issues? I thought only in MC 1.13 and newer i should create 20 items.

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.