内科専門医 今日もマイクラ処方中

Minecraftの医学的有効性を検証中

MENU

エンティティJSONの編集: 攻撃性の編集 (day253)

3. 攻撃性の編集

必要なものは

minecraft:behavior.nearest_attackable_target

Entity Documentation - minecraft:behavior.nearest_attackable_target | Microsoft Docs

minecraft:behavior.melee_attack

Entity Documentation - minecraft:behavior.melee_attack | Microsoft Docs

 

下記がzombieのもの。適宜修正して使用。

   "minecraft:behavior.nearest_attackable_target": {
                "priority": 2,
                "must_see": true,
                "reselect_targets": true,
                "within_radius": 25.0,
                "must_see_forget_duration": 17.0,
                "entity_types": [
                  {
                    "filters": {
                      "any_of": [
                        { "test": "is_family", "subject": "other", "value": "player" },
                        { "test": "is_family", "subject": "other", "value": "snowgolem" },
                        { "test": "is_family", "subject": "other", "value": "irongolem" }
                      ]
                    },
                    "max_dist": 35
                  },
                  {
                    "filters": {
                      "any_of": [
                        { "test": "is_family", "subject": "other", "value": "villager" },
                        { "test": "is_family", "subject": "other", "value": "wandering_trader" }
                      ]
                    },
                    "max_dist": 35,
                    "must_see": false
                  },
                  {
                    "filters": {
                      "all_of": [
                        { "test": "is_family", "subject": "other", "value": "baby_turtle" },
                        { "test": "in_water", "subject": "other", "operator": "!=", "value": true }
                      ]
                    },
                    "max_dist": 35
                  }
                ]
              },
            "minecraft:behavior.melee_attack": {
                "priority": 3
            },
            "minecraft:attack": {
                "damage": 3
            }

エンティティJSONの編集: Introduction (day251)

mobの挙動を変えるためにに、エンティティJSONの書き方を勉強していく。

Entity JSON Documentation | Microsoft Docs

1. Introduction

Entity Documentation - Entity JSON Introduction | Microsoft Docs

 

ブタのJSONでお勉強。このJSONは学習用に大分簡略化されている。

 

"format_version": "1.8.0",
  "minecraft:client_entity": {
     "description": {
       "identifier": "minecraft:pig",
       "min_engine_version": "1.8.0",
       "materials": { "default": "pig" },
       "textures": {
         "default": "textures/entity/pig/pig",
         "saddled": "textures/entity/pig/pig_saddle"
       },
       "geometry": {
         "default": "geometry.pig.v1.8"
       },
       "animations": {
         "setup": "animation.pig.setup",
         "walk": "animation.quadruped.walk",
         "look_at_target": "animation.common.look_at_target",
         "baby_transform": "animation.pig.baby_transform"
       },
       "animation_controllers": [
         { "setup": "controller.animation.pig.setup" },
         { "move": "controller.animation.pig.move" },
         { "baby": "controller.animation.pig.baby" }
       ],
       "render_controllers": [ "controller.render.pig" ],
       "locators": {
         "lead": { "head": [ 0.0, 14.0, -6.0 ] }
       },
       "spawn_egg": {
         "texture": "spawn_egg",
         "texture_index": 2
       }
     }
   }

 

1.1. identifier

ここで編集するentityを指定する。

1.2. Min_engine_version

おそらくworkする最も古いversionを指定する箇所。

1.3. Materials, Textures, Animations

名前を指定する。その名前はRender Controllers JSONで使用される。vanillaリソースパックか、自分で作ったものを使用可能。

1.4. Animation_controllers

どのアニメーションを使用するか指定する。

vanillaリソースパックか、自分で作ったものを使用可能。 

1.5. Render_controllers

Render Controllers folderにある名前と一致させる。vanillaリソースパックか、自分で作ったものを使用可能。 

1.6. locators

例えば、リードが体のどの位置につくかを指定する。

1.7. enable_attachables

鎧や武器を持てるようになる?

