2

I have a command in a command block that's repeating and always active with this command in it:

/execute @e[type=snowball] ~ ~ ~ summon Fireball ~ ~ ~ {direction:[0.0,0.0,0.0],ExplosionPower:0}

And I was wondering if I was able to make it so on my realm only I can use it. I was having a little trouble, can anyone help me?

  • You want to make it only usable on Realms, but have it fail everywhere else? That's not possible, it's the same game. – Fabian Röling Aug 12 '17 at 10:20
  • Also: This command sounds like a really bad idea, every flying snowball would spawn hundreds of fireballs on its path. – Fabian Röling Aug 12 '17 at 10:22
  • The only way I think this would work is if you give the snowball a custom name and target the name in the command. Also as @Fabian said you should probably kill the Snowball entity when the command is executed because it will cause a lot of lag if you don't. – Galen Nare Aug 12 '17 at 22:03
  • I've already tried naming it but it loses its name when it's In the air I think. Also it works by summoning one fireball, and I want it to only work for ME on my realm so no one else on my realm can use it. And if I was going to kill the snowball how would I add that in to the command. Just looking for help making the command to make all that work can someone post the command to make it all work please? – luca Aug 17 '17 at 16:58
  • I've already tried naming it but it loses its name when it's In the air I think. Also it works by summoning one fireball, and I want it to only work for ME on my realm so no one else on my realm can use it. And if I was going to kill the snowball how would I add that in to the command. Just looking for help making the command to make all that work can someone post the command to make it all work please? – luca Aug 17 '17 at 17:05
1

The command you posted does work but it is an odd command. In the comments, @Fabian warns of producing several fireballs in the path of the snowball. This is because you never kill the original snowball. That looks like this: Trail

In order to make this happen, I removed the direction data from your original command.

I believe the reason your command only summons one fireball is because with the direction data, the fireball follows the path of the snowball for a short time. The fireball destroys the snowball.


I had the same idea as @Galen Nare to use named snowballs but I believe they lose their name once then are thrown. Items vs entities vs projectiles kind of thing.


You could use this:

execute <your name> ~ ~ ~ execute @e[type=Snowball,r=2] ~ ~ ~ summon Fireball ~ ~ ~ {direction:[0.0d,0.0d,0.0d],ExplosionPower:0}

It will only succeed on snowballs found within a radius of 2 from you. It works as intended when you throw a snowball but it isn't perfect.

If someone were to stand next to you and throw a snowball or any time someone were to throw a snowball directly at you, it would summon a fireball.

Also, if you load snowballs into a dispenser and either stand near the dispenser or in it's path, a fireball with no direction is summoned.


Edit: This is an addition based on the suggestion of @D-Inventer. It adds some complication but also adds an extra check that will prevent some of the problems I listed with the original command.

Create a scoreboard using the statistic of snowballs used:

scoreboard objectives add Thrown stat.useItem.minecraft.snowball 

Next use 3 command blocks in a chain to test yourself for a score, run the summon command, and reset player scores.

First in a repeating/unconditional/always active command block:

scoreboard players test <Your Name> Thrown 1 

Second in a chain/conditional/always active command block:

execute @a[name=<Player Name>,score_Thrown_min=1] ~ ~ ~ execute @e[type=Snowball,r=2] ~ ~ ~ summon Fireball ~ ~ ~ {direction:[0.0d,0.0d,0.0d],ExplosionPower:0}

Third in another chain/conditional/always active command block:

scoreboard players set * Thrown 0

As you see, the second command is similar to the original command but includes a check for your score for snowballs thrown.

It only resets the player scores when you throw a snowball. You could make the last command block unconditional and it would reset the scores continuously. If you decide to do this, it will spam chat with command block output unless you use /gamerule commandBlockOutput false.

Also to note, these command blocks have to be located in loaded chunks. I would recommend the spawn chunks.

  • You could do a scoreboard and keep track of stat.itemUsed.snowball to see who threw the snowball I think. I haven't tested it though. – D-Inventor Sep 1 '17 at 7:05
  • @D-Inventor It does work. That was a good idea. I have edited my answer. Thank you for the suggestion. If you post an answer with the idea, I will remove that portion of my answer. – IronAnvil Sep 1 '17 at 19:17

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.