Wehavecookies56 Posted September 19, 2015 Share Posted September 19, 2015 Edit: A new problem has appeared where I have a model that is using the wrong texture map. If I remove the textures, it errors suggesting that the textures are being loaded but not loaded. Edit2: I'm stupid the UV map was misplaced. I have an item using a b3d model which is working correctly other than the fact that it does not display a texture. I am not sure what is wrong here as the console does not show any errors. I am wondering if it has something to do with my model setup in Blender or something else. I am using this code in my ClientProxy which is run during the pre initialization (Reference.MODID's value is kk and Strings.KingdomKey's value is kingdomkey) B3DLoader.instance.addDomain(Reference.MODID); ModelLoader.setCustomModelResourceLocation(ModItems.KingdomKey, 0, new ModelResourceLocation(Reference.MODID + ":" + Strings.KingdomKey, "inventory")); Here's my blockstate json for my item (kingdomkey.json) { "forge_marker": 1, "defaults": { "textures": { "texture": "kk:items/keyblades/kingdomkey" }, "model": "kk:kingdomkey.b3d" }, "variants": { "inventory": [ { "transform": { "thirdperson": { "scale": 0.02 }, "gui": { "scale": 0.02 }, "firstperson": { "scale": 0.02 } } } ] } } Here's my texture (kingdomkey.png) And my UV map in Blender As you can see in this screenshot the model renders fine but it is missing the texture. The orientation's not right but that's not a problem. If anyone knows what the problem is I'd be grateful to know. I have spent many hours trying to get this to work. Also this is my first post on here so I hope I'm doing things right. Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 I think you should look very closely to your path to the texture in your .JSON. "texture": "modid:items/yourtexture" P.S - I've been trying to get my B3D models to load...but I can't...if you could help me I'd be very grateful. You said something about a blockstate .JSON? For an item? What about the regular item .JSON? Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 I think you should look very closely to your path to the texture in your .JSON. "texture": "modid:items/yourtexture" P.S - I've been trying to get my B3D models to load...but I can't...if you could help me I'd be very grateful. You said something about a blockstate .JSON? For an item? What about the regular item .JSON? I have the texture located in src\main\resources\assets\kk\textures\items\keyblades\ And the file is name kingdomkey.png I don't see anything wrong here adding .png to the json I don't think is necessary but doesn't work either way. The kingdomkey.json file is located in src\main\resources\assets\kk\blockstates\ If I copy it to src\main\resources\assets\kk\models\item\ it says "BlockModel requires either elements or parent, found neither". Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 I don't think you need like a .mtl file - that is what the JSON is for I guess... I am getting a runtime exception on my B3D model saying there is no root mesh - blender is probably causing the problem. Make sure in Blender you UV the texture to the model then export it. After that, define your texture in the .JSON. Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 I don't think you need like a .mtl file - that is what the JSON is for I guess... I am getting a runtime exception on my B3D model saying there is no root mesh - blender is probably causing the problem. Make sure in Blender you UV the texture to the model then export it. After that, define your texture in the .JSON. Yeah the b3d exporter doesn't create a .mtl file so I assumed it wasn't needed. And I have done exactly that, the UV is setup and the texture is defined in the .json file. Which is why I am stumped on this. As I said the console shows no errors what so ever. The .json file definitely needs to be in the blockstates folder for the model to work though. Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 You are correct. Are you using the .B3D exporter by RainWarrior? Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 You are correct. Are you using the .B3D exporter by RainWarrior? Yes this one: https://github.com/RainWarrior/B3DExport Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 If I can get my model to render I can work on its textures and help you further. So the model.json goes in the blockstates folder, the model.b3d goes into the models/items folder, and the mesh must be triangular - is that correct? From there, I can help on solving the texture problem. Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 If I can get my model to render I can work on its textures and help you further. So the model.json goes in the blockstates folder, the model.b3d goes into the models/items folder, and the mesh must be triangular - is that correct? From there, I can help on solving the texture problem. Yes that is all correct Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 Actually, did you register your item render the usual way Minecraft.getMinecraft().getRenderItem().getItemModelMesher.register(item, 0, new modelresourcelocation...); And then use B3DLoader.instance.addDomain(Reference.MODID); ModelLoader.setCustomModelResourceLocation(ModItems.KingdomKey, 0, new ModelResourceLocation(Reference.MODID + ":" + Strings.KingdomKey, "inventory")); Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 Actually, did you register your item render the usual way Minecraft.getMinecraft().getRenderItem().getItemModelMesher.register(item, 0, new modelresourcelocation...); And then use B3DLoader.instance.addDomain(Reference.MODID); ModelLoader.setCustomModelResourceLocation(ModItems.KingdomKey, 0, new ModelResourceLocation(Reference.MODID + ":" + Strings.KingdomKey, "inventory")); Nope I assumed the normal item rendering way wouldn't work with this. Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 I'm still trying...lol. I keep getting this bull [13:12:29] [Client thread/ERROR] [FML]: No root mesh in model armed:models/block/gun.b3d and no mesh name in location, skipping Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 I'm still trying...lol. I keep getting this bull [13:12:29] [Client thread/ERROR] [FML]: No root mesh in model armed:models/block/gun.b3d and no mesh name in location, skipping In your .json file what did you specify as the path for the .b3d model as I just have "model": "kk:kingdomkey.b3d" and the model is placed in models/item/. Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 I did the same. We'll get this working one way or another. Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 I did the same. We'll get this working one way or another. I wonder why it is looking in models/block/ for the model have you tried placing the model in the block folder? Quote Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 I tried placing the model in the block folder - I'm rendering an item though. When I do that I get a FileNotFoundException saying it needs to be placed in the item folder - that tells me there that it definitely needs to be in the models/item folder. Also, we know that the .JSON has to be in the blockstates folder. There is probably something wrong with my model... Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
EverythingGames Posted September 19, 2015 Share Posted September 19, 2015 Why didn't RainWarrioir continue the OBJLoader...B3D is horrible. Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
ItsAMysteriousYT Posted September 19, 2015 Share Posted September 19, 2015 No its not, i actually think it is superawesome you know why? Cuz you can ANIMATE IT!! But nevertheless, i can't get the loading process done. What excactly belongs into the json files? The models/blocks file i did that: { "forge_marker": 1, "defaults": { "textures": { "texture": "reallifemod:textures/models/blocks/texture_Lantern.png" }, "model": "reallifemod:lantern.b3d" }, "variants": { "inventory": [ { "transform": { "thirdperson": { "scale": 0.02 }, "gui": { "scale": 0.02 }, "firstperson": { "scale": 0.02 } } } ] } } The same in the blockstate and in the itemfile this: { "parent": "reallifemod:blockLantern", "textures": { "all": "reallifemod:textures/models/block/texture_Lantern.png" } } Quote Link to comment Share on other sites More sharing options...
ItsAMysteriousYT Posted September 19, 2015 Share Posted September 19, 2015 Also, try with .png behind your texturepath. Quote Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 Okay I figured it out! The .json file texture path does nothing. The texture path needs to be set in Blender Like this: EDIT: Here's a screenshot of it working Quote Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 19, 2015 Author Share Posted September 19, 2015 No its not, i actually think it is superawesome you know why? Cuz you can ANIMATE IT!! But nevertheless, i can't get the loading process done. What excactly belongs into the json files? The models/blocks file i did that: { "forge_marker": 1, "defaults": { "textures": { "texture": "reallifemod:textures/models/blocks/texture_Lantern.png" }, "model": "reallifemod:lantern.b3d" }, "variants": { "inventory": [ { "transform": { "thirdperson": { "scale": 0.02 }, "gui": { "scale": 0.02 }, "firstperson": { "scale": 0.02 } } } ] } } The same in the blockstate and in the itemfile this: { "parent": "reallifemod:blockLantern", "textures": { "all": "reallifemod:textures/models/block/texture_Lantern.png" } } You shouldn't need a .json file in /models/block/ or /models/item/ The first .json file should be all you need in the blockstates folder. The .b3d should be in the /models/item/ if it's an item or /models/block if it's a block. Also you might want to up the scale I have it at 0.02 because my model is HUGE. I probably should start a new thread for this, but how do you animate it? Quote Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 20, 2015 Author Share Posted September 20, 2015 I tried placing the model in the block folder - I'm rendering an item though. When I do that I get a FileNotFoundException saying it needs to be placed in the item folder - that tells me there that it definitely needs to be in the models/item folder. Also, we know that the .JSON has to be in the blockstates folder. There is probably something wrong with my model... I've found the solution to your problem! I just tried adding my second model and I had the same error as you. It turns out you need to merge your model into 1 object which you can do by pressing A then Ctrl+J Then rename the object to "mesh" like this: Quote Link to comment Share on other sites More sharing options...
ItsAMysteriousYT Posted September 20, 2015 Share Posted September 20, 2015 Okay, and how excactly do i then load the model? When i put the thing in the blockstates folder, will it load completely or do i have to set any other stuff? Quote Link to comment Share on other sites More sharing options...
Wehavecookies56 Posted September 20, 2015 Author Share Posted September 20, 2015 Okay, and how excactly do i then load the model? When i put the thing in the blockstates folder, will it load completely or do i have to set any other stuff? Yep just have your .json file in the blockstates folder and have the model in "models/item/" or "models/block/" depending on what you're using Quote Link to comment Share on other sites More sharing options...
ItsAMysteriousYT Posted September 20, 2015 Share Posted September 20, 2015 Awesome. also, it is possible to render entities with it somehow, but ill have to have a close look at this. aswell as at the animation thing 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.