Esempio n. 1
2
def flatten(size=50):
    """_mcp: flatten world around me.
    change one layer of blocks below me to sandstone,
    clear everything above.
    """
    mc = Minecraft.create()
    pos = mc.player.getTilePos()
    s = int(size)
    mc.setBlocks(pos.x - s, pos.y - 1, pos.z - s,
        pos.x + s, pos.y - 1, pos.z + s, 24)
    mc.setBlocks(pos.x - s, pos.y, pos.z - s,
        pos.x + s, pos.y + 64, pos.z + s, 0)
Esempio n. 2
2
def buildHouse():
	
	from mcpi.minecraft import Minecraft
	mc = Minecraft.create()
	
	import random
	import time
	
	mc.setting("world_immutable", False)		### cannot break blocks

	### sets basic plain landscape

	mc.setBlocks(-127, -11, -127, 127, -11, 127, 2)
	mc.setBlocks(-127, -10, -127, 127, 100, 127, 0)


	### move to start location

	mc.player.setPos(-10, -3, 10)


	### build outer shell

	mc.setBlocks(5, -10, 5, 35, -5, 35, 4)
	mc.setBlocks(6, -9, 6, 34, -6, 34, 0)


	### nested for loops to build columns

	colx = list(range(8, 35, 3))
	coly = list(range(-9, -6, 1))
	colz = list(range(8, 35, 3))
	 
	for cy in coly:
		for cx in colx:
			for cz in colz:
				mc.setBlock(cx, cy, cz, 46,1) 


	### nested for loops to add glow block on top of column
	
	glowx = list(range(8, 35, 3))
	glowz = list(range(8, 35, 3))

	for glx in glowx:
		for glz in glowz:
			mc.setBlock(glx, -6, glz, 89)


	### entrance and steps

	mc.setBlocks(5, -10, 11, 5, -8, 12, 0)
	mc.setBlocks(5, -10, 11, 5, -10, 12, 109)


	### Generate available non column spaces for treasure to find

	xi=range(8,35)  	# all floor space inside the walls
	yi=range(8,35) 


	x=range(8,35,3) 	# floor spaces taken up by columns
	y=range(8,35,3) 

	floorSpace=[] 			# set up empty list for possible treasure spaces

	for ii in xi:
		for jj in yi:
			floorSpace.append([ii, -9, jj]) 	# add all spaces to dots list

	
	for i in x:
		for j in y:
			floorSpace.remove([i, -9, j]) 		# remove column coordinates

	
	### empty treasure loop

	global treasure
	treasure=[]
	
	qq = 0

	while qq < 10:								# repeat for ten random treasure cheats
		
		chest = random.choice(floorSpace)

		treasure.append(chest)					# add to treasure

		floorSpace.remove(chest)				# delete from floor space to avoid duplication

		
		for t in treasure:
			mc.setBlock((t),58)					# place treasure chests in building
			
		qq+=1
Esempio n. 3
1
def instruct():

	from mcpi.minecraft import Minecraft
	mc = Minecraft.create()

	import time

	time.sleep(5)

	mc.postToChat("Strike the green block to begin")
	time.sleep(1)
	mc.postToChat(" ")
	time.sleep(1)
	mc.postToChat("Find all the treasure as quickly as possible")
	time.sleep(1)
	mc.postToChat(" ")
	time.sleep(1)
	mc.postToChat("The strike the red block to stop the clock")
	time.sleep(1)
	mc.postToChat(" ")
	time.sleep(1)
	mc.postToChat("Treasure to find: " + str(len(treasure)))
	mc.postToChat(" ")

	mc.setBlock(-5, -10, 8, 35,5)		# green start block
	mc.setBlock(-5, -10, 12, 35,14)		# red finish block
	mc.setBlocks(-5, -10, 6,  -5, -6,  6, 89)
	mc.setBlocks(-5, -10, 14, -5, -6, 14, 89)
	mc.setBlocks(-5,  -6,  6, -5, -6, 14, 89)
Esempio n. 4
1
def blocky():
	
	from mcpi.minecraft import Minecraft
	mc = Minecraft.create()
	
	import time

	mc.postToChat("Blocks to find: " + str(len(treasure)))
	time.sleep(1)
	mc.postToChat("Go!!!!!!")
	
	
	while True:
		blockHits = mc.events.pollBlockHits()
		if blockHits:
				for blockHit in blockHits:
					x,y,z = blockHit.pos.x, blockHit.pos.y, blockHit.pos.z		# x,y,z = right click hit
										
				if [x,y,z] in treasure:
					treasure.remove([x,y,z])
					mc.setBlock(x, y, z, 0)
					
					if len(treasure) > 0:
						mc.postToChat("Blocks to find: " + str(len(treasure)))
					else:
						mc.postToChat("You have found all the treasure - find the exit")
