I was trying to create snowball grenades for a mini-game I was creating, and I looked online for a solution that worked. However, everything I found either didn't work or wasn't updated for 1.13 mechanics, so I created my own. My set up is the following:
Set up Stream objective in either a command block or in your command bar:
scoreboard objectives add Stream dummy
In a repeating command block set to "Always Active" with a string of chain command blocks in front, all set to "Unconditional," place the following commands in order:
tag @e[type=minecraft:snowball] add grenade
execute at @e[tag=grenade] run summon minecraft:armor_stand ~ ~ ~ {NoGravity:1, Marker:1, Invisible:1, NoBasePlate:1}
execute as @e[type=minecraft:armor_stand] unless score @s Stream matches 1.. run scoreboard players set @s Stream 0
tag @e[scores={Stream=0}] add first
tag @e[scores={Stream=1}] remove first
tag @e[scores={Stream=1}] add second
scoreboard players add @e[type=minecraft:armor_stand] Stream 1
execute as @e[tag=second] at @s unless entity @e[tag=first,distance=..2] run summon minecraft:tnt ~ ~ ~
execute as @e[tag=second] at @s unless entity @e[tag=first,distance=..2] run kill @s
execute as @e[tag=second] at @s if entity @e[tag=first,distance=..2] run kill @s
Throwing a snowball should now create an explosion on impact!
I was trying to create snowball grenades for a mini-game I was creating, and I looked online for a solution that worked. However, everything I found either didn't work or wasn't updated for 1.13 mechanics, so I created my own. My set up is the following:
Set up Stream objective in either a command block or in your command bar:
In a repeating command block set to "Always Active" with a string of chain command blocks in front, all set to "Unconditional," place the following commands in order:
Throwing a snowball should now create an explosion on impact!
This was helpful! Needed it.
Not much of a coder myself