This is not going to be that easy of a thing to implement.
Summoning mobs relative to anything other than the coordinates that the command block is sitting relies on the /execute
command, which executes a command relative to another entity. Particles aren't entities, so we cannot execute any command whatsoever relative to where the particles occur. It's not that it's difficult to do, it's simply not possible.
I'd suggest working relative to the snowball itself, except there's no way to tell when they hit something. They're destroyed once they hit something. However... we can do some magic with armor stands.
We're going to need a scoreboard too. So go ahead and set up a scoreboard called "AGE" (or call it whatever you want, but remember to replace it where relevant).
/scoreboard objectives add AGE dummy
This will keep track of how old our entities are. Kind of. You'll see in a minute.
Place 7 command blocks in a line. These should be set up using a repeat command block at the beginning, and chain command blocks through the rest of the line. Make sure all of them are set to unconditional/always on. This will continuously pulse them every game tick with minimal lag. We need 2 of these guys to increment the AGE
score for armor stands and snowballs:
/scoreboard players add @e[type=Snowball] AGE 1
/scoreboard players add @e[type=ArmorStand] AGE 1
For brand new snowballs (snowballs with an AGE score exactly 1), we need to summon an invisible armor stand at the position of that snowball:
/execute @e[type=Snowball,score_AGE=1,score_AGE_min=1] ~ ~ ~ summon ArmorStand ~ ~ ~ {NoGravity:1,Invisible:1}
These armor stands will have their age scores incremented by the previous command we set up. From here, we need to move that armor stand to the snowball that summoned it, which in for our purposes is the snowball nearest to it. The c=C
selector argument is useful here. It selects the nearest C entities that match the rest of the selector (selecting the oldest if there is a tie). So the command we'll want is as follows:
/execute @e[type=Snowball,score_AGE_min=2] ~ ~ ~ tp @e[type=ArmorStand,c=1] @e[type=Snowball,c=1]
What this command does is executes the /tp
command for all snowballs that are old enough to also have a matching armor stand, which moves the armor stand along the arc of the snowball as long as it exists.
We'll be using the AGE score from the armor stand to determine where creepers need to be sent, however, we don't want to do that as long as the snowball is still in the air. I handled this by setting the AGE score of all armor stands with a corresponding snowball to 0:
/execute @e[type=Snowball,score_AGE_min=2] ~ ~ ~ scoreboard players set @e[type=ArmorStand,c=1] AGE 0
This causes each snowball to set the AGE score of their corresponding armor stands to 0. Effectively, what this means is as long as the snowball is in flight, the corresponding armor stand will not age.
Finally, the creeper. For all armor stands that have aged, we want to summon a creeper and then kill that armor stand:
/execute @e[type=ArmorStand,score_AGE=2,score_AGE_min=2] ~ ~ ~ summon Creeper ~ ~ ~ {Fuse:0,NoAI:1}
/kill @e[type=ArmorStand,score_AGE_min=3]
This is quite a bit more complicated than you probably wanted, but it works well. The only real issue with it comes if you throw multiple snowballs in rapid (read: immediate) succession. In that case, you will end up with a creeper in your face (which is less than ideal). Think of it like your explosive snowball hit the other explosive snowball (which is essentially what is happening). Throwing them with reasonable timing, or in different directions produces good results.
Snowballs are a lot of fun aren't they? Well, this is simpler, since your requirements are that a particular sort of snowball will have an arc of lightning bolts across its trajectory, but the principal is the same.
For this, I used a series of 4 commands and 1 setup command. (well, and also /gamerule commandBlockOutput false
) It works by setting a lightning
score for snowball entities holding customly named snowballs, and then summoning a lightningbolt at each of those snowballs. And it's actually a neat little set of commands.
First, we need our scoreboard. You can set one up using /scoreboard objectives add lightning dummy
. From here, we want to be able to perform commands on players holding customly named snowballs:
scoreboard players set @a lightning 1 {SelectedItem:{id:minecraft:snowball,tag:{display:{Name:"KABOOM"}}}}
Unfortunately there's no really clean way to invert this sort of command to reset this score, and resetting it for all items would also cause the last snowball in a stack to stop working, so I just reset it for players holding snowballs. As long as the commands execute at the same time, you shouldn't run into any problems, unless you're trying to build a PvP game around this, then you may want to reset this score for everyone just to be safe:
scoreboard players set @a lightning 0 {SelectedItem:{id:minecraft:snowball}}
From here, we can set the score of the snowball entities near these players using execute
:
execute @a[score_lightning_min=1] ~ ~ ~ scoreboard players add @e[type=Snowball,r=10] lightning 0
Now you have a marked snowball. Just what we need! The final step to this equation is to slap a score_lightning_min=0
in the original "make lightning at every snowball entity" command, hook all 4 command blocks up to a clock of some sort (I recommend a /fill
clock, but it's not entirely necessary as long as all of your commands are on the same line of redstone) and we should be set:
execute @e[type=Snowball,score_lightning_min=0] ~ ~ ~ summon LightningBolt ~ ~ ~
The results: Wholly satisfying:
![enter image description here](https://i.stack.imgur.com/L1j2W.png)
Best Answer
In Minecraft bedrock, entities like snowballs can not have effects so there is no way to easily hide the snowball, one thing you can do is make a texture pack to hide the snowball, or have an invisible entity (armor stand) be teleported in front of the snowball (using ^ and facing) then have the entity be teleported in the direction the snowball was heading, this system is quite complex and can use a lot of commands but this is the only ways I know that could do what you want.