Skip to content

Instantly share code, notes, and snippets.

@keepoff07
Last active January 10, 2016 09:38
Show Gist options
  • Save keepoff07/3ed6feb2ba2d93e56fdb to your computer and use it in GitHub Desktop.
Save keepoff07/3ed6feb2ba2d93e56fdb to your computer and use it in GitHub Desktop.
[15w31a] ダメージ値によるアイテムのモデルの変更について

ダメージ値によるアイテムのモデルの変更について

基本記述例

{
    "parent": "item/handheld",
    "textures": {
        "layer0": "items/gold_axe"
    },
    "overrides": [
        { "predicate": { "damage": 0.0 }, "model": "item/diamond_sword" },
        { "predicate": { "damage": 0.25 }, "model": "item/wooden_sword" },
        { "predicate": { "damage": 0.5 }, "model": "item/golden_sword" },
        { "predicate": { "damage": 0.75 }, "model": "item/stone_sword" },
        { "predicate": { "damage": 1.0 }, "model": "item/iron_sword" }
    ]
}

反映結果

g
左からダメージ値
0(32/32) | 1(31/32) | 8(24/34) | 16(16/32) | 24(8/32) | 32(0/32)

注意点色々

  • "damage" にはダメージ値を指定するのではなく割合を指定する。
    • よって範囲は基本 0.0~1.0
    • 負の値も指定可能
  • "overrides" 内の並び順は影響あり。
    • 下に行くほど割合が高くなるように作るようにしましょう。
  • { "damage": 0.0 } を作らないでおくと、このモデルが適用されます。
    • 今回の場合は金の斧のテクスチャ("items/gold_axe")が反映されます。

その他

"predicate" 内に指定できるもの

一部特定のアイテムにのみ指定できるものです。

  • "pulling" : 弓を引いているか
  • "pull" : 弓弦の弾いている割合
    • bow.json
    "overrides": [
        { "predicate": { "pulling": 1 }, "model": "item/bow_pulling_0" },
        { "predicate": { "pulling": 1, "pull": 0.65 }, "model": "item/bow_pulling_1" },
        { "predicate": { "pulling": 1, "pull": 0.9 }, "model": "item/bow_pulling_2" }
    ]
  • "time" : ゲーム内時間の割合
    • clock.json
    "overrides": [
        { "predicate": { "time": 0.0000000 }, "model": "item/clock" },
        { "predicate": { "time": 0.0078125 }, "model": "item/clock_01" },
        { "predicate": { "time": 0.0234375 }, "model": "item/clock_02" },
        { "predicate": { "time": 0.0390625 }, "model": "item/clock_03" },
  • "angle" : 角度の割合
    • compass.json
    "overrides": [
        { "predicate": { "angle": 0.000000 }, "model": "item/compass" },
        { "predicate": { "angle": 0.015625 }, "model": "item/compass_17" },
        { "predicate": { "angle": 0.046875 }, "model": "item/compass_18" },
        { "predicate": { "angle": 0.078125 }, "model": "item/compass_19" },
  • "cast" : ウキを離しているか
    • fishing_rod.json
    "overrides": [
        { "predicate": { "cast": 1 }, "model": "item/fishing_rod_cast" }
    ]
  • "blocking" : ガードしているか
    • shield.json
    "overrides": [
        { "predicate": { "blocking": 1 }, "model": "item/shield_blocking" }
    ]

"display" に指定できるもの

  • "firstperson_righthand" : 一人称視点で右手持ちの時
  • "thirdperson_righthand" : 三人称視点で右手持ちの時
  • "firstperson_lefthand" : 一人称視点で左手持ちの時
  • "thirdperson_lefthand" : 三人称視点で左手持ちの時
  • "head" : 頭に装備した時
  • "gui" : インベントリ内
  • "ground" : 地面に落ちている時
  • "fixed" : 額縁に飾られている時
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment