改訂版、地味に役立つニッチなコマンド百景【マインクラフト】

スポンサーリンク

ようこそお越しくださいました。ししゃもだよ。

(・∀・)ノ

前に備忘用にコマンドの羅列記事を書いたら、妙に見られてるので整理して残しておきます。量的にも倍になってます。中にはもう動かないのもあるかもしれないけど、基本は変わらないのでちょっと弄れば動くはずです。

全く動かんねぇよ!!フ〇ック!!

って時は質問してください。可能な限り答えを模索します。

1.17以降の修正点、/replaceitem がなくなるみたいです
/item replace になるみたいです。

タイトル関係

#アナウンスとワープ
tell @p ○○へテレポートしますtitle @p subtitle {“text”:”\u3077\u3063\u3053\u6751\u897f\u90e8″}title @p title {“text”:”\u30ea\u30be\u30fc\u30c8\u533a”}

#データパック記事のtitleサムネ撮影用 title
title SisyamoNeko subtitle {“text”:”No more MAGMADIVE!”, “italic”:true, “color”:”red”}title SisyamoNeko title {“text”:”ABM”, “bold”:true, “italic”:true, “color”:”gold”}

execute で色々する

#nbtのTagsを持ったアイテムのデータ取得とtpについて
#nbtにタグを持たせることで、tpの対象に選択可能

give @s potion{Itemname:Bottle,Tags:[bottle]}data get entity @e[nbt={Item:{tag:{Tags:[bottle]}}},limit=1]
execute at @e[tag=aaa] run tp @e[tag=aaa] @e[nbt={Item:{tag:{Tags:[bottle]}}},distance=..4,limit=1,sort=nearest]


#プレイヤーのscoreboard から値を取得して代入 プレイヤーの水平方向のみ取得してアマスタに持たせる
execute store result score @a[tag=aaa] direction run data get entity @a[tag=aaa] Rotation[0] 1
execute as @e[type=armor_stand] store result entity @s Rotation[0] float 1 run scoreboard players get @s direction
execute at @e[type=minecraft:armor_stand,tag=Direction] run tp @e[type=minecraft:armor_stand,tag=Direction] ^ ^ ^3


#※同一tick内で続く処理が必要な場合、tpで動かさないと向きが反映されない。詰まり易いので注意!!

#ドロッパーの疑似作業台で、tag持ち等の諸条件でアイテムを判定
execute as @e[tag=aaa] at @s if block ~ ~-0.5 ~ minecraft:dropper{Items:[{Slot:4b,id:”minecraft:book”,tag:{Tags:[aaa],ItemName:Cannon},Count:1b}]} run function spells:tool/give_gbook
execute as @e[tag=aaa] at @s if block ~ ~-0.5 ~ minecraft:dropper{Items:[{Slot:5b,id:”minecraft:splash_potion”,tag:{ItemName:”Bottled_Golem”},Count:1b}]} run function spells:tool/give_gbook


#ドロッパーの中身で give
execute at @a if block ~ ~-0.5 ~ minecraft:dropper{Items:[{Slot:3b,id:”minecraft:iron_block”,tag:{Tags:[iron]},Count:1b}]} run give @p minecraft:carrot_on_a_stick

#落ちてる虫取りビンの周囲2マスにハチがいたら小麦のタネをシュポーンと召喚
execute as @e[type=minecraft:item,nbt={Item:{id:”minecraft:glass_bottle”}}] if entity @e[type=minecraft:bee,distance=..2] at @s run summon minecraft:item ~ ~ ~ {Motion:[0.0,0.5,0.0],Item:{id:”minecraft:wheat_seeds”,Count:1b}}

#特定のエンティティと同じ方を向いているものとして
setblockexecute rotated as @e[type=minecraft:bee,limit=1,sort=nearest] run setblock ^ ^ ^3 minecraft:farmland

#タグ付き北向きプレイヤーの取得とsetコマンド(※180以上も使える)
execute as @a[y_rotation=157.5..202.5,tag=aaa] run setblock ^ ^ ^3 minecraft:acacia_log

#matchesを使った構文#真南向きを検出
execute as @a[tag=aaa] unless score @s GHoeDirection matches -338..-23 run summon etc…

