補助用記事:「何が違うの!?そんなときのトラブルシューティング」

※この記事は「何が違うの!?そんなときのトラブルシューティング」の補助用記事です。

↓本記事
 質問したくなるかもしれない、と思った部分に補助を注釈程度に入れていきます。本記事に載せるまでもない、でもあったほうがいいかもしれない(なくてもいいかもしれない)内容がほとんどです。

■スペルチェッカーについて

 わたしはこれをいつも使っています。
 jsonをすべてコピペして「送信」を押せばOKです。ただし、本記事で紹介しているjsonチェッカーとは違い、オンラインでないと使えないので注意しましょう。
 このチェッカーでは、辞書にその単語が登録されているかどうかでスペルミス候補を挙げてくれます。本記事の下の方でも言っていますが、存在する単語で間違うと引っ掛かりません。そしてもちろん固有名詞である「minecraft」も当然引っ掛かります。このチェッカーはスペルミスを確実に見つける、というよりは見直す部分をしぼりこむという用途で使うのがベストでしょう。

■変更・追加の成功/失敗の判断

○エンティティ
 is_summonableとis_spawnableをtrueにしたうえで、/summonできるかどうか、スポーンエッグがクリエイティブインベントリに反映されているかどうか
 AI系コンポーネントに関しては動作しているかどうかはパッとわかりづらいものが多いですが、仕方ないと思ってください。
○ビヘイビアのアニメーションコントローラ・アニメーション
 エントリは動作の成功が分かりやすいものにしておきましょう。
○ブロック
 /setblockで配置できるか、/giveで入手できるか、クリエイティブインベントリに反映されているか etc.
○アイテム
 /giveで入手可能か、レシピで作成可能か、エンティティがドロップするか etc.
 リソースにミスがあって透明になってしまうことがあるので、そこも考慮しておきましょう。
○バイオーム・フィーチャー
 根気よく探すしかありません。そしてなるべくワールドは新しいものにするといいでしょう。ワールドデータをいじるならdbフォルダを消すだけでワールドを作り直さずにワールド生成をリセットできます。
○パーティクル
 成功しているかどうか分かりやすいテクスチャ・動き・大きさにしてください。
 コマンドで動かしてもし追加されてなくても「そのようなパーティクルは存在しません」とは言ってくれないことに注意しましょう。
○シェーダ
 いろんなものを見ましょう。ブロック、エンティティなどできるだけ多い種類のものを視界に入れましょう。

■”イベントのワナ”について

 jsonを見たほうが分かりやすいひとのために、いくつか省略はしますがjsonで書いておきます

アイテムAを持っている→イベントA→コンポーネントグループAを足す
アイテムBを持っている→イベントB→コンポーネントグループBを足す
アイテムCを持っている→イベントC→コンポーネントグループCを足す
アイテムDを持っている→イベントD→コンポーネントグループDを足す
アイテムA~D全て持っていない→イベントE→上記で足したコンポーネントグループを全て消す

{
  "format_version": "1.13.0",
  "minecraft:entity": {
    "components": {
      "minecraft:environment_sensor": {
        "triggers": [
          {
            "filters": {
              "all_of": [
                {
                  "test": "has_equipment",
                  "domain": "hand",
                  "value": "item:A"
                }
              ]
            },
            "event": "A"
          },
          {
            "filters": {
              "all_of": [
                {
                  "test": "has_equipment",
                  "domain": "hand",
                  "value": "item:B"
                }
              ]
            },
            "event": "B"
          },
          {
            "filters": {
              "all_of": [
                {
                  "test": "has_equipment",
                  "domain": "hand",
                  "value": "item:C"
                }
              ]
            },
            "event": "C"
          },
          {
            "filters": {
              "all_of": [
                {
                  "test": "has_equipment",
                  "domain": "hand",
                  "value": "item:D"
                }
              ]
            },
            "event": "D"
          },
          {
            "filters": {
              "all_of": [
                {
                  "test": "has_equipment",
                  "operator": "!=",
                  "domain": "hand",
                  "value": "item:A"
                },
                {
                  "test": "has_equipment",
                  "operator": "!=",
                  "domain": "hand",
                  "value": "item:B"
                },
                {
                  "test": "has_equipment",
                  "operator": "!=",
                  "domain": "hand",
                  "value": "item:C"
                },
                {
                  "test": "has_equipment",
                  "operator": "!=",
                  "domain": "hand",
                  "value": "item:D"
                }
              ]
            },
            "event": "E"
          }
        ]
      }
    },
    "events": {
      "A": {
        "add": {
          "component_groups": [ "A" ]
        }
      },
      "B": {
        "add": {
          "component_groups": [ "B" ]
        }
      },
      "C": {
        "add": {
          "component_groups": [ "C" ]
        }
      },
      "D": {
        "add": {
          "component_groups": [ "D" ]
        }
      },
      "E": {
        "remove": {
          "component_groups": [ "A", "B", "C", "D" ]
        }
      }
    },
    "component_groups": {
      "A": {},
      "B": {},
      "C": {},
      "D": {}
    }
  }
}

アイテムAを持っている→イベントA→コンポーネントグループAを足し、コンポーネントグループB,C,Dを消す
アイテムBを持っている→イベントB→コンポーネントグループBを足し、コンポーネントグループA,C,Dを消す
アイテムCを持っている→イベントC→コンポーネントグループCを足し、コンポーネントグループA,B,Dを消す
アイテムDを持っている→イベントD→コンポーネントグループDを足し、コンポーネントグループA,B,Cを消す
アイテムA~D全て持っていない→イベントE→上記で足したコンポーネントグループを全て消す

