Minecraft Modding For Kids For Dummies
Book image
Explore Book Buy On Amazon

The first step in creating your Minecraft game is to build the scene. These instructions explain how to create the scene for a basic game called Spleef. The scene in Spleef is an arena that has a fence around it.


To make this arena, you use the ArenaBuilder library on LearnToMod. A library is a mod that is already written for you. You can use it without having to know how it is written.

To explore the library, follow these steps:

  1. Go to mod.learntomod.com/programs/sarah-ArenaBuilder.

    You see these five functions:

    • init

    • move_drone

    • ArenaWithFence

    • Platform

    • Fence

  2. Click the question mark (?) on each function.

    A comment pops up, describing what the function does. For example, here is the comment for the Fence function.

  3. Look through this code, and its parameters, to see what the code is doing.

    Notice that there’s no main function, because this mod cannot run on its own in Minecraft. Instead, it must be called from other mods.

    Also notice the block: export. The export block makes the function that’s written in the block accessible to other mods, meaning other mods can call the functions even though they’re in a different mod.


    Three functions are being exported: ArenaWithFence, init, and move_drone.

  4. Now you can use these three functions in your Spleef game.

After you have exposed the ArenaBuilder library, go back to your Spleef mod and import the library. Follow these steps:

  1. Under the Misc category, find the import block.

  2. Drag it into the mod and type sarah-ArenaBuilder to replace the text lib-name.


    If you enter the mod name correctly, the block stays green and new functions appear under the Functions category.


    Notice that the three functions you now have access to the three that were exported from the ArenaBuilder library.

  3. Create a main function, and add a call to the init function from the ArenaBuilder library.

    The init function, if you look back at the library, basically creates the drone that will be used to create the arena for you.

  4. After your drone is ready to build your arena, add a call to the ArenaWithFence function from the ArenaBuilder library to the main function.

    This shows how to make a 20 x 20 arena made of diamond with a fence that’s five blocks high and a platform width of one block. The arena will be filled with air. This makes the arena where you will play Spleef.

  5. Even though you didn’t write the ArenaBuilder library, test your code as you’re building it. To test your code, make sure that the mod is saved, click the Mod button, and test the code in Minecraft.

    You see a scene like this one.

  6. Before moving on, refactor the code — change it without changing what it does.

  7. In this case, you’re refactoring the code so that the arena is built in a function named arena and so that the arena function is called from main.


Congratulations — you’ve created the basic Spleef scene!

About This Article

This article is from the book:

About the book authors:

Sarah Guthals, Ph.D. is the CTO of ThoughtSTEM and has dedicated her life to coding education.

Stephen Foster, Ph.D. is the CEO of ThoughtSTEM, a company that teaches computer science to kids across America.

Lindsey Handley, Ph.D. is the COO of ThoughtSTEM and has hundreds of hours of experience as a classroom instructor for Minecraft based science and computer science classes.

This article can be found in the category: