Monday, 31 March 2014

Creating Minecraft Pi Earthquakes

I've been playing around with controlling the Pi edition of Minecraft from Squeak Smalltalk and had a thought: wouldn't it be cool to create earthquakes?

Some people have tried this already from within Minecraft, e.g. in this video:
https://www.youtube.com/watch?v=dqJg0WW691Y

But what about if you could create cracks in the ground more randomly as you wander around your world?

First follow this article to get Squeak controlling Minecraft.

Now try this from a Workspace in Squeak:

m := Minecraft connect. 
p := m playerTile + {0. 0. 2}.    "two blocks in front of me"
100 timesRepeat: [
    m blockAt: p put: 0.
    p := p - {0. 1. 0}.           "move one block down"
]

That should create a deep hole in front of you, right through to the end of the world!

So you could now repeat this for several more blocks in front of you and add in a bit of randomness:

m := Minecraft connect. 
p := m playerTile + {0. 0. 2}.    "two blocks in front of me"
20 timesRepeat: [
    q := p.
    50 + 10 atRandom timesRepeat: [
        m blockAt: q put: 0.
        q := q - {0. 1. 0}.       "move one block down"
    ].
    p := p + {0. 0. 1}.           "move one block away"
]

Now we have a very straight crack, running 20 blocks ahead of us.

What next?

What about making the crack run in a more zig zag fashion? 

Or make branches off of the main crack?

Let me know how you get on...

1 comment:

  1. I get to the part where I put in "./minecraft-pi" and it gives me the accompanying blunder message: "./minecraft-pi : can't execute double document" does anybody know what to do with that?

    ReplyDelete