"enable_attachables": true

1.8. held_item_ignores_lighting

持っているものが光るかどうか。

"held_item_ignores_lighting": true

1.9. hide_armor

鎧を着ている時にそれを見えなくする。

enable_attachablesを上書きする。

1.10. Spawn Egg

色やテキスチャーを指定する。

 

"spawn_egg": {
  "base_color": "#53443E",
  "overlay_color": "#2E6854"
}

 

"spawn_egg": {
  "texture": "spawn_egg",
  "texture_index": 2
}

 

 

 

 

 

 

 

エンティティJSONの編集 (day250)

mobの挙動を変えるためにに、エンティティJSONの書き方を勉強していく。

Entity JSON Documentation | Microsoft Docs

1. Introduction

Entity Documentation - Entity JSON Introduction | Microsoft Docs

 

ブタのJSONでお勉強。このJSONは学習用に大分簡略化されている。

 

"format_version": "1.8.0",
  "minecraft:client_entity": {
     "description": {
       "identifier": "minecraft:pig",
       "min_engine_version": "1.8.0",
       "materials": { "default": "pig" },
       "textures": {
         "default": "textures/entity/pig/pig",
         "saddled": "textures/entity/pig/pig_saddle"
       },
       "geometry": {
         "default": "geometry.pig.v1.8"
       },
       "animations": {
         "setup": "animation.pig.setup",
         "walk": "animation.quadruped.walk",
         "look_at_target": "animation.common.look_at_target",
         "baby_transform": "animation.pig.baby_transform"
       },
       "animation_controllers": [
         { "setup": "controller.animation.pig.setup" },
         { "move": "controller.animation.pig.move" },
         { "baby": "controller.animation.pig.baby" }
       ],
       "render_controllers": [ "controller.render.pig" ],
       "locators": {
         "lead": { "head": [ 0.0, 14.0, -6.0 ] }
       },
       "spawn_egg": {
         "texture": "spawn_egg",
         "texture_index": 2
       }
     }
   }

 

1.1. identifier

ここで編集するentityを指定する。

1.2. Min_engine_version

おそらくworkする最も古いversionを指定する箇所。

1.3. Materials, Textures, Animations

名前を指定する。その名前はRender Controllers JSONで使用される。vanillaリソースパックか、自分で作ったものを使用可能。

1.4. Animation_controllers

どのアニメーションを使用するか指定する。

vanillaリソースパックか、自分で作ったものを使用可能。 

1.5. Render_controllers

Render Controllers folderにある名前と一致させる。vanillaリソースパックか、自分で作ったものを使用可能。 

1.6. locators

例えば、リードが体のどの位置につくかを指定する。

1.7. enable_attachables

鎧や武器を持てるようになる?

"enable_attachables": true

1.8. held_item_ignores_lighting

持っているものが光るかどうか。

"held_item_ignores_lighting": true

1.9. hide_armor

鎧を着ている時にそれを見えなくする。

enable_attachablesを上書きする。

1.10. Spawn Egg

色やテキスチャーを指定する。

 

"spawn_egg": {
  "base_color": "#53443E",
  "overlay_color": "#2E6854"
}

 

"spawn_egg": {
  "texture": "spawn_egg",
  "texture_index": 2
}

 

2. Entityのpropertiesを編集する。

Entity Documentation - Properties List | Microsoft Docs

 

3. 攻撃性の編集

必要なものは

minecraft:behavior.nearest_attackable_target

Entity Documentation - minecraft:behavior.nearest_attackable_target | Microsoft Docs

minecraft:behavior.melee_attack

Entity Documentation - minecraft:behavior.melee_attack | Microsoft Docs

 

