Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.4] How load custom obj models?


Brbcode
 Share

Recommended Posts

I want load a custom obj file and I'm a bit lost.

First of all I want assert that my knowledge is right
assets->modid->blockstates has a json file which name match with a block id and specifies what model must show

Spoiler

{
    "variants": {
        "facing=north": { "model": "modid:block/block_1" },
        "facing=south": { "model": "modid:block/block_2" }
    }
}

"modid:block/block_1" and "modid:block/block_2" must to be registered

assets->modid->models->block has a json file which match with a block id and specifies the elements and textures 

Spoiler

Example default lever


{
    "ambientocclusion": false,
    "textures": {
        "particle": "block/cobblestone",
        "base": "block/cobblestone",
        "lever": "block/lever"
    },
    "elements": [
        {   "from": [ 5, 0, 4 ],
            "to": [ 11, 3, 12 ],
            "faces": {
                "down":  { "uv": [ 5, 4, 11, 12 ], "texture": "#base", "cullface": "down" },
                "up":    { "uv": [ 5, 4, 11, 12 ], "texture": "#base" },
                "north": { "uv": [ 5, 0, 11,  3 ], "texture": "#base" },
                "south": { "uv": [ 5, 0, 11,  3 ], "texture": "#base" },
                "west":  { "uv": [ 4, 0, 12,  3 ], "texture": "#base" },
                "east":  { "uv": [ 4, 0, 12,  3 ], "texture": "#base" }
            }
        },
        {   "from": [ 7, 1, 7 ],
            "to": [ 9, 11, 9 ],
            "rotation": { "origin": [ 8, 1, 8 ], "axis": "x", "angle": -45 },
            "faces": {
                "up":    { "uv": [ 7, 6, 9,  8 ], "texture": "#lever" },
                "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" },
                "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" },
                "west":  { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" },
                "east":  { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" }
            }
        }
    ]
}

Should I use a obj file as element? or instead a json file use a obj file?

 

I have read that obj files must be registered with "OBJLoader.addDomain" but it's from 1.12 version, eclipse doesn't find that class in the dependencies so I think that is despreciated.

Where should I save the obj file?

Must obj file has the same name of a block id?

Must I register the obj file? How?

 

Link to comment
Share on other sites

39 minutes ago, Brbcode said:

I want load a custom obj file and I'm a bit lost.

First of all I want assert that my knowledge is right
assets->modid->blockstates has a json file which name match with a block id and specifies what model must show

  Hide contents


{
    "variants": {
        "facing=north": { "model": "modid:block/block_1" },
        "facing=south": { "model": "modid:block/block_2" }
    }
}

"modid:block/block_1" and "modid:block/block_2" must to be registered

assets->modid->models->block has a json file which match with a block id and specifies the elements and textures 

  Hide contents

Example default lever



{
    "ambientocclusion": false,
    "textures": {
        "particle": "block/cobblestone",
        "base": "block/cobblestone",
        "lever": "block/lever"
    },
    "elements": [
        {   "from": [ 5, 0, 4 ],
            "to": [ 11, 3, 12 ],
            "faces": {
                "down":  { "uv": [ 5, 4, 11, 12 ], "texture": "#base", "cullface": "down" },
                "up":    { "uv": [ 5, 4, 11, 12 ], "texture": "#base" },
                "north": { "uv": [ 5, 0, 11,  3 ], "texture": "#base" },
                "south": { "uv": [ 5, 0, 11,  3 ], "texture": "#base" },
                "west":  { "uv": [ 4, 0, 12,  3 ], "texture": "#base" },
                "east":  { "uv": [ 4, 0, 12,  3 ], "texture": "#base" }
            }
        },
        {   "from": [ 7, 1, 7 ],
            "to": [ 9, 11, 9 ],
            "rotation": { "origin": [ 8, 1, 8 ], "axis": "x", "angle": -45 },
            "faces": {
                "up":    { "uv": [ 7, 6, 9,  8 ], "texture": "#lever" },
                "north": { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" },
                "south": { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" },
                "west":  { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" },
                "east":  { "uv": [ 7, 6, 9, 16 ], "texture": "#lever" }
            }
        }
    ]
}

Should I use a obj file as element? or instead a json file use a obj file?

 

I have read that obj files must be registered with "OBJLoader.addDomain" but it's from 1.12 version, eclipse doesn't find that class in the dependencies so I think that is despreciated.

Where should I save the obj file?

Must obj file has the same name of a block id?

Must I register the obj file? How?

 

I don't know but

    "textures": {
        "particle": "block/cobblestone",
        "base": "block/cobblestone",
        "lever": "block/lever"
    },

"block" should be "blocks" isn't it

If you are using your own texture you add your mod id in front of if

Link to comment
Share on other sites

19 minutes ago, poopoodice said:

"block" should be "blocks" isn't it

That example is from minecraft files is not mine, and I already use modid:block/texture_name and it works.

Maybe if you change the file path you can give a custom name if you want, sincerely, I didn't try it.

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.