Because the Pi version of minecraft has an api http://wiki.vg/Minecraft_Pi_Protocol
Also if you have younger kids check out https://github.com/scratch2mcpi/scratch2mcpi run a scratch extension on your pc and place blocks in minecraft on the Pi. It goes down well at our local coderdojo.