PT-BR EN
Channel Icon

Crazy Ozz

Official Channel Website

Command Block

How to Make the Warden's Sonic Attack in Minecraft

Version 1.21.4 Java Edition

Step 1: Let’s get the customized stick that will be used to perform the attack

give @p minecraft:stick[custom_data={WardenAttack:1},custom_name='[{"text":"Teste"}]',minecraft:enchantment_glint_override=true]

Step 2: The first command creates the scoreboard to act as a timer. The second command displays the timer on the sidebar, and the third sets each player's timer score to 0 to activate the detection in the next commands.

scoreboard objectives add temporizador dummy

scoreboard objectives setdisplay sidebar temporizador

scoreboard players set @a temporizador 0

You can place these 3 command blocks in a line facing the same direction. The first should be an orange (impulse) block with a button, and the last 2 should be chain blocks set to Always Active.

Step 3: Place 3 Repeat command blocks separately and set them to Always Active. Put the following commands in each one:

1st block detects if the player is holding the custom stick in their main hand and if their cooldown is 0, then it runs the Warden attack function

execute as @a run execute if items entity @s weapon.mainhand minecraft:stick[custom_data={WardenAttack:1}] run execute if score @s temporizador matches 0 run function comandos:warden_attack

2nd block detects if the timer has reached 60 and resets it (cooldown ends)

execute as @a run execute if score @s temporizador matches 60.. run scoreboard players set @s temporizador 0

3rd block adds 1 to the timer score on every game tick (0.05s) once the timer is 1 or more. Since we used 60 above, that equals 3 seconds of cooldown

execute as @a if score @s temporizador matches 1.. run scoreboard players add @s temporizador 1

Step 4: Let’s talk about the function. Inside it, we have multiple repeated commands that execute across 10 blocks of space

We check if the player is holding the custom stick and then run these commands

We use the particle command for the sonic attack visual effect and the effect command to apply damage

On mobs like skeletons or zombies it won’t work unless you replace instant_damage with instant_health

After running these 20 commands, the Warden's attack sound plays, and the ability goes on cooldown by setting the timer score to 1, which triggers the cooldown logic from Step 3 above

The function is too large to include here, so download it here and move it into your world folder. If you’ve never created a function before, watch this video to understand and complete the process.

Still have questions? Watch the video below