#「Magical_Pot」タグの付いたエンティティの下がドロッパーで、スロットの真ん中(4b)とその上(1b)に植木鉢、バラの低木が各一個入ってたら頭上に村人召喚。ドロッパー内削除
execute as @e[tag=Magical_Pot] at @s if block ~ ~-0.5 ~ minecraft:dropper{Items:[{Slot:1b,id:”minecraft:rose_bush”,Count:1b},{Slot:4b,id:”minecraft:flower_pot”,Count:1b}]} run summon minecraft:villager ~ ~3 ~
execute as @e[tag=Magical_Pot] at @s if block ~ ~-0.5 ~ minecraft:dropper{Items:[{Slot:1b,id:”minecraft:rose_bush”,Count:1b},{Slot:4b,id:”minecraft:flower_pot”,Count:1b}]} run data merge block ~ ~-1 ~ {Items:{}}


#花火の向きに関するnbtは変えられるが、反映はされないよ。
execute if entity @e[type=minecraft:firework_rocket] run scoreboard players add @e[type=minecraft:firework_rocket] direction 5
execute store result entity @e[type=minecraft:firework_rocket,limit=1,sort=nearest] Rotation[0] float 1 as @e[type=minecraft:firework_rocket] run scoreboard players get @e[type=minecraft:firework_rocket,limit=1,sort=nearest] direction
execute store result entity @e[type=minecraft:firework_rocket,limit=1,sort=nearest] Rotation[1] float 1 as @e[type=minecraft:firework_rocket] run scoreboard players get @e[type=minecraft:firework_rocket,limit=1,sort=nearest] direction
execute as @e[type=minecraft:firework_rocket] run data merge entity @e[type=minecraft:firework_rocket,limit=1] {Rotation:[90f,0f],Motion:[1.0,0.0,0.0]}
execute as @e[type=minecraft:firework_rocket] run tp @s ^ ^ ^

summon 関連

#動かないおっさん、レティクル向けると場所(名前)表示 (南向き)
summon minecraft:villager ~ ~ ~ {Silent:1,NoAI:1,Rotation:[0.0f,0.0f],CustomName:”\”○○へ\””}

#でっかいたき火
summon minecraft:armor_stand ~ ~ ~ {Invulnerable:1,Invisible:1,NoGravity:1,Fire:999999,Passengers:[{id:Fireball}]}

#ようこそ的な恰好のアマスタ
summon armor_stand ~ ~ ~ {Invulnerable:1b,NoBasePlate:1b,ShowArms:1b,Rotation:[20f],CustomName:”{\”text\”:\”mincrafterししゃも\”}”,CustomNameVisible:1b,Pose:{Body:[0f,6f,0f],Head:[345f,18f,0f],LeftLeg:[6f,0f,0f],RightLeg:[351f,0f,0f],LeftArm:[334f,0f,340f],RightArm:[215f,0f,340f]}}

#頭になんか被せたアマスタ
summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:”minecraft:stonecutter”,Count:1b}]}

#花火を水平に飛ばすためのアマスタ
summon armor_stand ~ ~ ~ {ShowArms:1b,ArmorItems:[{},{},{},{id:”minecraft:firework_rocket”,Count:1b}],HandItems:[{id:”minecraft:firework_rocket”,Count:1b},{id:”minecraft:firework_rocket”,Count:1b}],Pose:{Head:[90f,0f,90f],LeftArm:[0f,0f,169f],RightArm:[0f,0f,328f]}}

#プレイヤーのメインハンドアイテムを形状変化させたいときは replace しかない data merge , execute store result は現在使えないっぽい
execute as @a[tag=Hold_PC_X] run replaceitem entity @s weapon.mainhand minecraft:carrot_on_a_stick{CustomModelData:3,display:{Name:'{“text”:”プラズマカッター”,”color”:”aqua”,”italic”:false}’,Lore:[‘{“text”:” “}’,'{“text”:”凶悪な地球外生命体とも”,”color”:”white”,”italic”:false}’,'{“text”:”互角以上に戦える工具”,”color”:”white”,”italic”:false}’,'{“text”:””,”color”:”white”,”italic”:false}’]},ItemName:Plasma_Cutter_Y}
execute as @a[tag=Hold_PC_Y] run replaceitem entity @s weapon.mainhand minecraft:carrot_on_a_stick{CustomModelData:2,display:{Name:'{“text”:”プラズマカッター”,”color”:”aqua”,”italic”:false}’,Lore:[‘{“text”:” “}’,'{“text”:”凶悪な地球外生命体とも”,”color”:”white”,”italic”:false}’,'{“text”:”互角以上に戦える工具”,”color”:”white”,”italic”:false}’,'{“text”:””,”color”:”white”,”italic”:false}’]},ItemName:Plasma_Cutter_X}

