Ejemplo n.º 1
0
from mcpi_e.minecraft import Minecraft
from mcpi_e import block

serverAddress = "localhost"  # change to your minecraft server
playerName = "stoneskin2020"
pythonApiPort = 4711

mc = Minecraft.create(serverAddress, pythonApiPort, playerName)

pos = mc.player.getPos()
x = pos.x
y = pos.y
z = pos.z

blockTypeId = mc.getBlock(x, y, z)
if (blockTypeId == block.WATER.id):
    mc.postToChat("[" + playerName + "]: I am swimming!")
elif (blockTypeId == block.AIR.id):
    mc.postToChat("[" + playerName + "]: I am flying!")
else:
    mc.postToChat("[{}]: I am on block {}".format(playerName, blockTypeId))

if (blockTypeId == block.DIRT.id or blockTypeId == block.GRASS.id):
    mc.postToChat("I am on the ground.")

if (blockTypeId < 0 and blockTypeId > 252):
    print("It's not a valid blockId")
Ejemplo n.º 2
0
from mcpi_e.minecraft import Minecraft
from mcpi_e import block
from time import sleep
from random import *
from mcpi_e.logger import *

address = "192.168.1.155"  #if not pass address, it will be localhost
port = 471  #default port for RaspberryJuice plugin 4711
name = "stoneskin"

#mc = Minecraft.create()
mc = Minecraft.create(address, port, name)
debug("debug")
warn("warn")
log("log")

mc.settings.SHOW_DEBUG = False
print("Is show debug msg", mc.settings.SHOW_DEBUG)
print("Is show log msg", mc.settings.SHOW_Log)
print("system speed:", mc.settings.SYS_SPEED)
mc.settings.SYS_SPEED = mc.settings.Speed.FAST
(x, y, z) = pos = mc.player.getTilePos()
debug("this will not dispaly")
log(pos)
warn("warn")
Ejemplo n.º 3
0
                        (b * b)) * sqrt(1 - l) * sqrt(l) / (pi * b)
        r2 = r * r
        for x in range(-h, h + 1):
            for z in range(-h, h + 1):
                myr2 = x * x + z * z
                if myr2 <= r2:
                    if x == 0 and z == 0:
                        theta = 0
                    else:
                        theta = atan2(z, x)
                    yield (x, y, z, block, theta)


address = "server"
name = "stoneskin"
mc = Minecraft.create(address, 4712, name)

if len(sys.argv) >= 2:
    height = int(sys.argv[1])
else:
    height = 50

if len(sys.argv) >= 3:
    material = Block.byName(sys.argv[2])
else:
    material = block.GOLD_BLOCK

pos = mc.player.getPos()

for (x, y, z, block, theta) in egg(h=height, block=material):
    mc.setBlock(x + pos.x, y + pos.y, z + pos.z, block)
Ejemplo n.º 4
0
from mcpi_e.minecraft import Minecraft
from mcpi_e.block import *
#change to your mincraft server ip address,  default port 25565, if  you tset from your local it will be localhost
address = "127.0.1.1"  #change to your server address
port = 4711  #default port for RaspberryJuice plugin is 4711, it could be changed in plugins\RaspberryJuice\config.yml
playerName = "stoneskin"  # change to your username
mc = Minecraft.create(address, port, playerName)

(x, y, z) = pos = mc.player.getTilePos()
blockid = GOLD_BLOCK
l = 10
mc.setBlocks(x, y, z, x + l, y - 3, z + l, blockid)
# will print "methods setBlocks not allowed."