Jump to content

Recommended Posts

Posted

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)

H4nMkBT.png

 

And my UV map in Blender

OKqNE1H.png

 

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.

eMltywQ.png

 

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.

Posted

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]

Posted

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

 

Posted

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]

Posted

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.

Posted

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]

Posted

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

Posted

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]

Posted

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.

Posted

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]

Posted

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

Posted

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]

Posted

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

Posted

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 :P 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?

Posted

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:

wiXcdox.png

Posted

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.