#replaceitem は 1.17 で無くなるっぽいので注意!!

#データパックでアマスタ使った乗り物とか
summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,ArmorItems:[{},{},{},{id:”minecraft:stick”,Count:1b,tag:{CustomModelData:100}}]}give @s minecraft:stick{ItemName:Helicopter}

#drillタグの付いた南向き、重力無視のアーマースタンド
summon minecraft:armor_stand ^ ^ ^3 {Invisible:1,NoGravity:1,Rotation:[0f,0f],Tags:[drill]}

#NoAIなハチを頭上に召喚、目の前にバラをドロップ(召喚)させる
summon minecraft:bee ^ ^3 ^ {NoAI:1,CustomName:”{\”text\”:\”My Bee\”}”,Tags:[My_Bee]}
execute as @e[tag=My_Bee] run summon item ^ ^ ^2 {Item:{id:”minecraft:rose_bush”,Count:1b}}


Passengers:[{id:zombie}]でゾンビが乗った状態 villager 等も可能

#nbtのTagsは複数可能
summon minecraft:armor_stand ~ ~ ~ {Tags:[aaa,bbb]}

data関連

#data merge exsample ブタに真上を向かせる
data merge entity @e[type=pig,limit=1,sort=nearest] {Rotation:[0f,-90f]}

#村人の取引スロット弄り
summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains}}data modify entity @e[type=villager,sort=nearest,limit=1] Offers.Recipes insert -3 value {buy:{id:”stone”,Count:1},sell:{id:”diamond_block”,Count:64},maxUses:1000}

#絵画変更
data merge entity @e[type=minecraft:painting,limit=1,sort=nearest] {Motive:”Kebab”}

#プレイヤーの乗ってるエンティティの情報ゲッツ
execute if entity @a[nbt={RootVehicle:{Entity:{}}}] run data get entity @s[] RootVehicle.Entity

.idでピンポイントでエンティティの取得も可能だよ

#プレイヤーのヘルス取得
data get entity @s Health