下記がzombieのもの。適宜修正して使用。

   "minecraft:behavior.nearest_attackable_target": {
                "priority": 2,
                "must_see": true,
                "reselect_targets": true,
                "within_radius": 25.0,
                "must_see_forget_duration": 17.0,
                "entity_types": [
                  {
                    "filters": {
                      "any_of": [
                        { "test": "is_family", "subject": "other", "value": "player" },
                        { "test": "is_family", "subject": "other", "value": "snowgolem" },
                        { "test": "is_family", "subject": "other", "value": "irongolem" }
                      ]
                    },
                    "max_dist": 35
                  },
                  {
                    "filters": {
                      "any_of": [
                        { "test": "is_family", "subject": "other", "value": "villager" },
                        { "test": "is_family", "subject": "other", "value": "wandering_trader" }
                      ]
                    },
                    "max_dist": 35,
                    "must_see": false
                  },
                  {
                    "filters": {
                      "all_of": [
                        { "test": "is_family", "subject": "other", "value": "baby_turtle" },
                        { "test": "in_water", "subject": "other", "operator": "!=", "value": true }
                      ]
                    },
                    "max_dist": 35
                  }
                ]
              },
            "minecraft:behavior.melee_attack": {
                "priority": 3
            },
            "minecraft:attack": {
                "damage": 3
            }

 

4. Componentsの編集

リスト

Entity Documentation - Component List | Microsoft Docs

4.1. 燃えないゾンビを作る

minecraft:burns_in_daylight

をfalse、もしくは該当部分を消す。

 

4.2. ゾンビを飼い馴らす 

minecraft:tameable

Entity Documentation - minecraft:tameable | Microsoft Docs

を用いる。

