THREAD: Minecraft Coding Raspberry PI (Python)
  1. 05-23-2015, 06:57 PM
    748
    Posts
    2,155
    Reputation
    May 2014
    NextGenUpdate
    Hello NGU in this Tut i'm going to show you how to Code using Python for Minecraft on Raspberry PI

    Let's start from the Basics:

    Part 1.) How to post a message onto your screen
    Spoiler:
    from mcpi import minecraft

    mc = minecraft.Minecraft.create()

    mc.postToChat("Hello world")

    ------------------------------------------------------------------------------------------------------------------------------
    If you're entering commands directly into the Python window, just hit Enter after each line. If it's a file, save with Ctrl + S and run with F5. When your code runs, you should see your message on screen in the game.
    ------------------------------------------------------------------------------------------------------------------------------
    Images for Part 1.)
    Spoiler:
    You must login or register to view this content.You must login or register to view this content.

    ------------------------------------------------------------------------------------------------------------------------------
    Part 2.)Find your location.
    Spoiler:
    pos = mc.player.getPos()
    x, y, z = mc.player.getPos()


    Part 3.)How to Teleport
    Spoiler:
    x, y, z = mc.player.getPos()
    mc.player.setPos(x, y+100, z)

    Where it says "+100" you can edit it too Example: "-1337 or +420".
    And it should send you too where you set it too.

    Part 4.)Set Block
    Spoiler:
    x, y, z = mc.player.getPos()
    mc.setBlock(x+1, y, z, 1)

    Where it says "1" = Stone, other blocks you can try.
    Air: 0
    Grass: 2
    Dirt: 3
    ---------
    Now with the block in-sight Try changing it to something else:
    mc.setBlock(x+1, y, z, 2)

    Image for Part 4.)
    Spoiler:
    You must login or register to view this content.You must login or register to view this content.

    ------------------------------------------------------------------------------------------------------------------------------
    Part 5.)TNT
    Another interesting block is TNT! To place a normal TNT block use:
    Spoiler:
    tnt = 46
    mc.setBlock(x, y, z, tnt)


    Part 6.)However, this TNT block is fairly boring. Try applying data as 1:
    Spoiler:
    tnt = 46
    mc.setBlock(x, y, z, tnt, 1)


    Now try making a big cube of TNT blocks!
    Spoiler:
    tnt = 46
    mc.setBlocks(x+1, y+1, z+1, x+11, y+11, z+11, tnt, 1)


    You must login or register to view this content.

    Now there should be a big Block of TNT as shown above just simply left click on it too watch it Explode

    You must login or register to view this content.

    ------------------------------------------------------------------------------------------------------------------------------
    This is the end of SwarMzY's coding on Minecraft, Hope you enjoyed! i hope to do more tutorials in the near future. Winky Winky
    Regards, SwarMzY
    Enzo
    Last edited by WeHostModdedXP ; 05-24-2015 at 07:51 AM.

  2. The Following User Thanked WeHostModdedXP For This Useful Post:


  3. 05-23-2015, 07:00 PM
    CrEaTiiOn_420's Avatar
    CrEaTiiOn_420
    Can’t trickshot me!
    CrEaTiiOn_420's Avatar
    CrEaTiiOn_420
    Can’t trickshot me!
    392
    Posts
    3,875
    Reputation
    Nov 2012
    NextGenUpdate
    Originally Posted by SwarMzY View Post
    Hello NGU in this Tut i'm going to show you how to Code using Python for Minecraft on Raspberry PI

    Let's start from the Basics:

    Part 1.) How to post a message onto your screen
    Spoiler:
    from mcpi import minecraft

    mc = minecraft.Minecraft.create()

    mc.postToChat("Hello world")

    ------------------------------------------------------------------------------------------------------------------------------
    If you're entering commands directly into the Python window, just hit Enter after each line. If it's a file, save with Ctrl + S and run with F5. When your code runs, you should see your message on screen in the game.
    ------------------------------------------------------------------------------------------------------------------------------
    Images for Part 1.)
    Spoiler:
    You must login or register to view this content.You must login or register to view this content.

    ------------------------------------------------------------------------------------------------------------------------------
    Part 2.)Find your location.
    Spoiler:
    pos = mc.player.getPos()
    x, y, z = mc.player.getPos()


    Part 3.)How to Teleport
    Spoiler:
    x, y, z = mc.player.getPos()
    mc.player.setPos(x, y+100, z)

    Where it says "+100" you can edit it too Example: "-1337 or +420".
    And it should send you too where you set it too.

    Part 4.)Set Block
    Spoiler:
    x, y, z = mc.player.getPos()
    mc.setBlock(x+1, y, z, 1)

    Where it says "1" = Stone, other blocks you can try.
    Air: 0
    Grass: 2
    Dirt: 3
    ---------
    Now with the block in-sight Try changing it to something else:
    mc.setBlock(x+1, y, z, 2)

    Image for Part 4.)
    Spoiler:
    You must login or register to view this content.You must login or register to view this content.

    ------------------------------------------------------------------------------------------------------------------------------
    Part 5.)TNT
    Another interesting block is TNT! To place a normal TNT block use:
    Spoiler:
    tnt = 46
    mc.setBlock(x, y, z, tnt)


    Image for Part 5.)
    Spoiler:
    You must login or register to view this content.


    Part 6.)However, this TNT block is fairly boring. Try applying data as 1:
    Spoiler:
    tnt = 46
    mc.setBlock(x, y, z, tnt, 1)


    Now try making a big cube of TNT blocks!
    Spoiler:
    tnt = 46
    mc.setBlocks(x+1, y+1, z+1, x+11, y+11, z+11, tnt, 1)


    You must login or register to view this content.

    Now there should be a big Block of TNT as shown above just simply left click on it too watch it Explode

    You must login or register to view this content.

    ------------------------------------------------------------------------------------------------------------------------------
    This is the end of SwarMzY's coding on Minecraft, Hope you enjoyed!
    Regards, SwarMzY
    Enzo


    very good post man keep it up Winky Winky
  4. The Following User Thanked CrEaTiiOn_420 For This Useful Post:


  5. 05-23-2015, 07:01 PM
    748
    Posts
    2,155
    Reputation
    May 2014
    NextGenUpdate
    Originally Posted by 420 View Post
    very good post man keep it up Winky Winky


    Thank's Bro Smile