#nbt は remove で削除可能
data remove entity @e[type=#spells:hostiles,tag=Stolen,limit=1,sort=nearest] HandItems[0]

#data get を書くのがが毎度メンドイ
data get entity @e[type=minecraft:armor_stand,limit=1,sort=nearest]
data get entity @e[type=minecraft:item_frame,limit=1,sort=nearest]
data get entity @e[type=#spells:hostiles,limit=1,sort=nearest] HandItems[0]
data get entity @e[type=minecraft:chicken,limit=1,sort=nearest] EggLayTime
execute as @p run data get entity @e[type=minecraft:chicken,limit=1,sort=nearest] EggLayTime


#ホッパーのインベントリを動的に弄る!!
data get block ~ ~ ~ Items[{Slot:2b}].Countdata merge block ~ ~ ~ {Items:[{Slot:2b,id:”minecraft:redstone”,Count:1b,tag:{ItemName:aaa,display:{Name:'{“text”:”aaa”,”color”:”red”,”italic”:false}’}}}]}
execute store result block ~ ~ ~ Items[{Slot:2b}].Count int 1 run scoreboard players get @a[tag=Fire,limit=1,sort=nearest] MP

かなり雑多

#体力増強効果付与
effect give @a health_boost 999999 10 true

#No!!コマブロ出力
gamerule commandBlockOutput false

#チャットにdataとかの取得地が表示されない時!!
gamerule sendCommandFeedback true

#ボスバー基本
bossbar add spells:mp “MP”

# structure_block
setblock ~ ~ ~ minecraft:structure_block[mode=load]{posX:0,posY:0,posZ:0,showboundingbox:0b,name:”puu-structures-tail”}
setblock ~ ~ ~ minecraft:structure_block{metadata:””,mirror:”NONE”,ignoreEntities:0b,powered:1b,seed:0L,author:”SIsyamoNeko”,rotation:”NONE”,mode:”LOAD”,integrity:1.0f,showair:0b,posX:0,posY:0,posZ:0,showboundingbox:0b,name:”puu-structures-tail”}


give @p minecraft:carrot_on_a_stick{CustomModelData:4,display:{Name:'{“text”:”キャノン”,”color”:”aqua”,”italic”:false}’},ItemName:Cannon}

summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:armor_stand”,Count:1b,tag:{display:{Name:'{“text”:”aaa”}’,Lore:[‘{“text”:”bbb”}’]}}}}

scoreboard objectives setdisplay sidebar

kill @e[type=minecraft:armor_stand]

spell用

execute if entity @e[type=minecraft:chicken,nbt={EggLayTime:0}] as @e[type=minecraft:chicken,nbt={EggLayTime:0}] run data merge entity @s {EggLayTime:40}

datapack に組み込んだ関数関係

#位置ずれしにくい真・tp ついでにstorageを使う!!【使えんかった、演算ができん】
#いや、できんことはないが余計メンドイ

scoreboard players operation @s Xpt = @s Xexecute store result score @s X run data get entity @s Pos[0] 1000
scoreboard players operation @s Xpr = @s Xscoreboard players operation @s Xpr -= @s Xptscoreboard players operation @s Xpr *= 3 Constants
scoreboard players operation @s Xpr += @s Xexecute store result entity @e[…] Pos[0] double 0.001 run scoreboard players get @s Xpr
execute as @a[nbt={RootVehicle:{Entity:{Tags:[Heli_Seat]}}}] at @s run scoreboard players operation @s Xpt = @s X
execute as @a[nbt={RootVehicle:{Entity:{Tags:[Heli_Seat]}}}] store result score @s X run data get entity @s Pos[0] 1000
execute as @a[nbt={RootVehicle:{Entity:{Tags:[Heli_Seat]}}}] run scoreboard players operation @s Xpr = @s X
execute as @a[nbt={RootVehicle:{Entity:{Tags:[Heli_Seat]}}}] run scoreboard players operation @s Xpr -= @s Xptexecute as @a[nbt={RootVehicle:{Entity:{Tags:[Heli_Seat]}}}] run scoreboard players operation @s Xpr *= @s Constants
execute as @a[nbt={RootVehicle:{Entity:{Tags:[Heli_Seat]}}}] run scoreboard players operation @s Xpr += @s X
execute as @a[nbt={RootVehicle:{Entity:{Tags:[Heli_Seat]}}}] at @s run execute store result entity @e[type=minecraft:armor_stand,tag=Heli_Body,limit=1,sort=nearest] Pos[0] double 0.001 run scoreboard players get @s Xpr


#storage を使ってコマブロのcommandを取得、記録
data get block ~ ~-1 ~ Command
execute at @e[tag=Command_Looker] run data modify storage commands Commands append from block ~ ~-1 ~ Command


#storage を使ってインベントリ弄り 入れ替えと一時保管
data get entity @e[type=item,limit=1,sort=nearest] Itemdata get storage heli:rider Inventory

#ホットバー保管後入れ替え
execute at @e[tag=Heli_Seat] run data modify storage heli:rider Inventory set from entity @a[tag=Get_On,limit=1,sort=nearest] Inventory
replaceitem entity @a[tag=Get_On] hotbar.0 minecraft:stick{ItemName:Up}
replaceitem entity @a[tag=Get_On] hotbar.1 minecraft:stick{ItemName:Down} 
replaceitem entity @a[tag=Get_On] hotbar.2 minecraft:air
replaceitem entity @a[tag=Get_On] hotbar.3 minecraft:air
replaceitem entity @a[tag=Get_On] hotbar.4 minecraft:air
replaceitem entity @a[tag=Get_On] hotbar.5 minecraft:air
replaceitem entity @a[tag=Get_On] hotbar.6 minecraft:air
replaceitem entity @a[tag=Get_On] hotbar.7 minecraft:air
replaceitem entity @a[tag=Get_On] hotbar.8 minecraft:air
tag @a[tag=Get_On] add Ride_Helitag @a[tag=Get_On] remove Get_On


#入れ替えたホットバーを元に戻すexecute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,0]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,0]}}}] Item set from storage heli:rider Inventory[{Slot:0b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,1]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,1]}}}] Item set from storage heli:rider Inventory[{Slot:1b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,2]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,2]}}}] Item set from storage heli:rider Inventory[{Slot:2b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,3]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,3]}}}] Item set from storage heli:rider Inventory[{Slot:3b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,4]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,4]}}}] Item set from storage heli:rider Inventory[{Slot:4b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,5]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,5]}}}] Item set from storage heli:rider Inventory[{Slot:5b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,6]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,6]}}}] Item set from storage heli:rider Inventory[{Slot:6b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,7]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,7]}}}] Item set from storage heli:rider Inventory[{Slot:7b}]
execute at @a[tag=Get_Off] run summon minecraft:item ~ ~ ~ {Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,8]}}}
data modify entity @e[type=item,limit=1,sort=nearest,nbt={Item:{id:”minecraft:stick”,Count:1b,tag:{Tags:[dummy,8]}}}] Item set from storage heli:rider Inventory[{Slot:8b}]
kill @e[type=item,nbt={Item:{id:”minecraft:stick”,tag:{Tags:[dummy]}}}]tag @a[tag=Get_Off] remove Get_Off


#放物線運動関係雑多
execute store result score @a[tag=tester] Phi run data get entity @p Rotation[0] 1execute if entity @a[scores={Phi=..-1}] run scoreboard players add @s Phi 360
execute store result score @a[tag=tester] Theta run data get entity @p Rotation[1] 1execute as @a run scoreboard players add @s Theta 90
execute if entity @a[scores={Theta=..-1}] as @a[scores={Theta=..-1}] run scoreboard players add @s Theta 90
execute if entity @a[scores={Theta=1..}] as @a[scores={Theta=1..}] run scoreboard players remove @s Theta 90
execute store result score @a[tag=tester] Theta


#方位角 0~90,180~270
execute at @a[tag=CannonFire] run summon minecraft:creeper ~ ~1.5 ~ {Small:1,Tags:[CannonBall],DeathLootTable:”minecraft:empty”,Invulnerable:1}
execute at @a[tag=CannonFire] run playsound minecraft:entity.lightning_bolt.impact master @a ~ ~ ~ 0.4 2
execute as @a[tag=CannonFire] run clear @s minecraft:creeper_spawn_egg 1
execute as @a[tag=CannonFire,tag=Reverse] run tag @s remove Reverse
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] store result entity @s Motion[2] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionZ
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] store result entity @s Motion[1] double 0.0001 run scoreboard players get @p[tag=CannonFire] MotionY
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] store result entity @s Motion[0] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionX
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] run tag @s add Firing

execute at @a[tag=CannonFire] run summon minecraft:item ~ ~1.5 ~ {PickupDelay:32767s,Age:-32768s,DeathLootTable:”minecraft:empty”,Invulnerable:1,Tags:[CannonBall],Item:{id:”minecraft:creeper_head”,Count:1b}}
execute at @a[tag=CannonFire] run playsound minecraft:entity.lightning_bolt.impact master @a ~ ~ ~ 0.4 2
execute as @a[tag=CannonFire] run clear @s minecraft:gunpowder{ItemName:Creeper_Bullet} 1
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] store result entity @s Motion[0] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionZ
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] store result entity @s Motion[1] double 0.0001 run scoreboard players get @p[tag=CannonFire] MotionY
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] store result entity @s Motion[2] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionX
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] run tag @s add Firing

