6PROGRAMMING A ROBOT LUMBERJACK

image

It’s time to put your new programming knowledge to the test in the world of Minecraft. We’ll program our first turtle to chop down all the wood blocks of a tree. With the help of these turtles, your wood supply problems will be over!

Chopping trees by hand in Minecraft has many problems. It’s slow, it wears out your tools, and you need to reach the topmost wood block to completely chop down a tree. In comparison, turtles can harvest a wood block in one chop, their tools don’t wear out, and they can hover as high as you need them to, as shown in Figure 6-1.

Figure 6-1: Four turtles chopping a tall jungle tree

Get Coding with Minecraft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.