# petle (loops) # Na czacie Minecraft wyswietl liczby od 0 do 5. Sprawdz zadanie pierwsze aby zobaczyc jak wypisywac na czacie. from mine import Minecraft minecraft = Minecraft() for numer in range(5): minecraft.postToChat(str(numer))
# opis # Zmieniajac 2 (wysokosc) parametr polecenia 'setBlock', zbuduj ceglane schody (BRICK_BLOCK) # 1 ) Startujac z pozycji 0 0 0. # Schody powinny miec wysokosc 100 elementow from mine import Minecraft, block minecraft = Minecraft() for i in range(100): minecraft.setBlock(i, i, 0, block.BRICK_BLOCK)
from mine import Minecraft, block world = Minecraft() for i in range(10): for j in range(10): for k in range(10): if (i == 9 and j == 8 and k == 9): world.setBlock(i, j, k, block.AIR) elif (i == 9 and j == 9 and k == 9): world.setBlock(i, j, k, block.TNT) else: world.setBlock(i, j, k, block.WOOD) for i in range(8): for j in range(9): for k in range(8): world.setBlock(i + 1, j + 1, k + 1, block.WATER)
err = pixels[x][y][i] - actualRGB[i] if x + 1 < width: pixels[x+1][y][i] += err * 7 // 16 if y + 1 < height: if 0 < x: pixels[x-1][y+1][i] += err * 3 // 16 pixels[x][y+1][i] += err * 5 // 16 if x + 1 < width: pixels[x+1][y+1][i] += err // 16 else: raise ValueError('Unknown dithering algorithm') if __name__ == '__main__': from mine import Minecraft mc = Minecraft() pos = mc.player.getTilePos() r = 50 cx = pos.x cy = pos.y + r cz = pos.z for x in range(-r,r+1): for y in range(-r,r+1): d = math.sqrt(x*x+y*y)/r if d<=1: if x == 0 and y == 0: theta = 0 else: theta = math.atan2(y,x) * 180. / math.pi
from mine import Minecraft mc = Minecraft() import time import random import sys def didPlayerDie(pos): return pos.x < 15 and pos.y < 15 and pos.z < 15 def didEntityDie(entity): try: mc.entity.getPos(entity) return False except: return True def getBlockLookingAt(): playerPos = mc.player.getPos() playerDir = mc.player.getDirection() blockat = 0 rayTrace = playerPos while blockat == 0: rayTrace += playerDir blockat = mc.getBlock(rayTrace) return rayTrace pos = mc.player.getPos() entityZombie = "Zombie" entitySkelotn = "Skeleton" entityCreeper = "Creeper" entities = [entityZombie, entitySkelotn, entityCreeper]
# opis # Wyswietlenie napisu "Hello world!" na czacie from mine import Minecraft, block mc = Minecraft() a = 50 mc.setBlocks(-a, 0, -a, a, a, a, block.AIR) mc.setBlocks(-a, -5, -a, a, -1, a, block.GRASS)
# opis (funkcje) from mine import Minecraft, block minecraft = Minecraft() def klocek_nad_ziema(wyskosc): minecraft.setBlock(0, wyskosc, 0, block.BRICK_BLOCK) minecraft.setBlock(0, wyskosc + 1, 0, block.BRICK_BLOCK) minecraft.setBlock(0, wyskosc + 2, 0, block.BRICK_BLOCK) klocek_nad_ziema(5) klocek_nad_ziema(10) klocek_nad_ziema(15)
# opis # Wyswietlenie napisu "Hello world!" na czacie from mine import Minecraft, block mc = Minecraft() mc.setBlocks(-50, 0, -50, 50, 50, 50, block.AIR) mc.setBlocks(-50, -5, -50, 50, -1, 50, block.GRASS)
# Wyswietlenie napisu "Hello world!" na czacie # polecenie "postToChat" from mine import Minecraft minecraft = Minecraft() minecraft.postToChat("Hello world!")
# petle (loops) # Zmieniajac 2 (wysokosc) parametr polecenia 'setBlock', # zbuduj piaskowa wieze (RED_SAND) # Startujac z pozycji 0 0 0. # Wieza powinna miec wysokosc 100 elementow from mine import Minecraft, block minecraft = Minecraft() for wysokosc in range(100): minecraft.setBlock(0, wysokosc, 0, block.RED_SAND)
if x + 1 < width: pixels[x + 1][y][i] += err * 7 // 16 if y + 1 < height: if 0 < x: pixels[x - 1][y + 1][i] += err * 3 // 16 pixels[x][y + 1][i] += err * 5 // 16 if x + 1 < width: pixels[x + 1][y + 1][i] += err // 16 else: raise ValueError('Unknown dithering algorithm') if __name__ == '__main__': from mine import Minecraft from _mp_ds_config import * mc = Minecraft(Connection(serveradress, serverport), name=playernameonserver) pos = mc.player.getTilePos() r = 50 cx = pos.x cy = pos.y + r cz = pos.z for x in range(-r, r + 1): for y in range(-r, r + 1): d = math.sqrt(x * x + y * y) / r if d <= 1: if x == 0 and y == 0: theta = 0 else: theta = math.atan2(y, x) * 180. / math.pi rgb = hsvToRGB(theta, d, 1) mc.setBlock(cx + x, cy + y, cz, rgbToBlock(rgb,
# polecenie "setBlock" # Uzycie funkcji `mc.setBlock(x, y, z, material)` tak, # zeby rozstawic 5 roznych materialow w pozycjach: # 1) 0, 0, 0 z materialem block.GLASS # 2) 0, 10, 0 z materialem block.WOOD # 3) 0, 0, 10 z materialem block.MELON # 4) 0, 10, 10 z materialem block.GOLD_BLOCK # 5) W dowolnym miejscu, z dowolnym materialem. Znajdz i zaprezentuj from mine import Minecraft, block minecraft = Minecraft() minecraft.setBlock(0, 0, 0, block.GLASS) minecraft.setBlock(0, 10, 0, block.WOOD) minecraft.setBlock(0, 0, 10, block.MELON) minecraft.setBlock(10, 10, 10, block.GOLD_BLOCK)
# petle (loops) # Na czacie Minecraft wyswietl liczby od 0 do 5. Sprawdz zadanie pierwsze aby zobaczyc jak wypisywac na czacie. from mine import Minecraft minecraft = Minecraft() for numer in range(5): minecraft.postToChat(numer)
# polecenie "setBlock" # Zbuduj wieze skladajaca sie z 5 blokow, # w ktorej 1 blok znajduje sie punkcie (0,0,0) # Z materialu TNT (dynamit) i wysadz wszystko w powietrze (pochodnia redstone) from mine import Minecraft, block minecraft = Minecraft() minecraft.setBlock(0, 0, 0, block.TNT) minecraft.setBlock(0, 1, 0, block.TNT) minecraft.setBlock(0, 2, 0, block.TNT) minecraft.setBlock(0, 3, 0, block.TNT) minecraft.setBlock(0, 4, 0, block.TNT)
# polecenie "setBlock" # Uzycie funkcji `mc.setBlock(x, y, z, material)` tak, # zeby postawic blok (block.GLASS) w centrum swiata (0, 0, 0) from mine import Minecraft, block minecraft = Minecraft() minecraft.setBlock(0, 0, 0, block.GLASS)