Login using your own username and password Go

  • Slides: 7
Download presentation
Login using your own username and password Go to programming -> geany Enter the

Login using your own username and password Go to programming -> geany Enter the following program: from mcpi. minecraft import Minecraft mc = Minecraft. create() mc. post. To. Chat(“write your message here”) stone = 1 x, y, z = mc. player. get. Pos() mc. set. Blocks(x+1, y+1, z+1, x+11, y+11, z+11, stone) Open LX Terminal, enter these 2 commands su pi sudo minecraft-pi • Start a new game of mine craft. • Press the tab key to get your mouse out of the game • Go back to geany, save your program file under your username with the name mineraft. py • Run your program by clicking the button

Inputs • In the game of minecraft, what are the available inputs?

Inputs • In the game of minecraft, what are the available inputs?

Outputs • In minecraft, what are the outputs?

Outputs • In minecraft, what are the outputs?

Computer Systems • What inputs and outputs can you use with a computer system

Computer Systems • What inputs and outputs can you use with a computer system such as a raspberry pi? • Can these inputs and outputs be combined with the minecraft game?

Python input, Minecraft output • Try this … from mcpi. minecraft import Minecraft mc

Python input, Minecraft output • Try this … from mcpi. minecraft import Minecraft mc = Minecraft. create() name = raw_input(“What is your name? “) mc. post. To. Chat(“Hi ” + name)

LAPIS_LAZULI_ORE 21 API Blocks ============LAPIS_LAZULI_BLOCK 22 SANDSTONE 24 AIR 0 BED 26 STONE 1

LAPIS_LAZULI_ORE 21 API Blocks ============LAPIS_LAZULI_BLOCK 22 SANDSTONE 24 AIR 0 BED 26 STONE 1 COBWEB 30 GRASS 2 GRASS_TALL 31 DIRT 3 WOOL 35 COBBLESTONE 4 FLOWER_YELLOW 37 WOOD_PLANKS 5 FLOWER_CYAN 38 SAPLING 6 MUSHROOM_BROWN 39 BEDROCK 7 40 WATER_FLOWING 8 MUSHROOM_RED GOLD_BLOCK 41 WATER 8 42 WATER_STATIONARY 9 IRON_BLOCK What happens STONE_SLAB_DOUBLE 43 LAVA_FLOWING 10 STONE_SLAB 44 LAVA 10 if you change 45 LAVA_STATIONARY 11 BRICK_BLOCK this value? TNT 46 SAND 12 BOOKSHELF 47 GRAVEL 13 MOSS_STONE 48 GOLD_ORE 14 OBSIDIAN 49 IRON_ORE 15 TORCH 50 COAL_ORE 16 What is this “while FIRE 51 WOOD 17 True: ” doing? STAIRS_WOOD 53 LEAVES 18 CHEST 54 GLASS 20 SNOW 78 DIAMOND_ORE 56 ICE 79 DIAMOND_BLOCK 57 SNOW_BLOCK 80 CRAFTING_TABLE 58 CACTUS 81 FARMLAND 60 CLAY 82 FURNACE_INACTIVE 61 SUGAR_CANE 83 FURNACE_ACTIVE 62 FENCE 85 DOOR_WOOD 64 GLOWSTONE_BLOCK 89 LADDER 65 BEDROCK_INVISIBLE 95 STAIRS_COBBLESTONE 67 STONE_BRICK FENCE_GATE 107 98 DOOR_IRON 71 GLOWING_OBSIDIAN 246 GLASS_PANE 102 73 MELON NETHER_REACTOR_CORE 247 REDSTONE_ORE 103 Using Loops from mcpi. minecraft import Minecraft from time import sleep mc = Minecraft. create() Block_type = 38 while True: x, y, z = mc. player. get. Pos() mc. set. Block(x, y, z, block_type) sleep(0. 1)

Homework • Describe a way that you might modify the inputs and outputs of

Homework • Describe a way that you might modify the inputs and outputs of minecraft using Python to make it do something that’s new.