obj Model
- Compared with vanilla
MinecraftJSON models,objmodels are much more flexible for authoring. For example, uses them for blocks like the and .Build an
objModel First create an
objmodel. You can use many tools, such as , , and . Example:# Made in Blockbench 4.8.3 mtllib qqqqoo.mtl o pyramid v 1 -2.220446049250313e-16 1 v 1 0.9999999999999998 1.0000000000000002 v 0 0.9999999999999998 1.0000000000000002 v 0 -2.220446049250313e-16 1 v 0.5 0.4999999999999999 0.5000000000000001 vt 0.25 0.75 vt 0.25 1 vt 0 1 vt 0 0.75 vt 0 0.479471875 vt 0.25 0.479471875 vt 0.125 0.65625 vt 0.1875 0.620096875 vt 0.4375 0.620096875 vt 0.3125 0.796875 vt 0.265625 0.823221875 vt 0.515625 0.823221875 vt 0.390625 1 vt 0.375 0.479471875 vt 0.625 0.479471875 vt 0.5 0.65625 vn 0 -2.220446049250313e-16 1 vn 0.7071067811865476 1.5700924586837752e-16 -0.7071067811865476 vn 0 0.7071067811865477 -0.7071067811865475 vn 0 -0.7071067811865475 -0.7071067811865477 vn -0.7071067811865476 1.5700924586837752e-16 -0.7071067811865476 usemtl m_c5b90dae-3a75-90c1-2280-8a6b9dc0fba2 f 1/1/1 2/2/1 3/3/1 4/4/1 f 2/5/2 1/6/2 5/7/2 f 3/8/3 2/9/3 5/10/3 f 1/11/4 4/12/4 5/13/4 f 4/14/5 3/15/5 5/16/5Exporting also generates an
mtlfile and apngtexture file:# Made in Blockbench 4.8.3 newmtl m_c5b90dae-3a75-90c1-2280-8a6b9dc0fba2 map_Kd kubejs:block/qqqqoo newmtl noneMake sure
usemtl m_c5b90dae-3a75-90c1-2280-8a6b9dc0fba2inobjmatchesnewmtl m_c5b90dae-3a75-90c1-2280-8a6b9dc0fba2inmtl.mtllib qqqqoo.mtlinobjpoints to the mtl file; keeping them at the same level is fine by default.
map_Kdinmtlspecifies the texture path.
Like vanilla models, place textures inassets/${modid}/textures/block(this tutorial uses a block example, so it is underblock; for items, useitem).
Point to the
objFile - Vanilla
Minecraftcannot loadobjfiles directly, so you need ajsonmodel file that points to theobjfile.json{ "loader": "forge:obj", "model": "kubejs:models/block/qqqqoo.obj", "flip_v": true, "textures": { "particle": "kubejs:block/qqqqoo" } }loaderspecifies the model loader type; here it is set toobj.
modelspecifies the path to theobjmodel.
flip_vcontrols texture flipping. SinceobjUVs are vertically inverted relative to MC, set it totrue.
texturesspecifies textures to load;particleis used here for particle texture.
- Vanilla
Define
blockstate- When loading an
objmodel, you must provide ablockstate. It is not auto-generated forobj, so without it the block cannot resolve its model.json{ "variants": { "facing=down": { "model": "kubejs:block/qqqqoo", "x": 90 }, "facing=east": { "model": "kubejs:block/qqqqoo", "y": 90 }, "facing=north": { "model": "kubejs:block/qqqqoo" }, "facing=south": { "model": "kubejs:block/qqqqoo", "y": 180 }, "facing=up": { "model": "kubejs:block/qqqqoo", "x": 270 }, "facing=west": { "model": "kubejs:block/qqqqoo", "y": 270 } } } Check Paths
Place themtl,obj, and thejsonmodel that points to theobjinassets/${modid}/models/block.
Place thepngtexture inassets/${modid}/textures/block.
Theblockstatejsonfile should be inassets/${modid}/blockstate.
These files should be named after the block registry name.
If the exported model appears offset in-game, adjust it in the modeling tool.
References
- When loading an