How to Use Drones to Build Structures in Minecraft Mods - For Dummies

Building structures in Minecraft is made much easier when you can use drones. A drone is an invisible robot that can move around and place blocks and entities at its location. Here, you start building structures in Minecraft using drones — knowledge that comes in handy when you need to build large structures.

Create a drone

Creating a drone isn’t complicated, but it does require you to use a new coding feature: variables. A variable is a way to name an object. For these instructions, you can follow along with the description of the Drones challenge in the LearnToMod online software.

Open the Drones challenge, and follow these steps:

  1. To be able to give commands to the drone, you need to name it. You name an object, like a drone, by assigning it to a variable. First drag a variable block into the main function.

    image0.jpg
  2. Always give objects names that make sense to you and that you can easily remember. In this example, create a new variable by clicking on the arrow next to item.

    image1.jpg
  3. Name it d for drone.

    image2.jpg
  4. To create a drone, you have to assign a new one to the variable you just made. This is where you find the new Drone block.

    image3.jpg

    This is where you put it in the d assign block.

    image4.jpg

Now that you have a drone, you can access it by using its name, d, and you can tell it to perform certain actions, such as place blocks or spawn entities.

Build a structure and move a drone

After you give the new drone a name, you can give it commands. This is where to find the place block code block.

image5.jpg

This code block requires you to specify a type of block that the drone will put down, like a brick or diamond block. This is where you can find the brick type.

image6.jpg

Here’s the completed code.

image7.jpg

If you run this code in Minecraft or the simulator, you see a scene like this.

image8.jpg

Your structure appears in the area in which you’re looking, so move to an empty area when you build. You can even go into Creative mode and build in the sky: Double-click the spacebar to hover, and then press the spacebar again to move upward.

Continuing with Step 3 of the Drones challenge, you should add a move block to your mod. You can find the block under the Minecraft category and then Drones, just like the place block code block you found.

image9.jpg

If you run the code again, you see the same result. The drone is invisible, so moving it around has no visible effect.

Continue working to complete this challenge by adding three more lines of code. Check out the completed code needed to earn this badge.

image10.jpg

Before you run the mod, predict on paper what you will see. Then run the mod in the simulator, and compare your prediction to what you see.

If your prediction was incorrect, go back to the code and trace it either on paper or on the computer. To trace using the computer, disable all blocks of code by right-clicking and choosing Disable Block. Then reenable one block at a time, testing the mod every time you enable one, to see whether you understand what is going on.

image11.jpg