Esempio n. 5
1
def instruct(): ### next enter name and write time to txt file to keep hire score table
	
	from mcpi.minecraft import Minecraft
	mc = Minecraft.create()
	
	import time
	
	time.sleep(5)
	
	mc.postToChat("Strike the green block to begin")
	time.sleep(1)
	mc.postToChat(" ")
	time.sleep(1)
	mc.postToChat("Find all the treasure as quickly as possible")
	time.sleep(1)
	mc.postToChat(" ")
	time.sleep(1)
	mc.postToChat("The strike the red block to stop the clock")
	time.sleep(1)
	mc.postToChat(" ")
	time.sleep(1)
	mc.postToChat("Treasure to find: " + str(len(treasure)))
	mc.postToChat(" ")
	
	mc.setBlock(-5, -10, 8, 35,5)		# green start block
	mc.setBlock(-5, -10, 12, 35,14)		# red finish block
Esempio n. 6
1
def cube(size=5, typeId=1):
    "_mcp: create a cube"
    mc = Minecraft.create()
    pos = mc.player.getTilePos()
    s = int(size)
    t = int(typeId)
    mc.setBlocks(pos.x + 1, pos.y, pos.z,
        pos.x + s, pos.y + s - 1, pos.z + s - 1, t)
Esempio n. 7
1
    def __init__(self, pos, width, height, length):
        self.mc = Minecraft.create()
        
        self.pos = pos
        self.width = width
        self.height = height
        self.length = length

        self._draw()
 def __init__(self): #??? Uses mc instance.
     # create minecraft object
     print ("\nFUNCTION: MinecraftGenerator __init__")
     print ("Opening connection to Minecraft Pi")
     try:
         self.mc=Minecraft.create()
     except:
         #print("There was an error connecting to Minecraft.")
         sys.exit("There was an error connecting to Minecraft.")
Esempio n. 9
1
def hunt():
	
	from mcpi.minecraft import Minecraft
	mc = Minecraft.create()
	
	import time
		
	timer = 0
	
	while True:		
	
		blockHits = mc.events.pollBlockHits()
		if blockHits:
			
			for blockHit in blockHits:
				x,y,z = blockHit.pos.x, blockHit.pos.y, blockHit.pos.z		# x,y,z = right click hit
				
			if [x,y,z] == [-5, -10, 8] and mc.getBlock(-5, -10, 8) == 35:	#check for green block strike
				mc.setBlock(-5, -10, 8, 0)									#red block still in place
				mc.postToChat("Go!!!!!!")
				mc.postToChat(" ")
				
				
			if [x,y,z] == [-5, -10, 12] and mc.getBlock(-5, -10, 12) == 35 and mc.getBlock(-5, -10, 8) == 0 and len(treasure) == 0:
				mc.setBlock(-5, -10, 12, 0)
				mc.postToChat("Mission Complete!!!!")					#if red block hit and green hit and no treasure left
				mc.postToChat(" ")
				mc.postToChat("Your score is " + str(5000 - timer))
				break
				
				
			if mc.getBlock(-5, -10, 8) == 0:
									
				if [x,y,z] in treasure:
					treasure.remove([x,y,z])
					mc.setBlock(x, y, z, 0)
					
					if len(treasure) > 0:
						mc.postToChat("Blocks to find: " + str(len(treasure)))
						
					elif len(treasure) == 0:
						mc.postToChat("You have found all the treaure")
						mc.postToChat(" ")
						mc.postToChat("Head for the exit!!")
						
										
		if mc.getBlock(-5, -10, 8) == 0 and mc.getBlock(-5, -10, 12) == 35:
			timer +=1
			time.sleep(0.05)
Esempio n. 10
1
def falling_block():
    """_mcp
    A gold block is falling from the sky
    """
    mc = Minecraft.create()
    pos = mc.player.getTilePos()
    y = pos.y + 40
    for i in range(40):
        time.sleep(0.5)
        # if the block below is anything other than air
        # stop falling
        if mc.getBlock(pos.x, y-i-1, pos.z) != 0:
            break
        mc.setBlock(pos.x, y-i, pos.z, 0)
        mc.setBlock(pos.x, y-i-1, pos.z, 41)
Esempio n. 11
1
def rainbow():
    """_mcp
    create a rainbow.
    The code is from:
    http://dev.bukkit.org/bukkit-plugins/raspberryjuice/
    """
    mc = Minecraft.create()
    pos = mc.player.getTilePos()
    colors = [14, 1, 4, 5, 3, 11, 10]
    height = 60
    mc.setBlocks(pos.x-64,0,0,pos.x+64,height + len(colors),0,0)
    for x in range(0, 128):
        for colourindex in range(0, len(colors)):
            y = sin((x / 128.0) * pi) * height + colourindex
            mc.setBlock(pos.x+x - 64, pos.y+y, pos.z,
                35, colors[len(colors) - 1 - colourindex])
