Minecraft – How does one make a lightning sword in vanilla Minecraft

minecraft-commandsminecraft-java-edition

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?

Best Answer

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