Posted September 11, 201510 yr 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
September 11, 201510 yr 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.
September 11, 201510 yr 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]
September 12, 201510 yr 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
September 12, 201510 yr 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
September 13, 201510 yr 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.