{
  "format_version": "1.13.0",
  "minecraft:entity": {
    "components": { (略) },
    "events": {
      "A": {
        "add": {
          "component_groups": [ "A" ]
        },
        "remove": {
          "component_groups": [ "B", "C", "D" ]
        }
      },
      "B": {
        "add": {
          "component_groups": [ "B" ]
        },
        "remove": {
          "component_groups": [ "A", "C", "D" ]
        }
      },
      "C": {
        "add": {
          "component_groups": [ "C" ]
        },
        "remove": {
          "component_groups": [ "A", "B", "D" ]
        }
      },
      "D": {
        "add": {
          "component_groups": [ "D" ]
        },
        "remove": {
          "component_groups": [ "A", "B", "C" ]
        }
      },
      "E": {
        "remove": {
          "component_groups": [ "A", "B", "C", "D" ]
        }
      }
    },
    "component_groups": { (略) }
  }
}

■”コンポーネントの裏仕様”について

 こちらもjsonを書いておきます

①スニーク検知をアニメーションコントローラで
[animation_controller]
{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.sneaking": {
      "states": {
        "default": {
          "transitions": [ { "sneaking": "query.is_sneaking" } ]
          "on_entry": [ "@s A" ]
        },
        "sneaking": {
          "transitions": [ { "default": "!query.is_sneaking" } ]
        }
      }
    }
  }
}
[entity]
{
  "format_version": "1.13.0",
  "description": {
    "scripts": {
      "animate": [ "sneaking" ]
    },
    "animations": {
      "sneaking": "controller.animation.sneaking"
    }
  },
  "minecraft:entity": {
    "components": {
      "minecraft:scheduler": {
        "scheduled_events": [
          {
            "filters": {
              "all_of": [
                { 
                  "test": "is_biome",
                  "value": "desert"
                }
              ]
            },
            "event": "B"
          }
        ]
      }
    },
    "events": {
      "A": {
        "add": {
          "component_groups": [ "A" ]
        }
      },
      "B": {
        "add": {
          "component_groups": [ "B" ]
        }
      }
    },
    "component_groups": {
      "A": {},
      "B": {}
    }
  }
}
②バイオーム検知をインバイロメントセンサーで
[entity]
{
  "format_version": "1.13.0",
  "description": {
    "scripts": {
      "animate": [ "in_desert" ]
    },
    "animations": {
      "in_desert": "controller.animation.in_desert"
    }
  },
  "minecraft:entity": {
    "components": {
      "minecraft:scheduler": {
        "scheduled_events": [
          {
            "filters": {
              "all_of": [ { "test": "is_sneaking" } ]
            },
            "event": "A"
          }
        ]
      },
      "minecraft:environment_sensor": {
        "triggers": [
          {
            "filters": {
              "all_of": [
                { 
                  "test": "is_biome",
                  "value": "desert"
                }
              ]
            },
            "event": "B"
          },
          {
            "filters": {
              "all_of": [
                { 
                  "test": "is_biome",
                  "operator": "!=",
                  "value": "desert"
                }
              ]
            },
            "event": "C"
          }
        ]
      }
    },
    "events": {
      "A": {
        "add": {
          "component_groups": [ "A" ]
        }
      },
      "B": {
        "add": {
          "component_groups": [ "B" ]
        },
        "remove": {
          "component_groups": [ "C" ]
        }
      },
      "C": {
        "add": {
          "component_groups": [ "C" ]
        },
        "remove": {
          "component_groups": [ "B" ]
        }
      },
      "D": {
        "add": {
          "component_groups": [ "D" ]
        }
      }
    },
    "component_groups": {
      "A": {},
      "B": {
        "minecraft:variant": {
          "value": 1
        }
      },
      "C": {
        "minecraft:variant": {
          "value": 0
        }
      }
    }
  }
}
[animation_controller]
{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.in_desert": {
      "states": {
        "default": {
          "transitions": [ { "in_desert": "query.variant == 1" } ]
        },
        "in_desert": {
          "transitions": [ { "default": "query.variant != 1" } ],
          "on_entry": [ "@s D" ]
        }
      }
    }
  }
}
③アニメーションコントローラを使わずに
{
  "format_version": "1.13.0",
  "minecraft:entity": {
    "components": {
      "minecraft:scheduer": {
        "scheduled_events": [
          {
            "filters": {
              "all_of": [ { "test": "is_sneaking" } ]
            },
            "event": "A"
          },
          {
            "filters": {
              "all_of": [
                { 
                  "test": "is_biome",
                  "value": "desert"
                }
              ]
            },
            "event": "B"
          }
        ]
      }
    },
    "events": {
      "A": {
        "add": {
          "component_groups": [ "A" ]
        }
      },
      "B": {
        "add": {
          "component_groups": [ "B" ]
        }
      },
      "C": {
        "remove": {
          "component_groups": [ "B" ]
        }
      }
    },
    "component_groups": {
      "A": {},
      "B": {
        "minecraft:scheduer": {
          "scheduled_events": [
            {
              "filters": {
                "all_of": [ { "test": "is_sneaking" } ]
              },
              "event": "A"
            }
          ]
        },
        "minecraft:environment_sensor": {
          "triggers": [
            {
              "filters": {
                "all_of": [
                  {
                    "test": "is_biome",
                    "operator": "!=",
                    "value": "desert"
                  }
                ]
              },
              "event": "C"
            }
          ]
        },
        //ここに砂漠へ進入したときの処理
      }
    }
  }
}
jsonを書いてて動作してくれる自信がなくなりました

 以上です。他に説明が足りない部分があればお知らせください。ここに書き足すと思います。

MinecraftBEアドオン-ヒント倉庫

MimecraftBEのアドオン作りで困ったときにここで解決できるようにと個人によって作られたものです

0コメント

  • 1000 / 1000