SackCastellon Posted April 8, 2015 Share Posted April 8, 2015 Hi, i have a bunch of item variables based on NBT Tags, so the same item has got more than 100 variables, and its not cool to create 100 json files, which are completely identical with the difference of the texture location, so i was wondering if is there any way to set dynamically the location of the texture. Something like: public ResourceLocation getTextureLocation(ItemStack stack, int layer) { // You stuff return new ResourceLocation("modid:itemVariable"); } I hope I explained correctly Thanks in advance for helping. Quote Link to comment Share on other sites More sharing options...
N247S Posted April 8, 2015 Share Posted April 8, 2015 this will work, as long as the "itemVariable" is a string wich is pointing in the right location. Quote Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager Link to comment Share on other sites More sharing options...
jabelar Posted April 8, 2015 Share Posted April 8, 2015 How exactly are your 100 variants stored? In metadata? Yeah, JSON method can make algorithmic model/texture settings a bit complicated. I think you can override the Item#getModel() method to algorithmically reference different models, but I think that still requires a JSON per variant. Note that you can probably make a script (heck probably even just use EXCEL) to create the JSON content for you. Definitely a pain, but as you can see in the default Minecraft asset item JSON models, they went ahead and make a hundred of them. Maybe someone knows a better way though. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/ Link to comment Share on other sites More sharing options...
SackCastellon Posted April 8, 2015 Author Share Posted April 8, 2015 How exactly are your 100 variants stored? In metadata? Yeah, JSON method can make algorithmic model/texture settings a bit complicated. I think you can override the Item#getModel() method to algorithmically reference different models, but I think that still requires a JSON per variant. Note that you can probably make a script (heck probably even just use EXCEL) to create the JSON content for you. Definitely a pain, but as you can see in the default Minecraft asset item JSON models, they went ahead and make a hundred of them. Maybe someone knows a better way though. No, they are stored in NBT Tags. Ok, i'll try to find some way to do it. Quote Link to comment Share on other sites More sharing options...
SackCastellon Posted April 8, 2015 Author Share Posted April 8, 2015 Otherwise if someone knows any way to do it, he/she is welcome Quote Link to comment Share on other sites More sharing options...
TheGreyGhost Posted April 9, 2015 Share Posted April 9, 2015 Hi I suggest - stitch your 100 textures into the block texture sheet, then use ISmartItemModel to modify the baked quads it returns to give the correct [u,v] coordinates for the desired texture. Never tried it. Should work, but will take a fair bit of experimentation I think. -TGG Quote Link to comment Share on other sites More sharing options...
SackCastellon Posted April 9, 2015 Author Share Posted April 9, 2015 Hi I suggest - stitch your 100 textures into the block texture sheet, then use ISmartItemModel to modify the baked quads it returns to give the correct [u,v] coordinates for the desired texture. Never tried it. Should work, but will take a fair bit of experimentation I think. -TGG Ok... excuse me if i'm very ignorant but, how do I get an ISmartItemModel as the ibakedmodel variable to use the handleItemState(stack) later?? Because all the ibakedmodel are IFlexibleBakedModel (I hope you understood me) <<net.minecraft.client.renderer.ItemModelMesher>> public IBakedModel getItemModel(ItemStack stack) { Item item = stack.getItem(); IBakedModel ibakedmodel = this.getItemModel(item, this.getMetadata(stack)); if (ibakedmodel == null) { ItemMeshDefinition itemmeshdefinition = (ItemMeshDefinition)this.shapers.get(item); if (itemmeshdefinition != null) { ibakedmodel = this.modelManager.getModel(itemmeshdefinition.getModelLocation(stack)); } } if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) { ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); } if (ibakedmodel == null) { ibakedmodel = this.modelManager.getMissingModel(); } return ibakedmodel; } Quote Link to comment Share on other sites More sharing options...
TheGreyGhost Posted April 10, 2015 Share Posted April 10, 2015 Hi To be honest I don't know details because I haven't personally done it yet however this post looks like it will show you how - i.e. ICustomModelLoader http://www.minecraftforge.net/forum/index.php/topic,28714.msg147632.html#msg147632 -TGG Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.