Fire a projectile in the direction you're looking [Minecraft Command Tutorial]

Опубликовано: 08 Сентябрь 2026
на канале: 포마인
32,711
325

.
.
※Please be sure to refer to the pinned comments※

[Create Scoreboard]
/scoreboard objectives add MotionX1 dummy
/scoreboard objectives add MotionY1 dummy
/scoreboard objectives add MotionZ1 dummy
/scoreboard objectives add MotionX2 dummy
/scoreboard objectives add MotionY2 dummy
/scoreboard objectives add MotionZ2 dummy

[Add Tags]
(Right-click detection command) tag @s add shot
※If you don't know how to do this, refer to the previous video※
   • 우클릭 감지하기 [마인크래프트 커맨드 강좌]  

[Fire an arrow in the direction you're looking]
execute as @e[tag=shot] at @s anchored eyes run summon minecraft:area_effect_cloud ^ ^ ^ {Tags:["BuPos"]}

execute as @e[tag=shot] at @s anchored eyes run summon minecraft:arrow ^ ^ ^ {Tags:["Bu"]}

execute as @e[tag=BuPos] store result score @s MotionX1 run data get entity @s Pos[0] 100000

execute as @e[tag=BuPos] store result score @s MotionY1 run data get entity @s Pos[1] 100000

execute as @e[tag=BuPos] store result score @s MotionZ1 run data get entity @s Pos[2] 100000

execute as @e[tag=shot] at @s anchored eyes run tp @e[tag=BuPos,limit=1,sort=nearest] ^ ^ ^number

execute as @e[tag=BuPos] store result score @s MotionX2 run data get entity @s Pos[0] 100000

execute as @e[tag=BuPos] store result score @s MotionY2 run data get entity @s Pos[1] 100000

execute as @e[tag=BuPos] store result score @s MotionZ2 run data get entity @s Pos[2] 100000

execute as @e[tag=BuPos] run scoreboard players operation @s MotionX2 -= @s MotionX1

execute as @e[tag=BuPos] run scoreboard players operation @s MotionY2 -= @s MotionY1

execute as @e[tag=BuPos] run scoreboard players operation @s MotionZ2 -= @s MotionZ1

execute at @e[tag=shot] as @e[tag=Bu,limit=1,sort=nearest] store result entity @s Motion[0] double 0.00001 run scoreboard players get @e[tag=BuPos,limit=1,sort=nearest] MotionX2

execute at @e[tag=shot] as @e[tag=Bu,limit=1,sort=nearest] store result entity @s Motion[1] double 0.00001 run scoreboard players get @e[tag=BuPos,limit=1,sort=nearest] MotionY2

execute at @e[tag=shot] as @e[tag=Bu,limit=1,sort=nearest] store result entity @s Motion[2] double 0.00001 run scoreboard players get @e[tag=BuPos,limit=1,sort=nearest] MotionZ2

tag @e[tag=shot] remove shot

tag @e[tag=Bu] remove Bu