Expected Time: 60 - 90 minutes
Students will be able to apply these concepts:
Create and deploy custom resource/texture packs
Define what an entity is and identify what is and is not an entity
Spawn, remove, and manipulate entities using code
Use and understand conditional statements such as “if” and “if-else”
Trigger explosions in Minecraft
Resource/Texture Packs: You can make custom looks for mobs, blocks, and items. You can only have one version of each specific type (such as zombie, bow, or grass block) active at any one time.
Entity: An entity is any object in the Minecraft world that isn’t a block, like mobs, players, boats, Minecarts, and more.
Conditional: Conditionals like the “if-else” block allow your code to make decisions as it runs based on the game state.
Mob: In Minecraft, mobs are any non-player creatures. Some are hostile, like creepers, witches, or zombies. Some are passive, like chickens, pigs, or villagers. Some are neutral, like spiders or Endermen. And some are tameable, like horses, ocelots, or wolves. There are also utility mobs (golems) and boss mobs.
In this second lesson, students will get more comfortable with Tynker’s Mod Designer and learn more blocks that they can use to create mods. They’ll learn how they can use conditionals to make decisions during the game, as well as create custom resource packs.
Students will learn a new event block, “when [player] left clicks [block],” which activates any code attached to it when a player hits a block. Make sure to discuss what left clicking a block means, as not all students (especially those who primarily use iPads or computers with trackpads) will know what this means. A left click is the main click you do on a computer. On a mouse, this is the left key.
The “create explosion” block is awesome! But it’s also very powerful. It can be easy to crash your server if you make an explosion too big, so be careful with this block.
Again, it’s important to pay attention to what parameters each block calls for. The “create explosion” block calls for a “location” parameter, so you can’t pass it a player or a block! There are lots of blocks that convert parameters into different parameters, like finding the location of a block or entity.
2. Smashy Hands (DIY project)
Students can apply everything they’ve just learned to make a “Smashy Hands” project where they trigger explosions every time they click a block.
When students are done, this is a good time to introduce the full code palette, where they can explore all the available code blocks. To switch back and forth between the tutorial and block view, they can click on the tabs on the top left. They can even experiment with a few blocks, but if you’re not sure how to use them, they can be a bit confusing.
Students will learn about the “when [player] touches [entity] at [location]” block. This block has quite a few parameters that you can use in your code!
Make sure students understand what an entity is. It might be good to give them a short quiz about what is or is not an entity. How about a bed? Or a player? Or an arrow?
A potential source of confusion with the “when [player] touches [entity] at [location]” block is what the word “touch” means. In this case, it means a right click. On the trackpad of an Apple computer, right clicking usually involves pressing down with two fingers at the same time. Make sure all your students know how to left and right click on the computer they’re using.
4. Midas Touch (DIY project)
In this DIY project, students will turn entities into gold whenever the player touches them! Well, not quite. What you’re actually doing is a bit more complex. There’s no way to transform an entity into a block, so what you do instead is remove the entity and put a block there so that it looks like the entity has been transformed into the block. Make sure students understand why they need to make the mod in this roundabout way.
Again, remind students that it’s not enough to just drag out code blocks from the tutorial. Many of them have fields that they need to put parameters in.
Ambitious coders can make the mod their own by adding additional effects, like sounds or particles.
Students will learn about the “when [player] right clicks [block]” event block.
The “if-else” block allows students to create conditionals. This is one of the most important tools that they have as programmers. Conditionals allow your program to decide which set of code to run depending on some condition. Essentially, it allows your program to make real-time decisions as it runs by checking if a statement is true or false.
Whatever you put in the hexagonal slot of your “if-else” block must be something that is either true or false, such as the “block is [grass]?” block. This block will evaluate whether the given block matches the type specified, and will return either true or false.
6. Wacky Wand (DIY project)
In this DIY project, students will transform any given block into a different block. But they won’t just be turning all blocks into one type of block! They’ll make a decision about what kind of block to transform the block into depending on its original type using an “if-else” statement.
Show students how they can use the plus button on their “if-else” block to add more branches. It’s often good practice to put something in the “else” section in order to have a catch-all.
7. Custom Blocks, Mobs, and Items
Students can watch this video to learn how to create custom blocks, mobs, and items.
When the video is done, have the students go back to their Minecraft dashboards and create at least one new block, mob, or item, then have them deploy it to their server.
Remind them that they can have only one of each type active at a time. For example, if they already have a custom wolf, they cannot create another without deactivating the first.
Students can also explore the Tynker community and see what other kids have made. If they ever see anything inappropriate, show them that they can report it by clicking the flag on that item. Tynker staff will review anything that is reported.
Students learn about the “when [projectile] from [entity] lands at [location]” block, which is triggered when any projectile (such as a snowball or arrow) lands.
The difference between the two “spawn [entity]” objects is subtle but important. For now, students will only need to use the regular “spawn [entity]” block, but they should remember that the round version exists because they’ll need to use it later!
9. Mob Arrows (DIY project)
In this DIY project, students will make a mod that spawns a mob wherever an arrow lands.
Ask students why they need a conditional. What does this allow them to do in this mod?
As a fun extension, students can spawn other mobs if different projectiles land.
Can students use this mod to spawn the mob for which they’ve just created a custom look?
Wrap Up and Extend the Learning