Esempio n. 12
1
def Image(ImageName,X0,Y0,Z0):
    from PIL import Image
    import math
    mc = Minecraft.create()
    white = [221,221,221,0]#rgb, id
    orange = [219,125,62,1]#rgb, id
    magneta = [179,80,188,2]#rgb, id
    lightBlue = [107,138,201,3]#rgb, id
    yellow = [177,166,39,4]#rgb, id
    lime = [65,174,56,5]#rgb, id
    pink = [208,132,153,6]#rgb, id
    gray = [64,64,64,7]#rgb, id
    lightGray = [154,161,161,8]#rgb, id
    cyan = [46,110,137,9]#rgb, id
    purple = [126,61,181,10]#rgb, id
    blue = [46,56,141,11]#rgb, id
    brown = [79,50,31,12]#rgb, id
    green = [53,70,27,13]#rgb, id
    red = [150,52,48,14]#rgb, id
    black = [25,22,22,15]#rgb, id
    colors = [white,orange,magneta,lightBlue,yellow,lime,pink,gray,lightGray,cyan,purple,blue,brown,green,red,black]
    #enter your data here:
    img = Image.open(ImageName)#image
    #place
    if img.width*img.height > 500*500:
        mc.postToChat("the Image is too big!")
    else:
        data = img.load()
        x = 0
        while x < img.width:
            y = 0
            while y < img.height:
                res = 255*3
                pixel = data[x,y]
                for color in colors:
                    r = pixel[0]-color[0]
                    g = pixel[1]-color[1]
                    b = pixel[2]-color[2]
                    if math.fabs(r)+math.fabs(g)+math.fabs(b) < res:
                        res = math.fabs(r)+math.fabs(g)+math.fabs(b)
                        block = 35,color[3]
                mc.setBlock(X0+x,Y0,Z0+y,block)
                y = y + 1
            mc.postToChat(str(int(x / img.width * 100))+"%")
            x = x + 1
        mc.postToChat("done.")
Esempio n. 13
1
def banner(txt, size=24, type1=41, type2=0):
    """_mcp
    Display a word banner made of blocks
    must have word2banner.py and word2banner.ini in the 
    same directory.
    see word2banner at github.com/wensheng/word2banner
    """
    mc = Minecraft.create()
    pos = mc.player.getTilePos()
    import pplugins.word2banner
    size = int(size)
    type1 = int(type1)
    type2 = int(type2)
    w2b = pplugins.word2banner.word2banner(txt, 1, size)
    y = pos.y + size
    for r in w2b:
        z = pos.z + 1
        for c in r:
            if c:
                mc.setBlock(pos.x, y, z, type1)
            else:
                mc.setBlock(pos.x, y, z, type2)
            z += 1
        y -= 1
Esempio n. 14
1
def buttonredpressed(channel, event):
	mcr = Minecraft.create()
	blockinredcol = mcr.getBlock(pos.x+1, pos.y, pos.z + 10)
	if blockinredcol == block.WOOL.id:
		mc.postToChat("Excellent!!")
		mcr.setBlock(pos.x+1, pos.y, pos.z + 10,block.WOOL.id,0)
Esempio n. 15
1
x180 = mulMat(x90,x90)

if __name__ == "__main__":
    def copy(v,airOnly=False):
        b = mc.getBlockWithNBT(v)
        if airOnly and b.id != block.AIR.id:
            return
        v1 = addVec(v,(0.5,0.5,0.5))
        for t in transforms:
            mc.setBlockWithNBT(t(v1),b)

    def err():
        mc.postToChat("Invalid symmetry specification. See symmetry.py comments.")
        exit()

    mc = Minecraft()

    playerPos = mc.player.getPos()

    matrices = set()
    translations = []

    if len(sys.argv) <= 1:
        matrices.add(xn)
        matrices.add(xe)

    i = 1
    while i < len(sys.argv):
        opt = sys.argv[i]
        i += 1
        if opt == 't':
Esempio n. 16
1
from mcpi.minecraft import Minecraft #carga las funciones del API

mc = Minecraft.create() #crea la conexion con Minecraft

mc.postToChat("Hola, ya estoy dentro")  #escribe en la barra de chat


Esempio n. 17
1
def buttongreenpressed(channel, event):
    mcg = Minecraft.create()
    blockingreencol = mcg.getBlock(pos.x-1, pos.y, pos.z + 10)
    if blockingreencol == block.WOOL.id:
	    mc.postToChat("Well Done!")
	    mcg.setBlock(pos.x-1, pos.y, pos.z + 10,block.WOOL.id,0)
