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

How can I change the texture of an item ingame?

 

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

You need to say - based on what? ItemStack's NBT? ISmartItemModel is your shot.

You willl still need json models etc.

 

Other option would be having variants and change item's meta (recreate item on certain action).

 

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe15_item_smartitemmodel

1.7.10 is no longer supported by forge, you are on your own.

What if he wants to bind textures not of .JSON models dynamically in-game? Why would he want to pre-create a bunch of .JSON models for his item? There really needs to be a feature for binding textures to items just like IItemRenderer had back then...

 

Yes, you can use IPerspectiveAwareModel to change the model based on the camera transform, ISmartItemModel based on the itemstack information, IFlexibleBakedModel for an explicit vertex format, etc. If you just want to create a bunch of .JSON models but don't need any of the interfaces above, simply override the getModel() method your item class and return any ModelResourceLocation you want for that item. Don't forget to add your extra .JSONs do the ModelBakery by using the ModelBakery.addVariantName(String) method. Hope that helps you out!

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

Yes based on the NBT, so I will try this getModel thingy out, lets see how this one works

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

  • Author

But well, this model thing does only, like model, is called when the player holds it in his hand, I much more smarter thing would be, because I want to use the already existing jsons from other items, so does anyone know how to get them, and then bind them to the renderer?

 

I don't think that will work, because that qould change all the Items:

 

BTTagCompound nbt = stack.getTagCompound();
	String renderItem = nbt.getString("unlocalizedRender");
	ItemStack theRenderStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) nbt.getTag("stackTag"));
	IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(theRenderStack);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(this, new ModelResourceLocation(model.getTexture().toString(), "inventory"));

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Yes based on the NBT, so I will try this getModel thingy out, lets see how this one works

 

For NBT you want to create a class implementing ISmartItemModel and checking NBT data in the handleItemState() method. You can switch between different models based on NBT their, since handleItemState() returns an IBakedModel type. You may have to add your ModelResourceLocation to the model bakery - ModelBakery.addVariantName(Item, Meta, modelresourcelocation(ID + : +NameOfModel, inv);

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

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.