NISHIO Hirokazu[Translate]
Minecraft JE1.17でリソースパックを作る

まとめ
既存のモデルのテクスチャを変えるのは楽
画像を変えるだけなので。
鎧兜などのデザインを変えるのも簡単
モデルのテクスチャを変えることしかできない
なのでテクスチャ変更同様の難易度
Blockbenchを使うことがおすすめ
新規作成のMinecraft SkinからArmorとかを選んで3D形状を見ながら塗り絵ができる
ブロックの形状を変えるのは難しい、色々な仕様が影響して複雑
当たり判定のない物でよいなら、手持ちのアイテムとして作り額縁に入れるのが良い
下記のカスタム例は全部額縁に入ったアイテム(額縁のモデルを1/4に縮小している)



---
以下Texture編

---
を読んだがわからない

これをみたらわかった
まず.minecraft - Minecraft Wikiでマイクラのファイルの位置を確認
Mac OS X ~/Library/Application Support/minecraft
そしてminecraft/versionsのjarをzipにして展開する
assetsに色々なファイルが入っている

中を見てみよう
assets/minecraft/blockstates/blue_terracotta.json
{ "variants": { "": { "model": "minecraft:block/blue_terracotta" } } }

assets/minecraft/models/block/blue_terracotta.json
{ "parent": "minecraft:block/cube_all", "textures": { "all": "minecraft:block/blue_terracotta" } }
つまり形状がキューブで全面のテクスチャが同じであり、そのテクスチャは block/blue_terracotta

ところでここまできてから気づいたけど blue_terracotta は単色のやつで、僕が探してたのは blue_glazed_terracotta だった
assets/minecraft/textures/block/blue_glazed_terracotta.png
これを別の画像で置き換えてみる

あらためて、今から作ろうとしているものが黄色いことを思い出したので yellow_glazed_terracotta を見る
assets/minecraft/blockstates/yellow_glazed_terracotta.json
{ "variants": { "facing=east": { "model": "minecraft:block/yellow_glazed_terracotta", "y": 270 }, "facing=north": { "model": "minecraft:block/yellow_glazed_terracotta", "y": 180 }, "facing=south": { "model": "minecraft:block/yellow_glazed_terracotta" }, "facing=west": { "model": "minecraft:block/yellow_glazed_terracotta", "y": 90 } } }
これはブロックの向きの情報によって表示するモデルをY軸周りに回転せよ、という指令

で、そのモデルはこう
assets/minecraft/models/block/yellow_glazed_terracotta.json
{ "parent": "minecraft:block/template_glazed_terracotta", "textures": { "pattern": "minecraft:block/yellow_glazed_terracotta" } }

assets/minecraft/textures/block/yellow_glazed_terracotta.png
結論、この画像を差し替えれば良いはず

このassetと同じディレクトリ構造で差し替えるファイルだけを.minecraft/resourcepacks以下におけば良い

作ったリソースパックを入れる

できた

加筆
という構造なのでX.pngを直接置き換えるか、新しいファイルを置いてblock/X.jsonからの参照を書き換えると良い
そうすれば手持ちのアイテムのモデルも書き換えたものになる


assets/minecraft/models/item/yellow_glazed_terracotta.json
{ "parent": "minecraft:block/yellow_glazed_terracotta" }
assets/minecraft/models/block/yellow_glazed_terracotta.json
{ "parent": "minecraft:block/template_glazed_terracotta", "textures": { "pattern": "minecraft:block/yellow_glazed_terracotta" } }
assets/minecraft/blockstates/yellow_glazed_terracotta.json
{ "variants": { "facing=east": { "model": "minecraft:block/yellow_glazed_terracotta", "y": 270 }, "facing=north": { "model": "minecraft:block/yellow_glazed_terracotta", "y": 180 }, "facing=south": { "model": "minecraft:block/yellow_glazed_terracotta" }, "facing=west": { "model": "minecraft:block/yellow_glazed_terracotta", "y": 90 } } }


次にこれをサーバに置いて、参加者がリソースパックの設定をしなくても適用されるようにする

今は僕の手元(Mac)で下記のシェルスクリプトを実行している 
resourcepacks/cybozu/build.sh
zip -r ../cybozu.zip . shasum ../cybozu.zip mv ../cybozu.zip ~/Dropbox
表示されたハッシュ値をserver.propertiesに書き、サーバを再起動する。
サーバの設定はこんな感じ
server.properties
resource-pack=https\://www.dropbox.com/.../cybozu.zip?dl\=1 require-resource-pack=true resource-pack-sha1=...

クライアントは再度ログインした後、サーバリソースパックを受け入れるか質問される
受け入れて進むとダウンロードされるかと思いきや、されない、なぜ?
その次に接続したときにダウンロードされる

"Engineer's way of creating knowledge" the English version of my book is now available on [Engineer's way of creating knowledge]

(C)NISHIO Hirokazu / Converted from [Scrapbox] at [Edit]