こんにちは。たつひこです。
前にエソティティ共通NBTについてまとめました。
今回はその行商人固有バージョンです。
他のMobはなんとなくでまとめていましたが、今回の行商人はエンティティの移動などでとても便利なNBTを持っているので、少し細かく紹介したいと思います。
目次
テンプレート
この記事ではNBTを
NBT [属性]
の形で表示します。
属性には byte|double|float|int|long|short の種類があり、[execute store (result|success) entity] を使用する最のpathの後の記述です。
data modifyを使用する際は気にする必要はありません。
また、String|List|Byte Array|Int Array|Long Array|Compound|Boolean は上記の値を記述する形です。各NBTごとに例として表示しているので覚える必要は基本的にありません。
[execute store] の詳細は別の記事にまとめたいと思います。
また、属性についでも別記事で細かくまとめるつもりです。
DespawnDelay [Int]
行商人がデスポーンするまでのtick数を制御します。
tick単位なので20/秒となります。
0に設定すると行商人はデスポーンしなくなります。
{DespawnDelay:1}
WanderTarget [List]
行商人が移動する場所。向かう場所を制御します。
一度変更するとその場所に移動するまで継続します。
ここにエンティティの座標を導入するなどで、Mobを特定の座標に動かすことが容易にできるようになります。
{WanderTarget:{X:0,Y:60,Z:10}}
エンティティの座標はPosで管理されています。つまり、下のようにWanderTargetにPosを代入することで特定の座標に向かわせることができます。
(もっとも近くの行商人をもっとも近くのアーマースタンドの座標へ向かわせるコマンド)
data modify entity @e[sort=nearest,limit=1,type=minecraft:wandering_trader] WanderTarget.X set from entity @e[sort=nearest,limit=1,type=minecraft:armor_stand] Pos[0]
data modify entity @e[sort=nearest,limit=1,type=minecraft:wandering_trader] WanderTarget.Y set from entity @e[sort=nearest,limit=1,type=minecraft:armor_stand] Pos[1]
data modify entity @e[sort=nearest,limit=1,type=minecraft:wandering_trader] WanderTarget.Z set from entity @e[sort=nearest,limit=1,type=minecraft:armor_stand] Pos[2]
Offers [Compound]
行商人の交換するアイテムを設定できます。
{Offers:{Recipes:[{buy:{id:”minecraft:iron_axe”,Count:3b},buyB:{id:”minecraft:emerald”,Count:1b},sell:{id:”minecraft:diamond”,Count:1b}}]}}
Recipes [List]
行商人の交換するアイテムを設定できます。
List表記で、左に記述したアイテムが上に表示されます。
{Offers:{Recipes:[{buy:{id:”minecraft:iron_axe”,Count:3b},buyB:{id:”minecraft:emerald”,Count:1b},sell:{id:”minecraft:diamond”,Count:1b}}]}}
buy [Compound]
購入するときに使用するアイテムです。
{Offers:{Recipes:[{buy:{id:”minecraft:iron_axe”,Count:3b},buyB:{id:”minecraft:emerald”,Count:1b},sell:{id:”minecraft:diamond”,Count:1b}}]}}
buyB [Compound]
購入するときに二つ目に使用するアイテムです。
記述しない場合もあります。
{Offers:{Recipes:[{buy:{id:”minecraft:iron_axe”,Count:3b},buyB:{id:”minecraft:emerald”,Count:1b},sell:{id:”minecraft:diamond”,Count:1b}}]}}
sell [Compound]
購入するアイテムです。
{Offers:{Recipes:[{buy:{id:”minecraft:iron_axe”,Count:3b},buyB:{id:”minecraft:emerald”,Count:1b},sell:{id:”minecraft:diamond”,Count:1b}}]}}
#記述環境は v.1.15.2です。
コメント