Uploaded:2023/01/01 Latest-Update:2023/01/01

アドオン作成 - スポーンルール

目次は右上の「≡」から!
機能

モブの自然スポーンに関する条件を設定します。

ファイルの場所

ビヘイビアのspawn_rulesフォルダにファイルを置きます。

ビヘイビア
  ┣ manifest.json
  ┣ pack_icon.png
  ┗ spawn_rules
    ┗〇〇.json
基本の構造

赤枠の部分を増やして条件を増やします。

{ "format_version": "1.8.0", "minecraft:spawn_rules": { "description": { "identifier": "ex:my_entity", "population_control": "monster" }, "conditions": [ ~#r{ %%%%%% // コンポーネント %%%%%%}r#~ ] } }

● identifier

スポーンルールを設定したいエンティティのID。

● population_control

スポーン数の方式。"animal"(動物)、"underwater_animal"(水棲生物)、 "monster"(モンスター)、"ambient"(環境動物)から選ぶ。

コンポーネント

● minecraft:weight

基本の構造の赤枠部分を増やしたときの、その条件が比較対象として選ばれる確率比。

たとえば条件1、2、3を設定していて、weightがそれぞれ1、4、5ならば、それぞれの条件が適用される確率は10%、40%、50%。 1、1、2なら25%、25%、50%。

{ "minecraft:weight": { "default": 100 } }

● minecraft:density_limit

スポーン数の上限。surfaceは地上、undergroundは地下。 設定しない場合は省略すればいい。

{ "minecraft:density_limit": { "underground": 5, "surface": 5 } }

● minecraft:spawns_on_block_filter

ここで指定したブロックの上にスポーンするようになる。複数指定可。

{ "minecraft:spawns_on_block_filter": [ "minecraft:grass" ] }

ここでネザーレンガ、プリズマリンブロック、石レンガなどを指定すれば、擬似的にネザー要塞、海底神殿、ダンジョンにスポーンさせることができるが、プレイヤーが置いたブロックの上にもスポーンするので厳密には不可能。

● minecraft:spawns_on_block_prevented_filter

ここで指定したブロックの上にはスポーンしないようになる。複数指定可。

{ "minecraft:spawns_on_block_prevented_filter": [ "minecraft:nether_wart_block", "minecraft:shroomlight" ] }

● minecraft:spawns_above_block_filter

{ "minecraft:spawns_above_block_filter": { "blocks": "minecraft:stone", "distance": 10 } }

● minecraft:herd

スポーンするときに複数体同時にスポーンする。

{ "minecraft:herd": { "min_size": 4, "max_size": 6, "event": "minecraft:entity_born", "event_skip_count": 2 } }

・event

スポーンしたときに発生させるイベント。

・複数のパターンとして書くことができる

{ "minecraft:herd": [ { "min_size": 2, "max_size": 6, "event": "event1" }, { "min_size": 2, "max_size": 6, "event": "event2" } ] }

● minecraft:permute_type

確率で別のモブがスポーンするようにする。
以下の例では95%でゾンビがスポーンし、5%で村人ゾンビ(別エンティティ)がスポーンする。

weightの単位は%ではないので注意。以下の例で19、1としても比が同じなので確率は変わらない。

{ "minecraft:permute_type": [ { "weight": 95 }, { "weight": 5, "entity_type": "minecraft:zombie_villager_v2" } ] }

● minecraft:brightness_filter

明るさの条件。

{ "minecraft:brightness_filter": { "min": 0, "max": 7, "adjust_for_weather": true } }

・adjust_for_weather

天気によって変わる明るさに影響されるかどうか。

● minecraft:height_filter

高度(y座標)の条件。

{ "minecraft:height_filter": { "min": -63, "max": 63 } }

● minecraft:spawns_on_surface

地表(日光が当たる場所)すべてにスポーンするようになる。

{ "minecraft:spawns_on_surface": {} }

● minecraft:spawns_underground

地下(日光が当たらない場所)すべてにスポーンするようになる。

{ "minecraft:spawns_underground": {} }

ネザーにスポーンさせる場合、このコンポーネントが必須(天井はすべて岩盤や地形で埋められているから)。

● minecraft:spawns_underwater

水中すべてにスポーンするようになる。

{ "minecraft:spawns_underwater": {} }

● minecraft:disallow_spawns_in_bubble

水中のマグマブロック、ソウルサンドによる気泡の中にスポーンしないようになる。

{ "minecraft:disallow_spawns_in_bubble": {} }

● minecraft:spawns_lava

マグマの表面(水面ならぬマグマ面)にスポーンする。

{ "minecraft:spawns_lava": {} }

● minecraft:biome_filter

バイオームの条件。エンティティフィルターと同じ記法でany_ofやall_ofも使える。

{ "minecraft:biome_filter": { "test": "has_biome_tag", "value": "plains" } }

● minecraft:difficulty_filter

難易度の条件。値はpeaceful(ピースフル)、easy(イージー)、 normal(ノーマル)、hard(ハード)。

{ "minecraft:difficulty_filter": { "min": "easy", "max": "hard" } }

● minecraft:distance_filter

プレイヤーからの距離の条件。

{ "minecraft:distance_filter": { "min": 12, "max": 32 } }

● minecraft:is_experimental

{ "minecraft:is_experimental": {} }

● minecraft:world_age_filter

ワールド内の経過時間の条件。数日過ごさないとスポーンしないなど。

{ "minecraft:world_age_filter": { "min": 6000 } }

● minecraft:delay_filter

{ "minecraft:delay_filter": { "min": 600, "max": 660, "identifier": "minecraft:pillager_patrol_easy", "spawn_chance": 20 } }

● minecraft:mob_event_filter

{ "minecraft:mob_event_filter": { "event": "minecraft:pillager_patrols_event" } }

● minecraft:is_persistent

{ "minecraft:is_persistent": {} }

● minecraft:player_in_village_filter

{ "minecraft:player_in_village_filter": { "distance": 48, "village_border_tolerance": 32 } }
具体例

動物

{ "format_version": "1.8.0", "minecraft:spawn_rules": { "description": { "identifier": "ex:ground_animal", "population_control": "animal" }, "conditions": [ { "minecraft:weight": { "default": 8 }, "minecraft:biome_filter": { "test": "has_biome_tag", "value": "animal" }, "minecraft:brightness_filter": { "min": 7, "max": 15, "adjust_for_weather": false }, "minecraft:herd": { "min_size": 2, "max_size": 3 }, "minecraft:spawns_on_surface": {}, "minecraft:spawns_on_block_filter": "minecraft:grass" } ] } }

モンスター

{ "format_version": "1.8.0", "minecraft:spawn_rules": { "description": { "identifier": "ex:ground_monster", "population_control": "monster" }, "conditions": [ { "minecraft:weight": { "default": 100 }, "minecraft:biome_filter": { "test": "has_biome_tag", "value": "monster" }, "minecraft:brightness_filter": { "min": 0, "max": 7, "adjust_for_weather": true }, "minecraft:density_limit": { "surface": 5 }, "minecraft:difficulty_filter": { "min": "easy", "max": "hard" }, "minecraft:spawns_on_surface": {}, "minecraft:spawns_underground": {} } ] } }
©2023 Rinca Hayamine