How to Use Locations to Strike Lightning in Minecraft Mods

By Sarah Guthals, Stephen Foster, Lindsey Handley

In the Drones and Locations set of badges are specific badges related to Minecraft locations. The fun part about having the location of a player or drone is that you can make things happen directly at that location, such as strike lightning.

Use Locations to strike lightning on yourself in Minecraft

Make sure you’re in Creative mode while in Minecraft when you test this badge. Here is Locations Part I challenge.

Here is the final batch of code you write to make lightning strike on yourself.

image0.jpg

This code example uses two new blocks:

  • world strike lightning at: You can find it under the Minecraft category and then World.

    image1.jpg

  • location of: You can find it under the Minecraft category and then Entities.

    image2.jpg

When you run this mod in either Minecraft or the simulator, two things happen:

  • You see the lightning descend from the sky.

    image3.jpg

  • The grass around you catches fire.

    image4.jpg

Use Locations to strike lightning on drones in Minecraft

In the Locations Part 2 challenge, you can read how to strike lightning on drones rather than on yourself. This information can come in handy when you’re trying to defend structures you’ve created.

Check out the code you need in order to strike lightning somewhere other than on yourself.

image5.jpg

You can strike lightning in multiple places by using multiple drones — neat-o!

This shows you how to make three drones and strike lightning on each of them.

image6.jpg

Being able to make multiple drones can also come in handy if you want to make multiple structures. Each drone can be in charge of making a different structure, and you don’t have to reset one before making something new.