Search In
• More options...
Find results that contain...
Find results in...

# [1.8] [SOLVED] B3D item model has no texture

## Recommended Posts

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": {
},
"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.

##### Share on other sites

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?

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

##### Share on other sites

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".

##### Share on other sites

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.

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

##### Share on other sites

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.

##### Share on other sites

You are correct. Are you using the .B3D exporter by RainWarrior?

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

##### Share on other sites

You are correct. Are you using the .B3D exporter by RainWarrior?

Yes this one: https://github.com/RainWarrior/B3DExport

##### Share on other sites

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.

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

##### Share on other sites

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

##### Share on other sites

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"));


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

##### Share on other sites

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.

##### Share on other sites

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


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

##### Share on other sites

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/.

##### Share on other sites

I did the same. We'll get this working one way or another.

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

##### Share on other sites

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?

##### Share on other sites

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...

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

##### Share on other sites

Why didn't RainWarrioir continue the OBJLoader...B3D is horrible.

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

##### Share on other sites

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"
}
}


##### Share on other sites

Also, try with .png behind your texturepath.

##### Share on other sites

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

##### Share on other sites

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?

##### Share on other sites

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:

##### Share on other sites

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?

##### Share on other sites

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

##### Share on other sites

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

## 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.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

• ### Posts

• @Mod.EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT) public class ClientEvents { @SubscribeEvent public static void camera(ViewportEvent.ComputeCameraAngles event) { event.setRoll(180f); } }
• @SubscribeEvent public static void onRenderTick(TickEvent.RenderTickEvent event) { Player player = Minecraft.getInstance().player; if (player != null) { Vec2 rotation = new Vec2(player.getXRot(), player.getYRot()); Vec2 addition = Vec2Rot(new Vec3(0, 0, 0.01)); player.setXRot(rotation.x + addition.x); player.setYRot(rotation.y + addition.y); } } So i was thinking that minecraft camera rotation is kinda boring so i try to make it rotate on z-axis (like how it did when the player get damage), i soonly writing codes to test it and the x, y works fine but when i try to set the z rotation, there is no setZRot method. I went to find class like Renderers, Camera, etc in the sources but still can't find how to do it. Does anyone know how to do it, or is this not possible?
• Hello, I have a block entity that is using entity.teleportTo(x, y, z); to teleport an entity(Armor Stand in this case) into a chunk that's being kept loaded with ForgeChunkManager.forceChunk(level.getServer().getLevel(Level.OVERWORLD), StargateJourney.MODID, getBlockPos(), level.getChunk(getBlockPos()).getPos().x, level.getChunk(getBlockPos()).getPos().z, true, true); It works well, however, when I teleport the player alongside the entity, the entity doesn't load. It's still there, because if the player leaves to unload the chunk and then returns, the entity appears where it should. I've tried fixing it by not forceloading the chunk and the entity loads without problems, but I actually need to have the chunk loaded, because I have a block entity in said chunk, that is ticking(essentially, it's the second end of a teleporter mechanism). Is there a workaround to load the entity manually or even better, have it never unload in the first place?
• Apologies, but as this is written with MCreator, we do not support it on this forum. Please ask their support forums for help.
• Google the IDE and look up the features necessary to do so. There is plenty of text and videos about how to use it. Everything is written by volunteers and they have to be maintained by volunteers. Additionally, when it comes to the official docs or the community wiki, there are only so many people who have time and are willing to do that. It requires a lot of research to be able to write something competent without providing copy-paste elements. So, unless you're willing to hire people to do so, contribute to the people who keep Forge going, or write some yourself, expect that there probably won't be any documentation for anything besides from simple elements.

• 1
• 0
• 2
• 3
• 10
• ### Who's Online (See full list)

×

• #### Activity

×
• Create New...