Jump to content

[1.12.2] Item model depending on capability


Meldexun

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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.