Esempio n. 18
1
from mcpi.minecraft import Minecraft
mc = Minecraft.create('192.168.0.4')
userName = input('What is your Minecraft username?')
mc.postToChat(userName + ': Hello')
Esempio n. 19
1
#!/usr/bin/env python3
#
# Import needed libraries
from mcpi.minecraft import Minecraft
import mcpi.block as block
mc = Minecraft.create()  # Connect to Minecraft, running on the local PC
pos = mc.player.getPos() # Get the player position
x = pos.x # Assign the value of the x coordinate to x
y = pos.y # Assign the value of the y coordinate to y
z = pos.z # Assing the value of the x coordinate to z

# Set the block where the player is to be Spruce 
mc.setBlock(x, y, z, block.WOOD.id, 1)
Esempio n. 20
1
from mcpi.minecraft import Minecraft
from time import sleep
import server
mc = Minecraft.create(server.address)

flower = 38

while True:
    x, y, z = mc.player.getPos()
    mc.setBlock(x, y, z, flower)
    sleep(0.1)
Esempio n. 21
1
    def run(self):
        #open the file
        self.running = True
        self.stopped = False

        try:
            #open astro pi data file
            apr = AstroPiDataReader(self.filename)
            self.apr = apr
            #are there any rows?
            if apr.rowcount > 0:
                
                #create connection to minecraft
                mc = Minecraft.create()

                mc.postToChat("Playback {} Started".format(self.filename))

                #find the position of where to put the ISS tower display
                pos = mc.player.getTilePos()
                pos.z -= 10
                pos.y = mc.getHeight(pos.x, pos.z)

                try:
                    #create the iss tower display
                    isstowerdisplay = ISSTowerMinecraftDisplay(mc, pos)

                    #loop until its stopped
                    found_row = True
                    while self.stopped == False and found_row == True:
                        #get the time started
                        real_time_start = time()
                        last_row_time = apr.get_time()
                        
                        #update the ISS dispay with the data
                        isstowerdisplay.update(
                            apr.get_time(),
                            apr.get_cpu_temperature(),
                            apr.get_temperature(),
                            apr.get_humidity(),
                            apr.get_pressure(),
                            apr.get_orientation(),
                            apr.get_joystick())
                        
                        #move onto the next row
                        found_row = apr.next()

                        #wait until the next row time
                        if found_row:
                            #wait until the time in the real world is greater than the time between the rows
                            while (time() - real_time_start) < ((apr.get_time() - last_row_time) / self.speed) :
                                sleep(0.001)
                finally:
                    isstowerdisplay.clear()
                    mc.postToChat("Playback {} finished".format(self.filename))
                    
            else:
                print("Error - {} contained no data".format(self.filename))

        #catch failed to open file error
        except IOError:
            print("Failed to open file '{}'.".format(self.filename))
            print(sys.exc_info()[1])

        #catch any other error
        except:
            print(sys.exc_info()[0])
            print(sys.exc_info()[1])
                        
        finally:
            self.running = False
            self.stopped = True
Esempio n. 22
1
def buttonyellowpressed(channel, event):
	mcy = Minecraft.create()
	blockinyellowcol = mcy.getBlock(pos.x, pos.y, pos.z + 10)
	if blockinyellowcol == block.WOOL.id:
		mc.postToChat("You're doing great!")
		mcy.setBlock(pos.x, pos.y, pos.z + 10,block.WOOL.id,0)
Esempio n. 23
1
from mcpi.minecraft import Minecraft #mcpi.minecraft api에서 Minecraft를 임포트합니다. 관련 함수를 사용할 수 있게됩니다.
import math #math 관련 함수를 사용할 수 있게 임포트합니다.
import time #time 관련 함수를 사용할 수 있게 임포트합니다.
import random #time 관련 함수를 사용할 수 있게 임포트합니다.
mc = Minecraft.create() #Minecraft의 create 함수를 호출하고 결과를 mc 변수에 담습니다.

destX = random.randint(-127, 127) #-127에서 127사이의 정수를 랜덤으로 뽑아  destX 변수에 담습니다.
destZ = random.randint(-127, 127) #-127에서 127사이의 정수를 랜덤으로 뽑아  destZ 변수에 담습니다.
destY = mc.getHeight(destX, destZ) #destX와 destZ를 인자로 mc.getHeight 함수를 호출합니다. 그 결과값을 destY에 담습니다.

print(destX, destY, destZ) #위의 변수들을 출력합니다.

block = 57 #block 변수에 57숫자를 저장합니다.
mc.setBlock(destX, destY, destZ, block) #mc.setBlock으로 destX, destY, destZ, block 변수들을 인자로 넘기고 블록을 셋팅합니다.
mc.postToChat("Block set") #mc.postToChat함수로 "Block set"을 마인크래프트로 채팅합니다.

