2

I'm trying to create an RPG launcher kind of device to make a tutorial on for my YouTube channel. I am using crossbows and firework rockets and so far I have succeeded in having the firework rocket explode when flying above grass blocks. Is there any way to detect when the rocket flies into any block, rather than a particular block / category?

1
  • Can you add details? What have you tried? I am rather confused. – fasterthanlight Sep 2 '20 at 14:44
2

Try the following:

/execute unless block X Y Z minecraft:air run SOMETHING...

Theoretically this should work, as minecraft:air is a block type, and should be detectable using the /execute command.

0
0

You could use the command /execute as @e[type=minecraft:firework_rocket] at @s anchored eyes unless block ^ ^ ^1 air run summon minecraft:creeper ~ ~ ~ {Fuse:0s,ignited:1b} in a repeating command block, which checks if the block infront of the firework rocket is not air, which causes an explosion, though pressing F3 + B (and looking at the blue line) reveals that the facing direction can be a bit wonky with fireworks.

I'd also recommend having /execute as @e[type=minecraft:firework_rocket] at @s anchored eyes unless block ^ ^ ^1 air run kill @s in a chain command block to make sure the explosion only happens once

Having an area full of string would make the system more reliable, as the rocket could pass through the string but be facing string, a non-air block

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.