本教學是對官方支持的附加包來修改的。
概括
本教學是對於高級使用者編寫的!普通使用者請不要輕易嘗試! 請您熟悉 JSON 的資料格式。如果您並不熟悉的話,請閱讀行為附加包教學的JSON部分。 在本教學中,我們將涉及:
- Minecraft的JSON模型格式
- 如何去修改模型
所需時間
30 分鐘
所需工具
一個文字編輯器
任何的文字編輯器應該都是可以的,但是我們建議您使用用於編程的IDE軟體。Notepad++ 是一個優秀且免費還帶有多程式語言高亮顯示支持的編輯器。你可以在 這兒 下載Notepad++ 。
入門
在本教學中我們將使 爬行者 有3個頭。但是在修改 爬行者 之前,我們來看看組成模型的代碼。
Minecraft模型格式
Minecraft的實體建模由JSON語言編程,模型由mobs.json這個.json檔案決定。你可以在Vanilla Minecraft資源包找到它,路徑為Vanilla Resource Pack/models/mobs.json。這些檔案包含了所有Minecraft中實體的模型代碼。模型代碼們看起來是這個樣子的:
- 實體模板的偽代碼
"geometry.entityname": {
"texturewidth": x,
"textrueheight": y,
"bones": [
{
"name": "body part name",
"pivot": [ x, y, z ],
"cubes": [
{
"origin": [ x, y, z ],
"size": [ x, y, z ],
"uv": [ x, y ]
}
]
}
]
}
注: 這只是一個參考例子,不是一個可用的實體模型。使用它作為代碼是沒用的!
骨骼動畫
骨骼是我們用來製作模型的。把它想像成一具骷髏!在人體中,骨骼是由肌肉運動的,而你的肌肉也隨著肌肉運動。在3D動畫中,骨骼是由動畫移動的,而動畫反過來又會移動附著在骨骼上的幾何圖形!
重要注意事項
模型還不是完全由資料驅動的。雖然可以變更模型的內容,但是仍然有一些硬編碼的值,比如:一個實體需要哪些骨骼,一個實體用什麼材料呈現,以及一個實體有什麼動畫。這意味著你不能只是複製和粘貼幾何形狀從村民到蜘蛛部分,並希望它工作!在這個系統變得更加資料驅動之前,您需要做一些實驗來達到您想要的結果!
確保你的骨骼名稱正確!實體的骨骼名稱應該與Minecraft-vanilla資源包中的骨骼名稱相同。模型的動畫和繪製依賴於上述資訊的正確性!
修改爬行者
現在我們已經了解了Minecraft模型格式是如何設定的,讓我們稍微修改一下creeper。我們要讓他有3個正面,2個在底部,1個堆在頂部,像金字塔一樣。
1.13之前的版本
- 首先,在Vanilla Minecraft的Vanilla包裡
mobs.json找到geometry.creeper區複製下來。Vanilla Resource Pack/models/mobs.json
- 在資源包中建立一個名為
models的資料夾 - 建立一個名為
mobs.json的新json檔案並將其儲存到新模型資料夾中。 - 輸入一對大括號(
{ })在你新建的mobs.json然後粘貼geometry.creeper。 - 現在,讓我們先把它原來的頭向左移一點。為了做到這一點,我們要改變骨頭命名的原點的x分量"
head" 從 -4 到 -8. - 現在將 "
cubes" 複製到 "head"的方括號中。. 這時文字應該是灰色的。
- mobs.json – geometry.creeper – head section
{
"name": "head",
"pivot": [ 0.0, 18.0, 0.0 ],
"cubes": [
{
"origin": [ -8.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
}
]
},
- 在你複製的行後面加上一個逗號。
- 粘貼你在逗號後面複製的行
- 在剛剛粘貼的行後面加一個逗號
- 在新逗號後再次粘貼複製的行
- 你現在應該有3對大括號在 "
cubes" 每個都有一個原點,大小和uv對象 - 在複製的第一行中,我們將把原點的x分量從-8改變為0,向右移動
- 在第二個副本中,將原點的x分量改為-4,y分量改為26
- 爬行者的頭部部分現在應該看起來像(新文字為灰色):
- mobs.json – geometry.creeper – head section
{
"name": "head",
"pivot": [ 0.0, 18.0, 0.0 ],
"cubes": [
{
"origin": [ -8.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
},
{
"origin": [ 0.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
},
{
"origin": [ -4.0, 26.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
}
]
},
注意,我們不需要改變新頭像的UV因為我們複製了舊頭像的UV座標我們沒有給新頭像加入不同的紋理。
結果
修改其他生物
如果要變更另一個實體的模型,請確保在右大括號後面加上逗號 geometry.creeper.
- 偽代碼示例
別忘了逗號!(紅色突出顯示)
{
"geometry.creeper": {
// model stuff
},
"geometry.chicken": {
// model stuff
}
}
1.13及以後版本
- 首先,在Vanilla Minecraft的Vanilla包裡找到
models/entity/creeper.geo.json打開,並複製它的全部內容 - 在資源包中建立一個名為
models的資料夾 - 接著建立一個名為
entity的資料夾 - 建立一個名為
creeper.geo.json的新json檔案並將其儲存到entity資料夾中。 - 打開你新建的
creeper.geo.json然後粘貼你複製的內容,它看起來應該是這樣的
{
"format_version": "1.8.0",
"geometry.creeper": {
"visible_bounds_width": 1,
"visible_bounds_height": 2,
"visible_bounds_offset": [ 0, 0.75, 0 ],
"texturewidth": 64,
"textureheight": 32,
"bones": [
{
"name": "body",
"cubes": [
{
"origin": [ -4.0, 6.0, -2.0 ],
"size": [ 8, 12, 4 ],
"uv": [ 16, 16 ]
}
]
},
{
"name": "head",
"parent": "body",
"pivot": [ 0.0, 18.0, 0.0 ],
"cubes": [
{
"origin": [ -4.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
}
]
},
{
"name": "leg0",
"parent": "body",
"pivot": [ -2.0, 6.0, 4.0 ],
"cubes": [
{
"origin": [ -4.0, 0.0, 2.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
]
},
{
"name": "leg1",
"parent": "body",
"pivot": [ 2.0, 6.0, 4.0 ],
"cubes": [
{
"origin": [ 0.0, 0.0, 2.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
]
},
{
"name": "leg2",
"parent": "body",
"pivot": [ -2.0, 6.0, -4.0 ],
"cubes": [
{
"origin": [ -4.0, 0.0, -6.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
]
},
{
"name": "leg3",
"parent": "body",
"pivot": [ 2.0, 6.0, -4.0 ],
"cubes": [
{
"origin": [ 0.0, 0.0, -6.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
]
}
]
},
"geometry.creeper.charged": {
"visible_bounds_width": 1,
"visible_bounds_height": 2,
"visible_bounds_offset": [ 0, 0.75, 0 ],
"texturewidth": 64,
"textureheight": 32,
"bones": [
{
"name": "body",
"cubes": [
{
"origin": [ -4.0, 6.0, -2.0 ],
"size": [ 8, 12, 4 ],
"uv": [ 16, 16 ]
}
],
"inflate": 2.0
},
{
"name": "head",
"parent": "body",
"pivot": [ 0.0, 18.0, 0.0 ],
"cubes": [
{
"origin": [ -4.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
}
],
"inflate": 2.0
},
{
"name": "leg0",
"parent": "body",
"pivot": [ -2.0, 6.0, 4.0 ],
"cubes": [
{
"origin": [ -4.0, 0.0, 2.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
],
"inflate": 2.0
},
{
"name": "leg1",
"parent": "body",
"pivot": [ 2.0, 6.0, 4.0 ],
"cubes": [
{
"origin": [ 0.0, 0.0, 2.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
],
"inflate": 2.0
},
{
"name": "leg2",
"parent": "body",
"pivot": [ -2.0, 6.0, -4.0 ],
"cubes": [
{
"origin": [ -4.0, 0.0, -6.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
],
"inflate": 2.0
},
{
"name": "leg3",
"parent": "body",
"pivot": [ 2.0, 6.0, -4.0 ],
"cubes": [
{
"origin": [ 0.0, 0.0, -6.0 ],
"size": [ 4, 6, 4 ],
"uv": [ 0, 16 ]
}
],
"inflate": 2.0
}
]
}
}
- 現在,讓我們先把它原來的頭向左移一點。為了做到這一點,我們要改變骨頭命名的原點的x分量"
head." 從 -4 到 -8. - 現在將 "
cubes" 複製到 "head."的方括號中。這時文字應該是灰色的。
- creeper.geo.json – geometry.creeper – head section
{
"name": "head",
"pivot": [ 0.0, 18.0, 0.0 ],
"cubes": [
{
"origin": [ -8.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
}
]
},
- 在你複製的行後面加上一個逗號。
- 粘貼你在逗號後面複製的行
- 在剛剛粘貼的行後面加一個逗號
- 在新逗號後再次粘貼複製的行
- 你現在應該有3對大括號在 "
cubes." 每個都有一個原點,大小和uv對象 - 在複製的第一行中,我們將把原點的x分量從-8改變為0,向右移動
- 在第二個副本中,將原點的x分量改為-4,y分量改為26
- 爬行者的頭部部分現在應該看起來像(新文字為灰色):
- creeper.geo.json – geometry.creeper – head section
{
"name": "head",
"pivot": [ 0.0, 18.0, 0.0 ],
"cubes": [
{
"origin": [ -8.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
},
{
"origin": [ 0.0, 18.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
},
{
"origin": [ -4.0, 26.0, -4.0 ],
"size": [ 8, 8, 8 ],
"uv": [ 0, 0 ]
}
]
},
注意,我們不需要改變新頭像的UV因為我們複製了舊頭像的UV座標我們沒有給新頭像加入不同的紋理。
結果
修改其他生物
* 回到你新建的models/entity文件夹中。 * 新建一个名字叫生物的英文.geo.json并重复以上操作。如cow.geo.json
總結
恭喜你!
如果您已經做到了這一點,那麼現在您應該已經知道了製作您自己的實體模型所需要知道的一切!
| 版本 |
| ||||||
|---|---|---|---|---|---|---|---|
| 開發 |
| ||||||
| 技術性 | |||||||
| 多人遊戲 | |||||||
| 特色功能 | |||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