while True: #다음 코드를 영원히 반복합니다.
    pos = mc.player.getPos() #pos변수에 mc.player.getPos() 리턴값, 플레이어의 위치를 저장합니다.
    distance = math.sqrt((pos.x - destX) ** 2 + (pos.z - destZ) ** 2)
    #pos.x에서 destX만큼을 빼고 2을 재곱한뒤 pos.z에서 destZ를 빼고 2제곱한 만큼의 값을 더한뒤 그의 제곱근을 구해 distance변수에 담습니다.

    if distance == 0: #distance가 0이 되면 반복문에서 빠져나옵니다.
        break

    if distance > 100: #distance가 100이상이 되면 mc.postToChat로 다음을 출력합니다. ("Freezing")
        mc.postToChat("Freezing")
    elif distance > 50: #distance가 50이상이 되면 mc.postToChat를 다음을 출력합니다. ("Cold")
        mc.postToChat("Cold")
    elif distance > 25: #distance가 25이상이 되면 mc.postToChat를 다음을 출력합니다. ("Warm")
        mc.postToChat("Warm")
    elif distance > 12: #distance가 12이상이 되면 mc.postToChat를 다음을 출력합니다. ("Boiling")
Esempio n. 24
0
from mcpi.minecraft import Minecraft
omega=Minecraft.create()

x,y,z=omega.player.getTilePos()

w=10
h=8
l=20

omega.setBlocks(x,y,z, x+w,y+h,z+l, 7)
Esempio n. 25
0
from mcpi.minecraft import Minecraft
mc = Minecraft.create()  # подключаемся к серверу

# координаты
x = 100
y = 200
z = 100

mc.player.setPos(x, y, z)
Esempio n. 26
0

class house():
    def __init__(self, data):
        self.data = data

    def buildhouse(self):
        x, y, z, L, W, H, M, roof, floor = self.data
        mc.setBlocks(x, y, z, x + 10, y + 6, z + 10, 220)
        mc.setBlocks(x + 1, y + 1, z + 1, x + 9, y + 5, z + 9, 0)  # 挖空
        mc.setBlocks(x + 5, y + 1, z, x + 5, y + 3, z + 1, 0)  # 门
        mc.setBlocks(x + 8, y + 2, z + 2, x + 10, y + 4, z + 4,
                     block.GLASS.id)  # 窗


mc = Minecraft.create("47.100.46.95", 4782)
pos = mc.player.getTilePos()


def syfhouse():
    reader = csv.reader(open('team2_clan.csv'))
    data = []
    for r in reader:
        if r[0] == 'clancenter':
            posx = int(r[1])
            posy = int(r[2])
            posz = int(r[3])
        if r[0] == 'syf':
            posx += int(r[1])
            posy += int(r[2])
            posz += int(r[3])
Esempio n. 27
0
def init():
    ip = "192.168.7.226"
    mc = Minecraft.create(ip, 4711)
    mc.setting("world_immutable", True)
    #x, y, z = mc.player.getPos()
    return mc
Esempio n. 28
0
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 22 09:43:53 2018

@author: NTPU
"""

from mcpi.minecraft import Minecraft

miscc123 = Minecraft.create()
while True:
    hits = miscc123.events.pollProjectileHits()
    if len(hits) > 0:
        h = hits[0]
        x, y, z = h.pos.x, h.pos.y, h.pos.z
        miscc123.createExplosion(x, y, z, 150)
Esempio n. 29
0
def init():
    mc = Minecraft.create("192.168.1.13", 4711)
    x, y, z = mc.player.getPos()
    return mc
Esempio n. 30
0
# -*- coding: utf-8 -*-
"""
Created on Mon Aug  3 10:54:44 2020

@author: SCE
"""

from mcpi.minecraft import Minecraft
import time
mc = Minecraft.create()
x, y, z = mc.player.getTilePos()
time.sleep(5)
mc.setBlock(x, y, z, 56)
mc.setBlock(x, y + 1, z, 56)
mc.setBlock(x, y + 2, z, 56)
mc.setBlock(x, y + 3, z, 56)
mc.setBlock(x, y + 4, z, 56)
mc.setBlock(x, y + 5, z, 56)
mc.setBlock(x, y + 6, z, 56)
mc.setBlock(x, y + 7, z, 56)
mc.setBlock(x, y + 8, z, 56)
mc.setBlock(x, y + 9, z, 56)
Esempio n. 31
0
# -*- coding: utf-8 -*-
"""
Created on Tue Feb  2 14:46:49 2021