#方位角 90~180,270~360
execute at @a[tag=CannonFire] run summon minecraft:creeper ~ ~1.5 ~ {Small:1,Tags:[CannonBall],DeathLootTable:”minecraft:empty”,Invulnerable:1}
execute at @a[tag=CannonFire] run playsound minecraft:entity.lightning_bolt.impact master @a ~ ~ ~ 0.4 2execute as @a[tag=CannonFire] run clear @s minecraft:creeper_spawn_egg 1
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] store result entity @s Motion[0] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionZ
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] store result entity @s Motion[1] double 0.0001 run scoreboard players get @p[tag=CannonFire] MotionY
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] store result entity @s Motion[2] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionX
execute as @e[type=minecraft:creeper,tag=CannonBall,tag=!Firing] run tag @s add Firing

execute at @a[tag=CannonFire] run summon minecraft:item ~ ~1.5 ~ {PickupDelay:32767s,Age:-32768s,DeathLootTable:”minecraft:empty”,Invulnerable:1,Tags:[CannonBall],Item:{id:”minecraft:creeper_head”,Count:1b}}
execute at @a[tag=CannonFire] run playsound minecraft:entity.lightning_bolt.impact master @a ~ ~ ~ 0.4 2
execute as @a[tag=CannonFire] run clear @s minecraft:gunpowder{ItemName:Creeper_Bullet} 1
execute as @a[tag=CannonFire,tag=Reverse] run tag @s remove Reverse
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] store result entity @s Motion[2] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionZ
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] store result entity @s Motion[1] double 0.0001 run scoreboard players get @p[tag=CannonFire] MotionY
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] store result entity @s Motion[0] double 0.00000001 run scoreboard players get @p[tag=CannonFire] MotionX
execute as @e[type=minecraft:item,tag=CannonBall,tag=!Firing] run tag @s add Firing

