Posted July 19, 20169 yr So, I have been collaborating on a mod for about a week now, and we are still working on simple resources. However, trying to add a textured sapling has been MURDERING our brains. A.) The sapling block is implemented and initialized. B.)it has no texture C.) we have no idea how to get the 'vanilla' sapling look. (where the textures cross eachother like all other plants) Blockstate .json: { "variants": { "normal": { "model": "glorious:shinySapling" } } } Models Block .json: { "parent": "block/cross", "textures": { "cross": "glorious:blocks/shinySapling" } } BlockShinySapling.java http://pastebin.com/Qag6dWZz
July 19, 20169 yr Using block/cross as the model's parent should display the texture in a cross like vanilla saplings. Post your FML log (logs/fml-client-latest.log), it should say exactly what went wrong with the model/texture loading. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 19, 20169 yr [06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=0,type=dark_oak for blockstate "glorious:BlockShinySapling[stage=0,type=dark_oak]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=0,type=dark_oak with loader VariantLoader.INSTANCE, skipping ... Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException ... [06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=1,type=spruce for blockstate "glorious:BlockShinySapling[stage=1,type=spruce]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=1,type=spruce with loader VariantLoader.INSTANCE, skipping ... Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException ... [06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=1,type=acacia for blockstate "glorious:BlockShinySapling[stage=1,type=acacia]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=1,type=acacia with loader VariantLoader.INSTANCE, skipping ... Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException ... [06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=0,type=birch for blockstate "glorious:BlockShinySapling[stage=0,type=birch]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=0,type=birch with loader VariantLoader.INSTANCE, skipping ... Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException ... [06:11:10] [Client thread/ERROR] [FML/]: Suppressed additional 7 model loading errors for domain glorious Your block has two properties ( stage and type ), neither of which you've specified in your blockstates file. If these properties don't affect the model, you can register an IStateMapper with ModelLoader.setCustomStateMapper . The easiest way to create an IStateMapper is to use StateMap.Builder . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 19, 20169 yr Author So I'd have to create the IStateMapper in the class file for the sapling it's self? to be completely honest I don't understand any of that. Or where it should/could go.
July 19, 20169 yr So I'd have to create the IStateMapper in the class file for the sapling it's self? to be completely honest I don't understand any of that. Or where it should/could go. Register the IStateMapper in the same class where you register your item models during preInit. I'd recommend doing this in a dedicated client-only class. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 19, 20169 yr Author I have a feeling I am doing this all wrong because I can't seem to understand what exactly needs to be done with IStateMapper
July 19, 20169 yr Create an instance of StateMap.Builder Call StateMap.Builder#ignore to ignore the properties that don't affect your model Call StateMap.Builder#build to create the IStateMapper Call ModelLoader.setCustomStateMapper to register the IStateMapper for your Block Side note: You should be using ModelLoader.setCustomModelResourceLocation / setCustomMeshDefinition in preInit rather than ItemModelMesher#register in init to register your item models. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 20, 20169 yr So, as a beginner modder, I'm a little lost based on your explanation. Where would I call the StateMap.Builder? Also, what's the difference between using ModelLoader.setCustomModelResourceLocation/setCustomMeshDefinition and using Minecraft.getMinecraft().getRenderItem().getItemModelMesher() ? If you can't answer this specifically then is there somewhere I can get detailed documentation on these things without just peering at the forge source? Preferably somewhere with an example as to how these are used. It makes no difference to me if it's a video or written document as long as it's up to date with Minecraft 1.10.2. A lot of documentation seems to be out of date and a lot of things I have tried have failed due to changes in forge since the time of the written documentation being written. Thanks for the help!
July 20, 20169 yr If you haven't already, create a dedicated client-only class to register your block and item models. In a method of this class called from your client proxy in preInit, create and register the IStateMapper . ModelLoader.setCustomModelResourceLocation will call ModelBakery.registerItemVariants for you (the corresponding ItemModelMesher#register overload doesn't), telling Minecraft to load the model. There's not really any difference between ModelLoader.setCustomMeshDefinition and the corresponding ItemModelMesher#register overload, but I'd still recommend using the Forge method rather than the vanilla one. There's no documentation on this that I know of. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 20, 20169 yr Okay, so I put the ModelLoader.setCustomStateMapper inside our ClientProxy. The issue I have is that we don't have more than one type of tree, and so I haven't created a "EnumType" for our wood. ...withName(BlockShinySapling.Type).withSuffix(_sapling).build(); This part is what I'm struggling with understanding what to do with. I can go in and create an enum for the wood type, but it seems like there would be a simpler way of doing this for only one wood type. Also, should I also be using the ModelLoader for all of our other blocks that are just the decorative ones with no special rendering? I have yet to figure out how to do that just by reading BlockModelShapes.class and ModelLoader.class. This is honestly probably going to be something with a very simplistic answer and it's just going over my head.
July 21, 20169 yr I didn't say anything about the withName or withSuffix methods, they're not needed in this case. Only use ModelLoader.setCustomStateMapper when you need a custom IStateMapper for a Block . Use ModelLoader.setCustomModelResourceLocation / setCustomMeshDefinition to register the model(s) for every Item (including ItemBlock s). Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 21, 20169 yr Sorry, I should have specified a bit more. Where do I get an IStateMapper from? I tried looking around but I can't seem to find where I create one. public static Builder build; build.build() Above returns a StateMapper and I'm not sure how to get a StateMapper into an IStateMapper.
July 21, 20169 yr Don't store the StateMap.Builder in a field, it's only a temporary object. You must actually create an instance of StateMap.Builder . StateMap implements IStateMapper . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
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.