@author: USER
"""
from mcpi.minecraft import Minecraft as mcs
mc = mcs.create()
while True:
    try:
        num = int(input("What do you want?"))
        break
    except:
        print("Error")
x, y, z = mc.player.getTilePos()
mc.setBlock(x, y, z, num)
Esempio n. 32
0
def buttonbluepressed(channel, event):
	mcb = Minecraft.create()
	blockinbluecol = mcb.getBlock(pos.x+2, pos.y, pos.z + 10)
	if blockinbluecol == block.WOOL.id:
		mc.postToChat("Super work!")
		mcb.setBlock(pos.x+2, pos.y, pos.z + 10,block.WOOL.id,0)
from mcpi.minecraft import Minecraft as M
mc = M.create()

playerPos = mc.player.getTilePos()
x = playerPos.x
y = playerPos.y
z = playerPos.z

print("플레이어의 현재 x 좌표:", x)
print("플레이어의 현재 y 좌표:", y)
print("플레이어의 현재 z 좌표:", z)

mc.player.setTilePos(10, 110, 12)
Esempio n. 34
0
from mcpi.minecraft import Minecraft

mc = Minecraft.create("10.183.3.67", 4711)

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

x = x + 1

mc.setBlocks(x, y, z - 1, x + 15, y + 15, z + 1, 0)
mc.setBlock(x, y, z, 1)
mc.setBlock(x + 1, y + 1, z, 2)
mc.setBlock(x + 2, y + 2, z, 3)
mc.setBlock(x + 3, y + 3, z, 4)
mc.setBlock(x + 4, y + 4, z, 5)
mc.setBlock(x + 5, y + 5, z, 7)
mc.setBlock(x + 6, y + 6, z, 14)
mc.setBlock(x + 7, y + 7, z, 15)
mc.setBlock(x + 8, y + 8, z, 16)
mc.setBlock(x + 9, y + 9, z, 17, 0)
mc.setBlock(x + 10, y + 10, z, 17, 1)
mc.setBlock(x + 11, y + 11, z, 17, 2)
mc.setBlock(x + 12, y + 12, z, 18, 0)
mc.setBlock(x + 13, y + 13, z, 18, 1)
mc.setBlock(x + 14, y + 14, z, 18, 2)

mc.postToChat("StariwayToHeaven")
Esempio n. 35
0
 def __init__(self):
     self.sonar_map = []
     self.mc = Minecraft.create()
Esempio n. 36
0
#-*-coding=cp949
from mcpi.minecraft import Minecraft
logan = Minecraft.create()
import time

pos = logan.player.getPos()
x = pos.x
y = pos.y
z = pos.z
#===============================================================================
from random import *

i = randint(-128, 128)
x = i
i = randint(1, 64)
y = i
i = randint(-128, 128)
z = i
logan.setBlock(x, y, z, 11)

#===============================================================================

#===============================================================================
# try:
#     x=int(input("input your x_number :"))
#     y=int(input("input your y_number :"))
#     print(x/y)
# except:
#     print("error")
#
#
Esempio n. 37
0
from random import * 
from mcpi.minecraft import Minecraft 
from mcpi import block 

import time
import sys
sys.setrecursionlimit(5000)
mc = Minecraft.create("localhost",25565) 
ids = mc.getPlayerEntityIds() 


class Maker():
    a,b,c = mc.entity.getTilePos(ids[0]) 
    print(a,b,c)
    def __init__(self,mwx,mwy,mwz): 
        self.mwx= mwx 
        self.mwy= mwy 
        self.mwz = mwz 
        self.feld=[]
        self.glass_house()
    def lab(self,dire,x,y,d,dires,n): 
            if x>= n-1 or y>= n-1 or y<=0 or x<=0: 
                return 
            count = -4 
            if self.feld [x][y]==0: 
                count =0 
            if self.feld[x+1][y]==0: 
                count+=1 
            if self.feld [x-1][y]==0: 
                count+=1 
            if self.feld[x][y+1]==0: 
Esempio n. 38
0
from mcpi.minecraft import Minecraft
from time import sleep

mc = Minecraft.create("192.168.1.113")

class mic:

    x=0
    y=0
    z=0
    u=1

    def playerid(self,n):
        self.u=mc.getPlayerEntityId(n)
        print self.u 
    
    def playerpos(self):
        x,y,z = mc.entity.getPos(self.u)
        print x,y,z
        
    def pos(self,x,y,z):
        self.x=x
        self.y=y
        self.z=z
        
    def setfloor(self,item,width,deep):
        for erf in range(0,width):
            for wdz in range(0,deep):
                print erf,wdz
                mc.setBlock(self.x+erf,self.y,self.z+wdz, item)
Esempio n. 39
0
from mcpi.minecraft import Minecraft
import mcpi.block as block
mc = Minecraft.create("192.168.1.6") # add server ip
import time
players = mc.getPlayerEntityIds()
counter = -500
x = 60
y= 60
cubesize = 5
airsize = cubesize -1
for i in players:
  mc.entity.setPos(i,x,y, counter)
  p = mc.entity.getPos(i)
  
  print(i)
  mc.setBlocks(p.x-cubesize,p.y-cubesize,p.z-cubesize,p.x+cubesize,p.y+cubesize,p.z+cubesize, block.OBSIDIAN.id)
  mc.setBlocks(p.x-airsize,p.y-airsize,p.z-airsize,p.x+airsize,p.y+airsize,p.z+airsize, block.AIR.id)
  time.sleep(1)
  mc.postToChat("lol")
  mc.entity.setPos(i,x,y,counter)

  counter =+ 20

mc.postToChat("you need to teleport out")
Esempio n. 40
0
def clear_by_player(size):
    mc = Minecraft.create()
    x,y,z = mc.player.getPos()
    clear_region(x,y,z,size)    
Esempio n. 41
0
from mcpi.minecraft import Minecraft
import time
l = ''



n = (input('what is your minecraft username? >'))
k = 4


b = 1
while True:

     mc = Minecraft.create()

     i = (input('>'))

     c = (i)

     time.sleep(3)

     mc.postToChat(c)

     mca = Minecraft.create()

     inp = (input('>'))

     ca = (inp)

     time.sleep(3)
Esempio n. 42
0
def clear_region(x,y,z, size):
    '''will clear a cube with sides = size'''
    mc = Minecraft.create()
    mc.setBlocks(x-size/2,y-size/2, z-size/2, x+size/2, y+size/2, z+size/2, 0)
Esempio n. 43
0
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 21 10:14:24 2018

@author: NTPU
"""