#かまどと上に貼った額縁のスコアボードの連携
give @s minecraft:glowstone{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}
give @s minecraft:glowstone{display:{Name:'{“text”:”Capacitor”,”color”:”aqua”,”italic”:false}’,ItemName:CAP}}

execute as @e[type=item_frame,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] at @s run data get block ~ ~-0.5 ~ Items[{Slot:1b}].Count
execute as @e[type=item_frame,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{ItemName:TPG}}}}] at @s run data get block ~ ~-0.5 ~ Items[{Slot:1b}].Count
execute as @e[type=item_frame,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{ItemName:TPG}}}}] at @s if block ~ ~-0.5 ~ minecraft:furnace{Items:[{Slot:1b,id:”minecraft:coal”}]} run data get block ~ ~-0.5 ~ Items[{Slot:1b}].Count
execute as @e[type=item_frame,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Capacitor”,”color”:”aqua”,”italic”:false}’,ItemName:CAP}}}}] at @s run data get block ~ ~-0.5 ~
execute if entity @e[type=item_frame,scores={EP=..200},nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] as @e[type=item_frame,scores={EP=..200},nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] at @s if block ~ ~-0.5 ~ minecraft:furnace{Items:[{Slot:1b,id:”minecraft:coal”}]} store result score @e[type=item_frame,scores={EP=..200},limit=1,sort=nearest,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] Count run data get block ~ ~-0.5 ~ Items[{Slot:1b}].Count
execute as @e[type=item_frame,scores={Count=1..},nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] run scoreboard players remove @s Count 1
execute as @e[type=item_frame,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] at @s store result block ~ ~-0.5 ~ Items[{Slot:1b}].Count int 1 run scoreboard players get @e[type=item_frame,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}},limit=1,sort=nearest] Count
execute as @e[type=item_frame,scores={Count=1..},nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] run scoreboard players add @s EP 200
execute as @e[type=item_frame,scores={EP=0..59},nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Capacitor”,”color”:”aqua”,”italic”:false}’,ItemName:CAP}}}}] at @s if entity @e[type=item_frame,scores={EP=10..},distance=..1,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] run scoreboard players add @s EP 1
execute as @e[type=item_frame,scores={EP=0..59},nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Capacitor”,”color”:”aqua”,”italic”:false}’,ItemName:CAP}}}}] at @s if entity @e[type=item_frame,scores={EP=10..},distance=..1,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] run scoreboard players remove @e[type=item_frame,scores={EP=10..},distance=..1,nbt={Facing:1b,Item:{id:”minecraft:glowstone”,tag:{display:{Name:'{“text”:”Thermal_power_generator”,”color”:”aqua”,”italic”:false}’,ItemName:TPG}}}}] EP 10

コメント

  1. こー! より:

    プレイヤーと違う座標にいるエンティティにプレイヤーと同じ方向を向かせたいです。
    executeのstoreをつかって見たのですがうまく行きません。
    何かいい方法はありませんでしょうか?

    • Minecrafterししゃも より:

      コメントありがとうございます。

      execute as @e[tag=aaa] at @s store result entity @s Rotation[0] float 1 run data get entity @p Rotation[0]

      ↑な感じでいかがかな、と。パスは Rotation なんですが、リストになってるので仰角、俯角毎に入れないといけないっぽいかな?
      エンティティの指定とか座標とかは上手くやってみてください。

      どうしても分からなかったら記事書きますので、また言ってください。