component groupsの作成

            "minecraft:zombie_wild": {
              "minecraft:tameable": {
                 "probability": 0.33,
                 "tame_items": "rotten_flesh",
                 "tame_event": {
                   "event": "minecraft:on_tame",
                   "target": "self"
                    }
                  }
            },

            "minecraft:zombie_tame": {
              "minecraft:is_tamed": {
              },
              "minecraft:health": {
                       "value": 20,
                       "max": 20
              },
              "minecraft:behavior.follow_owner": {
                       "priority": 4,
                       "speed_multiplier": 1.0,
                       "start_distance": 10,
                       "stop_distance": 2
              },
              "minecraft:attack": {
                       "damage": 4
              },
              "minecraft:behavior.owner_hurt_by_target": {
                       "priority": 1
              },
              "minecraft:behavior.owner_hurt_target": {
                       "priority": 2
              },
              "minecraft:behavior.nearest_attackable_target": {
                       "priority": 3,
                       "must_see": true,
                       "entity_types": [
                         {
                          "filters": {
                            "all_of": [
                              {
                                "test": "is_family",
                                "subject": "other",
                                "value": "monster"
                              }
                            ]
                          },
                          "max_dist": 16
                         }
                       ]
 

eventに追加

        "minecraft:on_tame": {
          "remove": {
            "component_groups": [
              "minecraft:zombie_wild"
            ]
          },
          "add": {
            "component_groups": [
              "minecraft:zombie_tame"
            ]
          }
        }

 

4.3. モブの体力を回復させる

minecraft:healableを使う。

        "minecraft:healable": {
            "items": [
              {
                "item": "iron_ingot",
                "heal_amount": 5
              },
              {
                "item": "iron_block",
                "heal_amount": 2
              }
            ]
        }

 

4.4. アイアンゴーレムに乗れるようにする

minecraft:ridableを使う。

https://docs.microsoft.com/en-us/minecraft/creator/reference/content/entityreference/examples/entitycomponents/minecraftcomponent_rideable

両肩に2人乗ることが可能。

            "minecraft:rideable": {
              "seat_count": 2,
              "family_types": [],
              "seats": [{
                "position": [ 0.5, 1.8, 0 ],
                "lock_rider_rotation": 0
              },
              {
              "position": [ -0.5, 1.8, 0 ],
              "lock_rider_rotation": 0
              }
              ]
            }

 

4.5.プレイヤーにダメージを受けると、飼いならされた状態からwildに戻る

on_hurt_by_playerを用いる。

        "minecraft:on_hurt_by_player": {
          "event": "minecraft:on_hurt_event",
          "target": "self"
        }  
        },

 

 

        "minecraft:on_hurt_event": {
          "remove": {
            "component_groups": [
            "minecraft:golem_tame"
            ]
          },
          "add": {
            "component_groups": [
              "golem_wild"
            ]
         }
         }

 

 

 

 

 

 

最強恐竜決定戦!A~Cブロック【まったり実況】【親子でマイクラ】【恐竜MOD】(day249)

Jurassic World Rebornで最強恐竜決定戦をします!
まずはAからCまでの恐竜25匹のトーナメントだ。
はたして最強恐竜は。。。?

www.youtube.com

イントロダクション(0:00)
1.競技場を紹介! (0:30)
2.トーナメント説明(7:00)
3.A~Cブロック対戦開始!(7:35)
エンディング(11:38)

Introduction(0:00)
1.Introducing Battle Field! (0:30)
2.About Tournament(7:00)
3.Who is the winner of A~C Blocks Tournament? (7:35)
Ending(11:38)

 

Jurassic World Rebornについてはこちらをご覧ください。

drflourishing.hatenablog.com

マイクはこちら↓

マイクを固定するなら↓

ビヘイビアーパックの作成 (day248)

4. ビヘイビアーパックの作成

エンティティの行動、戦利品ドロップ、スポーン ルール、アイテム、レシピ、トレード テーブルなどの追加

ビヘイビアー パックの概要 | Microsoft Docs

4.1.ビヘイビアーパックのフォルダを作る。

C:\user\(ユーザ名)\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\development_behavior_packs

にMy_BEHAVIOR_Packという名前のフォルダを作る(名前は任意。これから作るリソースパックの名前を付ける)

 

4.2. manifest.jsonの作成

My_BEHAVIOR_Packにmanifest.jsonを作成

以下を入力。

{
  "format_version": 2,
  "header": {
    "description": "My attack cow behavior pack Add-On!",
    "name": "My Behavior Pack",
    "uuid":"uuid1",
    "version": [1, 0, 0],
    "min_engine_version": [1, 16, 0]
  },
  "modules":
    [
      {
        "description": "My First Add-On!",
          "type": "data",
          "uuid": "",
          "version": [1, 0, 0]
      }
    ],
  "dependencies": [
    {
     "uuid":"uuid2",
      "version":[1,0,0]
    }
 ]
}

uuid1は任意のuuid

uuid2はresource packのmanifest.jsonのheaderと同一のuuid(連結させる場合)

 

4.3. 内容の作成

4.3.1. entity

ここでは敵対するcowを作る。

まずフォルダーentitiesを作る。

My_BEHAVIOR_Pack-entities-entities-cow.json

以下のcodeを貼る。
ビヘイビアー パックの概要 | Microsoft Docs
より。
{ "format_version": "1.16.0", "minecraft:entity": { "description": { "identifier": "minecraft:cow", "is_spawnable": true, "is_summonable": true, "is_experimental": false }, "component_groups": { "minecraft:cow_baby": { "minecraft:is_baby": {}, "minecraft:scale": { "value": 0.5 }, "minecraft:ageable": { "duration": 1200, "feed_items": "wheat", "grow_up": { "event": "minecraft:ageable_grow_up", "target": "self" } }, "minecraft:behavior.follow_parent": { "priority": 6, "speed_multiplier": 1.1 } }, "minecraft:cow_adult": { "minecraft:experience_reward": { "on_bred": "Math.Random(1,7)", "on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0" }, "minecraft:loot": { "table": "loot_tables/entities/cow.json" }, "minecraft:behavior.breed": { "priority": 3, "speed_multiplier": 1.0 }, "minecraft:breedable": { "require_tame": false, "breed_items": "wheat", "breeds_with": { "mate_type": "minecraft:cow", "baby_type": "minecraft:cow", "breed_event": { "event": "minecraft:entity_born", "target": "baby" } } }, "minecraft:interact": { "interactions": [ { "on_interact": { "filters": { "all_of": [ { "test": "is_family", "subject": "other", "value": "player" }, { "test": "has_equipment", "domain": "hand", "subject": "other", "value": "bucket:0" } ] } }, "use_item": true, "transform_to_item": "bucket:1", "play_sounds": "milk", "interact_text": "action.interact.milk" } ] } } }, "components": { "minecraft:is_hidden_when_invisible": {}, "minecraft:type_family": { "family": [ "cow", "mob" ] }, "minecraft:breathable": { "total_supply": 15, "suffocate_time": 0 }, "minecraft:navigation.walk": { "can_path_over_water": true, "avoid_water": true, "avoid_damage_blocks": true }, "minecraft:movement.basic": {}, "minecraft:jump.static": {}, "minecraft:can_climb": {}, "minecraft:collision_box": { "width": 0.9, "height": 1.3 }, "minecraft:nameable": {}, "minecraft:health": { "value": 10, "max": 10 }, "minecraft:hurt_on_condition": { "damage_conditions": [ { "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true }, "cause": "lava", "damage_per_tick": 4 } ] }, "minecraft:movement": { "value": 0.25 }, "minecraft:despawn": { "despawn_from_distance": {} }, "minecraft:behavior.float": { "priority": 0 }, "minecraft:behavior.panic": { "priority": 1, "speed_multiplier": 1.25 }, "minecraft:behavior.mount_pathing": { "priority": 2, "speed_multiplier": 1.5, "target_dist": 0.0, "track_target": true }, "minecraft:behavior.breed": { "priority": 3, "speed_multiplier": 1.0 }, "minecraft:behavior.tempt": { "priority": 4, "speed_multiplier": 1.25, "items": [ "wheat" ] }, "minecraft:behavior.follow_parent": { "priority": 5, "speed_multiplier": 1.1 }, "minecraft:behavior.random_stroll": { "priority": 6, "speed_multiplier": 0.8 }, "minecraft:behavior.look_at_player": { "priority": 7, "look_distance": 6.0, "probability": 0.02 }, "minecraft:behavior.random_look_around": { "priority": 9 }, "minecraft:leashable": { "soft_distance": 4.0, "hard_distance": 6.0, "max_distance": 10.0 }, "minecraft:balloonable": {}, "minecraft:rideable": { "seat_count": 1, "family_types": [ "zombie" ], "seats": { "position": [ 0.0, 1.105, 0.0 ] } }, "minecraft:physics": {}, "minecraft:pushable": { "is_pushable": true, "is_pushable_by_piston": true }, "minecraft:conditional_bandwidth_optimization": {}, "minecraft:behavior.nearest_attackable_target": { "priority": 2, "must_see": true, "reselect_targets": true, "within_radius": 25.0, "entity_types": [ { "filters": { "test": "is_family", "subject": "other", "value": "player" }, "max_dist": 32 } ] }, "minecraft:behavior.melee_attack": { "priority": 3 }, "minecraft:attack": { "damage": 3 } }, "events": { "minecraft:entity_spawned": { "randomize": [ { "weight": 95, "trigger": "minecraft:spawn_adult" }, { "weight": 5, "add": { "component_groups": [ "minecraft:cow_baby" ] } } ] }, "minecraft:entity_born": { "add": { "component_groups": [ "minecraft:cow_baby" ] } }, "minecraft:entity_transformed": { "remove": {}, "add": { "component_groups": [ "minecraft:cow_adult" ] } }, "minecraft:ageable_grow_up": { "remove": { "component_groups": [ "minecraft:cow_baby" ] }, "add": { "component_groups": [ "minecraft:cow_adult" ] } }, "minecraft:spawn_adult": { "add": { "component_groups": [ "minecraft:cow_adult" ] } } } } }

 

牛の動きに非常に多くの設定があることがわかる。

 

4.4. ビヘイビアーパックをワールドに導入する。

ワールドを選びEdit

アドオンのビヘイビアーパックから作成したものを選びactivate

 

 

 

下記に追加

drflourishing.hatenablog.com