I am a beginner when it comes to Python, I am trying to learn it using the Minecraft API. I am trying to make a program that places a GoldBlock instead of every block I step on. This is the code that I have written:
Code: Select all
import minecraft.minecraft as minecraft
import minecraft.block as block
import time
mc = minecraft.Minecraft.create()
playerPosition = mc.player.getPos()
post = mc.postToChat
blockType = mc.getBlock(playerPosition.x, playerPosition.y -1, playerPosition.z)
if __name__ == "__main__":
while ('True'):
if not blockType == 9 or blockType == 0:
mc.setBlock(playerPosition.x, playerPosition.y -1, playerPosition.z,block.GOLD_BLOCK)
Code: Select all
while ('True'):
if not blockType == 9 or blockType == 0:
mc.setBlock(playerPosition.x, playerPosition.y -1, playerPosition.z,block.GOLD_BLOCK)
I really appreciate all of your help!