import time
from mcpi.minecraft import Minecraft
tricia = Minecraft.create()

x, y, z = tricia.player.getTilePos()
#tricia.player.setPos(x+0.5,y,

width
Esempio n. 44
0
def blk():
    "_mcp: place 10 blocks of diamond"
    mc = Minecraft.create()
    pos = mc.player.getTilePos()
    for i in range(10):
        mc.setBlock(pos.x + 1, pos.y + i, pos.z, 57)
Esempio n. 45
0
# Code by CW Coleman
# Base project format.
# 127.0.0.1 is locahost (the computer you are working on)
from mcpi.minecraft import Minecraft
from mcpi import block
from time import sleep

mc = Minecraft.create("127.0.0.1", 4711)
# This sets the x,y and z location to set blocks.
x, y, z = mc.player.getPos()

# Clear with ait (air = 0)
air = 0
mc.setBlocks(x - 10, y, z - 10, x + 10, y + 20, z + 10, air)
# b is a variable for the type of block
# create single blocks
b = 1
mc.setBlock(x, y, z + 1, b)
mc.setBlock(x, y + 2, z + 1, b + 1)
mc.setBlock(x, y + 4, z + 1, b + 2)
# Create multiple blocks .
# Notice 'w = 35,2' .  This is wool.
b = 35, 2
mc.setBlocks(x, y + 5, z, x + 5, y + 20, z + 5, b)

# multiple line comment
"""
AIR                   0
STONE                 1
GRASS                 2
DIRT                  3
Esempio n. 46
0
from mcpi.minecraft import Minecraft
mc = Minecraft.create("smalldell1")
valid = True

x = int(input("Enter x: "))
y = int(input("Enter y: "))
z = int(input("Enter z: "))

if not -127 < x < 127:
    valid = False

# Check if y is not between -63 and 63

# Check if z is not between -127 and 127

if valid:
    mc.player.setPos(x, y, z)
else:
    mc.postToChat("Please enter a valid location")

# %%
count = 1
while count <= 5:
    print(count)
    count += 1
print("Loop finished")

# %%
import random
from mcpi.minecraft import Minecraft
mc = Minecraft.create("smalldell1")
Esempio n. 47
0
def init():
    mc = Minecraft.create("127.0.0.1", 4711)
    x, y, z = mc.player.getPos()
    return mc
Esempio n. 48
0
def hi():
    "_mcp: just saying hello"
    mc = Minecraft.create()
    mc.postToChat("Hello!")
Esempio n. 49
0
def chat(msg="Whaaat?!"):
    mc = Minecraft.create()
    mc.postToChat(msg)
Esempio n. 50
0
from mcpi.minecraft import Minecraft, ChatEvent
from mcpi.minecraftstuff import MinecraftDrawing, MinecraftTurtle
from mcpi import block, entity

name = "JeremyTsui"
# connect to minecraft
address = "localhost"
mc = Minecraft.create(address)
md = MinecraftDrawing(mc)
turtle = MinecraftTurtle(mc)

# get the x,y,z (position)
entity_id = mc.getPlayerEntityId(name)
position = mc.entity.getPos(entity_id)
x, y, z = int(position.x), int(position.y), int(position.z)

ada = MinecraftTurtle(mc)
ada.setposition(x, y, z)
Esempio n. 51
0
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 11:26:07 2018

@author: NTPU
"""
import random
from mcpi.minecraft import Minecraft
thomas = Minecraft.create()
x,y,z=thomas.player.getTilePos()
for i in range(20):
    r=random.randrange(1,9)
    c=random.randrange(1,16)
    l=random.randrange(2,16)
    if r==1:
        thomas.setBlocks(x,y,z,x+4,y,z,46)
    if r==2:
        thomas.setBlocks(x,y,z,x-4,y,z,46)
    if r==3:
        thomas.setBlocks(x,y,z,x,y,z+4,46)
    if r==4:
        thomas.setBlocks(x,y,z,x,y,z-4,46)
    if r==5:
        thomas.setBlocks(x,y,z,x,y+1,z,46)
    if r==5:
        thomas.setBlocks(x,y,z,x,y-1,z,46)
