How to Create an Explosive Wand in Minecraft (Explosive Wand)
Minecraft Java 1.21+ and 26+ – Right Click Wand with Explosions and Cooldown
Want to create a magic explosive wand in Minecraft for adventure maps, RPG worlds, or minigames?
In this tutorial you’ll learn how to make an Explosive Wand that spawns explosions using right click detection,
with a scoreboard cooldown system and datapack functions.
Works in Minecraft Java Edition 1.21+ and newer versions like 26+.
Download the ready and complete datapack to use in this tutorial by clicking here
If you don't know how a function works, click here and check out this tutorial
In this tutorial, we will use right-click mouse detection. If you want to learn more about how this detection works, check out this tutorial by clicking here
Before we start, get the explosive wand using the command below
give @p minecraft:stick[food={nutrition:0,saturation:0.0,can_always_eat:true},minecraft:consumable={consume_seconds:1000000},minecraft:custom_data={Explosive_Wand:1b},minecraft:custom_name="Explosive Wand",minecraft:enchantment_glint_override=true]
Create the following scoreboard to be used as the wand cooldown
scoreboard objectives add wand_cooldown dummy
Run this command to set a zero score in the scoreboard to avoid problems
scoreboard players set @a wand_cooldown 0
Now it's time to set up the cooldown and run the function commands
Place two separate Repeat command blocks set to Always Active and use the following commands
execute as @a if score @s wand_cooldown matches 1.. run scoreboard players add @s wand_cooldown 1
execute as @a if score @s wand_cooldown matches 40.. run scoreboard players set @s wand_cooldown 0
The first command will run on all players (adding +1 score individually) every Minecraft tick: 20 ticks = 1 second
In the second command, we detect if the score reached 40, which in this case means a cooldown of 2 seconds
After that, the score will be reset, and therefore the cooldown to use the wand will also reset
As soon as the click happens, the function is called and checks if the cooldown is zero to execute the commands
Here are the function commands
advancement revoke @s from comandos:explosion_wand_click
execute if score @s wand_cooldown matches 0 run summon minecraft:tnt ^ ^ ^5 {fuse:0}
execute if score @s wand_cooldown matches 0 run scoreboard players set @s wand_cooldown 1