Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#Has the player moved more than 0.2 in any horizontal (x,z) direction
if ((movementX < -0.2) or (movementX > 0.2) or (movementZ < -0.2) or (movementZ > 0.2)):
#Project players direction forward to the next square
nextPlayerPos = playerPos
# keep adding the movement to the players location till the next block is found
while ((int(playerPos.x) == int(nextPlayerPos.x)) and (int(playerPos.z) == int(nextPlayerPos.z))):
nextPlayerPos = minecraft.Vec3(nextPlayerPos.x - movementX, nextPlayerPos.y, nextPlayerPos.z - movementZ)
#Is the block below the next player pos air, if so fill it in with DIAMOND
blockBelowPos = roundVec3(nextPlayerPos)
blockBelowPos.z = blockBelowPos.z - 1
blockBelowPos.y = blockBelowPos.y - 1
if mc.getBlock(blockBelowPos) == block.AIR:
mc.setBlock(blockBelowPos.x, blockBelowPos.y, blockBelowPos.z, block.DIAMOND_BLOCK)
#Store players last position
lastPlayerPos = playerPos
#Delay
time.sleep(0.01)
def main():
mc.postToChat("Funkcje w Minecrafcie") # wysłanie komunikatu do mc
plac(-80, -20, -80, 160)
mc.player.setPos(17, 17, 24)
uklad(block.DIAMOND_BLOCK)
trygon()
return 0
def main():
mc.postToChat("Funkcje w Minecrafcie") # wysłanie komunikatu do mc
plac(-80, -20, -80, 160)
mc.player.setPos(17, 17, 24)
uklad(block.DIAMOND_BLOCK)
trygon()
return 0
def drawClock(mc, clockCentre, radius, time):
blockType = block.DIAMOND_BLOCK
#draw the circle
drawCircle(mc, clockCentre.x, clockCentre.y, clockCentre.z, radius, blockType)
#draw hour hand
drawHourHand(mc, clockCentre, time.hour, time.minute, block.DIRT)
#draw minute hand
drawMinuteHand(mc, clockCentre, time.minute, block.STONE)
#draw second hand
drawSecondHand(mc, clockCentre, time.second, block.WOOD_PLANKS)
def main():
mc.postToChat("Funkcje w Minecrafcie") # wysłanie komunikatu do mc
plac(-80, -20, -80, 160)
mc.player.setPos(-8, 10, 26)
uklad(block.DIAMOND_BLOCK)
fun1()
fun2()
fun3()
return 0
#!/usr/bin/env python
# as shared on mcpipy.com
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
import server
# If you are running this script with the bukkit mod, then use a diamond block as the magic center block for teleporting
# comment/uncomment below as appropriate
magic_block = block.DIAMOND_BLOCK # for bukkit server
#magic_block = block.NETHER_REACTOR_CORE # for raspberry pi
if __name__ == "__main__": # The script
mc = minecraft.Minecraft.create(server.address)
loc = mc.player.getPos()
x = loc.x
y = loc.y - 1
z = loc.z
for z_z in range (int(z-1), int(z+2)):
for x_x in range(int(x-1), int(x+2)):
mc.setBlock(x_x,y,z_z, block.COBBLESTONE)
mc.setBlock(x_x,y+1,z_z, block.AIR)
mc.setBlock(x,y,z, magic_block)
# pobieramy ilość punktów w kwadracie
ileKw = int(raw_input("Podaj ilość losowanych punktów: "))
ileKo = 0 # ilość punktów w kole
wKwadrat = [] # pomocnicza lista punktów w kwadracie
wKolo = [] # pomocnicza lista punktów w kole
for i in range(ileKw):
blok = block.OBSIDIAN
x = round(random.uniform(-r, r))
y = round(random.uniform(-r, r))
z = round(random.uniform(-r, r))
wKwadrat.append((x, y, z))
print x, y, z
if abs(x)**2 + abs(z)**2 <= r**2:
blok = block.DIAMOND_BLOCK
ileKo += 1
wKolo.append((x, y, z))
mc.setBlock(x, y, z, blok)
mc.postToChat("W kole = " + str(ileKo) + " W Kwadracie = " + str(ileKw))
pi = 4 * ileKo / float(ileKw)
mc.postToChat("Pi w przyblizeniu: {:.10f}".format(pi))
mc.postToChat("Stan na kamieniu!")
while True:
poz = mc.player.getPos()
x, y, z = poz
if mc.getBlock(x, y - 1, z) == block.STONE.id:
for pkt in wKolo:
x, y, z = pkt
# pobieramy ilość punktów w kwadracie
ileKw = int(raw_input("Podaj ilość losowanych punktów: "))
ileKo = 0 # ilość punktów w kole
wKwadrat = [] # pomocnicza lista punktów w kwadracie
wKolo = [] # pomocnicza lista punktów w kole
for i in range(ileKw):
blok = block.OBSIDIAN
x = round(random.uniform(-r, r))
y = round(random.uniform(-r, r))
z = round(random.uniform(-r, r))
wKwadrat.append((x, y, z))
print x, y, z
if abs(x)**2 + abs(z)**2 <= r**2:
blok = block.DIAMOND_BLOCK
ileKo += 1
wKolo.append((x, y, z))
mc.setBlock(x, y, z, blok)
mc.postToChat("W kole = " + str(ileKo) + " W Kwadracie = " + str(ileKw))
pi = 4 * ileKo / float(ileKw)
mc.postToChat("Pi w przyblizeniu: {:.10f}".format(pi))
mc.postToChat("Stan na kamieniu!")
while True:
poz = mc.player.getPos()
x, y, z = poz
if mc.getBlock(x, y - 1, z) == block.STONE.id:
for pkt in wKolo:
x, y, z = pkt
mcDrawing.drawSphere(-15,15,-15,5,block.OBSIDIAN.id)
#face - solid triangle
faceVertices = []
faceVertices.append(minecraft.Vec3(0,0,0))
faceVertices.append(minecraft.Vec3(5,10,0))
faceVertices.append(minecraft.Vec3(10,0,0))
mcDrawing.drawFace(faceVertices, True, block.SNOW_BLOCK.id)
#face - wireframe square - using Points
faceVertices = Points()
faceVertices.add(0,0,5)
faceVertices.add(10,0,5)
faceVertices.add(10,10,5)
faceVertices.add(0,10,5)
mcDrawing.drawFace(faceVertices, False, block.DIAMOND_BLOCK.id)
#face - 5 sided shape
faceVertices = []
faceVertices.append(minecraft.Vec3(0,15,0))
faceVertices.append(minecraft.Vec3(5,15,5))
faceVertices.append(minecraft.Vec3(3,15,10))
faceVertices.append(minecraft.Vec3(-3,15,10))
faceVertices.append(minecraft.Vec3(-5,15,5))
mcDrawing.drawFace(faceVertices, True, block.GOLD_BLOCK.id)