Command Block Tutorial

Опубликовано: 17 Март 2026
на канале: RedstoneKnightX
765
14

In this video I will show how to give yourself a special item that allow you to take flight on any pig you ride on.

Commands:

To get the Flying Carrot on a Stick (Impulse command):
/give @p carrot_on_a_stick[custom_name='{"text":"Flying Carrot on a Stick"}',custom_data={Flying_Pig:1b},minecraft:unbreakable={}] 1

To activate the Flying Carrot on a Stick:

Scoreboard Commands (To add and remove):

/scoreboard objectives add Flying_Pigs minecraft.used:minecraft.carrot_on_a_stick

/scoreboard objectives remove Flying_Pigs

Command to reset the scoreboard:

Repeater Command Block: /scoreboard players reset @a Flying_Pigs

To activate the Flying Carrot on a Stick when in your main hand (flying up):

1. Repeater Command Block: /execute at @p run execute if entity @p[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",count:1,components:{"minecraft:custom_data":{Flying_Pig:1b}}}}] run execute if entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b}] run scoreboard players set @e[scores={Flying_Pigs=1..}] Flying_Pigs 0

2. Chain Command Block: /execute at @p run effect give @e[type=pig,distance=0..0.75,nbt={Saddle:1b}] minecraft:levitation 1 1 true

3. Repeater Command Block: /execute at @p run execute if entity @p[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",count:1,components:{"minecraft:custom_data":{Flying_Pig:1b}}}}] run execute if entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b},nbt=!{OnGround:1b}] run execute as @r at @s if block ~ ~-2 ~ minecraft:air run data merge entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b},limit=1] {NoGravity:1b}

4. Repeater Command Block: /execute at @p run execute if entity @p[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",count:1,components:{"minecraft:custom_data":{Flying_Pig:1b}}}}] run execute if entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b},nbt=!{OnGround:1b}] run execute as @r at @s if block ~ ~-2 ~ minecraft:air run effect give @e[type=pig,distance=0..0.75,nbt={Saddle:1b},nbt=!{OnGround:1b}] minecraft:speed 1 19 true

To activate the Flying Carrot on a Stick when in your main hand (flying down):

1. Repeater Command Block: /execute at @p run execute if entity @p[nbt={Inventory:[{Slot:-106b,id:"minecraft:carrot_on_a_stick",count:1,components:{"minecraft:custom_data":{Flying_Pig:1b}}}]}] run execute if entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b}] run scoreboard players set @e[scores={Flying_Pigs=1..}] Flying_Pigs 0

2. Chain Command Block: /execute at @p run data merge entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b},limit=1] {NoGravity:0b}

3. Repeater Command Block: /execute at @p run execute if entity @p[nbt={Inventory:[{Slot:-106b,id:"minecraft:carrot_on_a_stick",count:1,components:{"minecraft:custom_data":{Flying_Pig:1b}}}]}] run effect give @e[type=pig,distance=0..1,nbt={Saddle:1b},nbt=!{OnGround:1b}] minecraft:slow_falling 1 0 true

4. Repeater Command Block: /execute at @p run execute if entity @p[nbt={Inventory:[{Slot:-106b,id:"minecraft:carrot_on_a_stick",count:1,components:{"minecraft:custom_data":{Flying_Pig:1b}}}]}] run execute if entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b},nbt=!{OnGround:1b}] run execute as @r at @s if block ~ ~-2 ~ minecraft:air run effect give @e[type=pig,distance=0..0.75,nbt={Saddle:1b},nbt=!{OnGround:1b}] minecraft:speed 1 19 true

5. Repeater Command Block: /execute at @p run execute if entity @p[nbt={Inventory:[{Slot:-106b,id:"minecraft:carrot_on_a_stick",count:1,components:{"minecraft:custom_data":{Flying_Pig:1b}}}]}] run execute if entity @e[type=pig,distance=0..0.75,nbt={Saddle:1b},nbt={OnGround:1b}] run effect clear @e[type=pig,distance=0..1,nbt={Saddle:1b},nbt={OnGround:1b}] minecraft:speed

Music:

1. Gaming Sound FX:

Monkeys Spinning Monkeys (Kevin MacLeod) - Gaming Background Music (HD):
https://www.youtube.com/watch?v=pr42a...