レイドバトルでその村にいる村人の数と出現モブを画面左に表示する。
計算負荷が大きいのでハイスペックPCでやることをお勧めする。
Java版ではもっと負荷の小さい方法でやることができる。
1. Countというオブジェクトを作成する
/scoreboard objectives add Count dummy
Countでなくても良い。任意の文字列。
2. 作成したオブジェクトCount内に村人やモブの表示名を設定し、その数を0にする。
Command block: Repeat / Unconditional / Needs redstone
/scoreboard players set villager Count 0
villagerは任意だが、村人の数を表示させたいので揃えた方が良い。
Command block: Chain / Conditional / Always active
/scoreboard players set pillager Count 0
Command block: Chain / Conditional / Always active
/scoreboard players set vindicator Count 0
Command block: Chain / Conditional / Always active
/scoreboard players set ravager Count 0
Command block: Chain / Conditional / Always active
/scoreboard players set witch Count 0
Command block: Chain / Conditional / Always active
/scoreboard players set evoker Count 0
3. 表示名にそのワールド(周囲)にいる該当entityの数を格納する
Command block: Chain / Conditional / Always active
/execute as @e[type=minecraft:villager] run scoreboard players add villager Count 1
Command block: Chain / Unconditional / Always active
/execute as @e[type=minecraft:pillager] run scoreboard players add pillager Count 1
Unconditionalになっていることに注意。Conditonalで村人が1人もいないと、次のブロックに指示が伝わなくなってしまうため。
Command block: Chain / Unconditional / Always active
/execute as @e[type=minecraft:vindicator] run scoreboard players add vindicator Count 1
Command block: Chain / Unconditional / Always active
/execute as @e[type=minecraft:ravager] run scoreboard players add ravager Count 1
Command block: Chain / Unconditional / Always active
/execute as @e[type=minecraft:witch] run scoreboard players add witch Count 1
Command block: Chain / Unconditional / Always active
/execute as @e[type=minecraft:evocation_illager
] run scoreboard players add evoker Count 1
Command block: Chain / Unconditional / Always active
/scoreboard objectives setdisplay sidebar Count