Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
mc = minecraft.Minecraft.create(server.address)
# an abbrieviated flatmap
# mc.setBlocks(-50,-10,-50,50,10,50,block.AIR.id)
# mc.setBlocks(-50,0,-50,50,-10,50,block.SANDSTONE.id)
# The original flatmap
mc.setBlocks(-128,0,-128,128,64,128,0)
mc.setBlocks(-128,0,-128,128,-64,128,block.SANDSTONE.id)
# exit()
mc.postToChat("Hello you have successfully ran Rail Gen :).")
# create the station
mc.setBlock(1,3,0,block.GLOWSTONE_BLOCK.id)
mc.setBlock(0,0,0,block.STONE_SLAB.id)
mc.setBlock(-1,1,0,block.DOOR_WOOD.id,0)
mc.setBlock(-1,2,0,block.DOOR_WOOD.id,8)
mc.setBlock(0,1,1,block.STONE.id)
mc.setBlock(0,2,1,block.STONE.id)
mc.setBlock(0,1,-1,block.STONE.id)
mc.setBlock(0,2,-1,block.STONE.id)
mc.setBlock(1,1,1,block.STONE.id)
mc.setBlock(-1,1,1,block.STONE.id)
mc.setBlock(0,1,1,block.STONE.id)
mc.setBlock(1,1,-1,block.STONE.id)
def model(r, x, y, z):
"""
Fukcja buduje obrys kwadratu, którego środek to punkt x, y, z
oraz koło wpisane w ten kwadrat
"""
mcfig = mcstuff.MinecraftDrawing(mc)
obrys = block.SANDSTONE
wypelniacz = block.AIR
mc.setBlocks(x - r, y, z - r, x +
r, y, z + r, obrys)
mc.setBlocks(x - r + 1, y, z - r + 1, x +
r - 1, y, z + r - 1, wypelniacz)
mcfig.drawHorizontalCircle(0, 0, 0, r, block.GRASS)
import sys
import mcpi.minecraft as minecraft
import mcpi.block as block
import server
mc = minecraft.Minecraft.create(server.address)
mc.setBlocks(-128,0,-128,128,64,128,0)
if(len(sys.argv) > 1):
bid = int(sys.argv[1])
else:
bid = block.SANDSTONE.id
if bid < 0 or bid > 108:
bid = block.SANDSTONE.id
mc.setBlocks(-128,0,-128,128,-64,128,bid)
def model(promien, x, y, z):
"""
Fukcja buduje obrys kwadratu, którego środek to punkt x, y, z
oraz koło wpisane w ten kwadrat
"""
mcfig = mcstuff.MinecraftDrawing(mc)
obrys = block.SANDSTONE
wypelniacz = block.AIR
mc.setBlocks(x - promien, y, z - promien, x +
promien, y, z + promien, obrys)
mc.setBlocks(x - promien + 1, y, z - promien + 1, x +
promien - 1, y, z + promien - 1, wypelniacz)
mcfig.drawHorizontalCircle(0, 0, 0, promien, block.GRASS)
def model(r, x, y, z):
"""
Fukcja buduje obrys kwadratu, którego środek to punkt x, y, z
oraz koło wpisane w ten kwadrat
"""
mcfig = mcstuff.MinecraftDrawing(mc)
obrys = block.SANDSTONE
wypelniacz = block.AIR
mc.setBlocks(x - r, y, z - r, x +
r, y, z + r, obrys)
mc.setBlocks(x - r + 1, y, z - r + 1, x +
r - 1, y, z + r - 1, wypelniacz)
mcfig.drawHorizontalCircle(0, 0, 0, r, block.GRASS)
import mcpi.block as block
import server
# It goes from -MAX_XZ to MAX_XZ.
MAX_XZ = 128
MAX_Y = 64
# These are the vertices of the triangle. It's a list of points. Each point
# is an (X, Y, X) tuple.
TRIANGLE_HEIGHT = MAX_Y - 1
TOP = (-MAX_XZ, TRIANGLE_HEIGHT, 0)
BOTTOM_LEFT = (MAX_XZ, TRIANGLE_HEIGHT, MAX_XZ)
BOTTOM_RIGHT = (MAX_XZ, TRIANGLE_HEIGHT, -MAX_XZ)
TRIANGLE_VERTICES = [TOP, BOTTOM_LEFT, BOTTOM_RIGHT]
BASE_BLOCK_ID = block.SANDSTONE.id
TRIANGLE_BLOCK_ID = block.SNOW.id
# This is the maximum number of iterations to let the algorithm run. The
# algorithm relies on randomness, so I'm just picking a sensible value.
MAX_ITERATIONS = MAX_XZ ** 2
PRINT_FREQ = 1000
def clear_board(minecraft):
minecraft.setBlocks(-MAX_XZ, 0, -MAX_XZ, MAX_XZ, MAX_Y, MAX_XZ, 0)
minecraft.setBlocks(-MAX_XZ, 0, -MAX_XZ, MAX_XZ, -MAX_Y, MAX_XZ, BASE_BLOCK_ID)
def draw_sierpinski_triangle(minecraft):
# mcpipy.com retrieved from URL below, written by snowbound
# http://www.minecraftforum.net/topic/1680160-simple-flatmap-script/
import sys
import mcpi.minecraft as minecraft
import mcpi.block as block
import server
mc = minecraft.Minecraft.create(server.address)
mc.setBlocks(-128,0,-128,128,64,128,0)
if(len(sys.argv) > 1):
bid = int(sys.argv[1])
else:
bid = block.SANDSTONE.id
if bid < 0 or bid > 108:
bid = block.SANDSTONE.id
mc.setBlocks(-128,0,-128,128,-64,128,bid)
def model(promien, x, y, z):
"""
Fukcja buduje obrys kwadratu, którego środek to punkt x, y, z
oraz koło wpisane w ten kwadrat
"""
mcfig = mcstuff.MinecraftDrawing(mc)
obrys = block.SANDSTONE
wypelniacz = block.AIR
mc.setBlocks(x - promien, y, z - promien, x +
promien, y, z + promien, obrys)
mc.setBlocks(x - promien + 1, y, z - promien + 1, x +
promien - 1, y, z + promien - 1, wypelniacz)
mcfig.drawHorizontalCircle(0, 0, 0, promien, block.GRASS)
def main():
mc = minecraft.Minecraft.create(server.address)
# write the rest of your code here...
mc.postToChat("Erasing a 50x50 block...")
mc.setBlocks(-50,-10,-50,50,10,50,block.AIR.id)
mc.setBlocks(-50,0,-50,50,-10,50,block.SANDSTONE.id)
mc.postToChat("Done Erasing a 50x50 block!")
def wybierzBlok(self, player_id, hp):
"""Funkcja dobiera kolor bloku w zależności od gracza i hp robota."""
player1_bloki = (block.GRAVEL, block.SANDSTONE, block.BRICK_BLOCK,
block.FARMLAND, block.OBSIDIAN, block.OBSIDIAN)
player2_bloki = (block.WOOL, block.LEAVES, block.CACTUS,
block.MELON, block.WOOD, block.WOOD)
return player1_bloki[hp / 10] if player_id else player2_bloki[hp / 10]