Esempio n. 52
0
def init():
    mc = Minecraft.create("127.0.0.1", 4711)
    mc.setting("world_immutable", True)
    #x, y, z = mc.player.getPos()
    return mc
Esempio n. 53
0
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 11:36:37 2018

@author: Sam
"""
import random
from mcpi.minecraft import Minecraft
sam = Minecraft.create()

x, y, z = sam.player.getTilePos()

for i in range(500):
    l = randrange(2, 16)
    r = randrange(1, 9)
    c = randrange(1, 16)

    if r == 1:
        sam.setBlocks(x, y, z, x + 4, y, z, 35, c)
        x = x + 4
    elif r == 2:
        sam.setBlocks(x, y, z, x - 4, y, z, 35, c)
        x = x - 4
    elif r == 3:
        sam.setBlocks(x, y, z, x, y, z + 4, 35, c)
        z = z + 4
    elif r == 4:
        sam.setBlocks(x, y, z, x, y, z - 4, 35, c)
        z = z - 4
    elif r == 5:
        sam.setBlocks(x, y, z, x, y + 4, z, 35, c)
Esempio n. 54
0
# coding: utf-8

# In[ ]:

from mcpi.minecraft import Minecraft
import time

ip = "192.168.1.12"
name = "kiki543838"

mc = Minecraft.create('192.168.1.12')

for x in range(0, 5):
    mc.postToChat('Hello')
    time.sleep(1)
Esempio n. 55
0
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 22 15:40:19 2018

@author: NTPU
"""

from mcpi.minecraft import Minecraft
Hank=Minecraft.create()

x,y,z=Hank.player.getTilePos()

Hank.setblocks(x-1,y+3,z-1,x+1,y+5,z+1,161)
Hank.setBlock(x,y,z,x,y+4,z,17)
Esempio n. 56
0
from mcpi.minecraft import Minecraft
from lekcje.helpers import clear_world
mc = Minecraft.create("minecraft-py.lasyk.info", 4711)



clear_world(mc)

mc.player.setPos(0, 100, 0)
Esempio n. 57
0
def specified_pos():
    while True:
        for event in world.events.pollBlockHits():
            return event.pos


def get_args():
    parser = ArgumentParser("image2blocks")
    parser.add_argument("image", help="250 <= height && 4 >= width / height")
    return parser.parse_args()


def main():
    args = get_args()
    img = Image.open(args.image).convert("RGB")
    img.thumbnail((1000, 191))
    print("Please specify a block ...")
    pos = specified_pos()
    # pos = Vec3(0, 0, 0)
    world.postToChat("pos:{} size:{}".format(pos, img.size))
    with open("1.8.8.json") as file:
        blocks = dict(map(desirialize, load(file)))
    similar_blocks = map(blocks.__getitem__, quantized(img, palette(list(blocks.keys()))))
    for vec, block in reversed(list(zip(drawing_area(pos, img), similar_blocks))):
        world.setBlock(vec, block)


if __name__ == "__main__":
    world = Minecraft.create()
    main()
from mcpi.minecraft import Minecraft
import time
import random
mc = Minecraft.create()

while True:
    chat = ["Message 1", "Message 2", "Message 3"]
    thing = random.randint (0,2)
    mc.postToChat (chat[thing])
    time.sleep(3)
Esempio n. 59
-7
 def __init__(self, attribs):
     self.server_address = attribs["server_address"]
     self.server_port = attribs.get("server_port", 4711)
     self.coords_x = attribs["coords_x"]
     self.coords_y = attribs["coords_y"]
     self.coords_z = attribs["coords_z"]
     self.world_connection = Minecraft.create(self.server_address, self.server_port)
Esempio n. 60
-14
import config
import platform
from mcpi.minecraft import Minecraft

mc = Minecraft.create(config.server_address)

mc.postToChat("Hello " + platform.platform())