2

I've been doing some research on making lightning swords or items, but the only working things seem to be server plugins. I'm trying to achieve the same effect with command blocks in Minecraft 1.8.8.

There probably is a way using scoreboard, execute and summon commands. The thing I'm trying, however, is to make the lightningBolt entity spawn where I click. Does anyone know how to do this?

6
  • 2
    i'm pretty sure you can't do exactly where you are clicking, as there is no way to detect it using command blocks, but you can do it relative to entities that you aim at. For this, i suggest looking here
    – Judge2020
    Commented Aug 20, 2015 at 14:59
  • 1
    Not possible AFAIK although I'm pretty sure you could use named arrows & a bow using something like /execute @e[type=Arrow] summon LightningBolt (although those aren't the correct entity names). This will also summon lightning until the arrow despawns (i.e. never if fired by a player) so you'd need to work out how to kill the arrow.
    – user109232
    Commented Aug 20, 2015 at 19:19
  • 1
    Maybe every tick add 1 to a fired arrow's dummy scoreboard objective, then kill all arrows with score > 2? You'd need to only detect arrows stuck in the ground (there's an NBT tag IIRC, similarly with the name assuming you don't want all arrows to summon lightning).
    – user109232
    Commented Aug 20, 2015 at 19:22
  • I thought it was impossible to add a datatag to the execute command? Could you tell me how to do so? Also, the bow idea sounds great! Commented Aug 20, 2015 at 20:45
  • @JaïrPaalman You can't directly add a datatag to an execute command, but you can set a scoreboard objective based on a datatag, and then use that score in the execute selector.
    – SirBenet
    Commented Aug 22, 2015 at 15:30

3 Answers 3

2

You can create a lightning stick using these commands in a command block:

/testfor @e[type=Player] {SelectedItemSlot:0}

/execute @e[type=*InsertMobNameHere*] ~ ~ ~ summon LightningBolt ~ ~ ~

You can also create lightning arrows:

/execute @e[type=Arrow,c11] ~ ~ ~ summon LightningBolt

/kill @e[type=Arrow]

To receive a command block, you can type in the command chat:

/give @p minecraft:command_block 64
2
  • Thank you, but I,m no longer interested in making a lightning sword because I already had someone help me with a lightning bow. It works a little more accurate, only summoning lightning if the arrows are in the ground. Anyways, thanks. Commented Sep 29, 2015 at 5:09
  • Just curious, what is the c11 selector? Is this is a syntax I don't know about, or a typo? I can't seem to find anything online.
    – Penguin
    Commented Nov 13, 2020 at 2:05
2

Late to the party, but you can use this. /execute at [player] run summon minecraft:lightning_bolt ~ ~ ~ Summons summons lightning bolt at player position. ~ ~ ~ is needed. You can also use @r, @a and others in place of [player]. Apparently you need the at part before the run part.

1
  • That's not how the execute command works
    – Penguin
    Commented Nov 13, 2020 at 2:06
0

Just use a few one is enchant (your name) (whatever enchantment you want) 1 then put a comparator then put a command block that says execute @a ~ ~ ~ tp @e[type=lightning_bolt] ^ ^ ^10 then put another that says summon lightning_bolt and put all of them to repeat IT IS POSSABLE

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