コード例 #1
0
def verifyPaletteBlocks():
    counter = 0
    badcounter = 0
    passed = []
    tocheck = [block for i in PALETTE.values()
               for block in i] + list(TRANSPARENT)
    for block in tocheck:
        if block in passed:
            badcounter += 1
            print()
            print(block + " is duplicated")
        elif not interfaceUtils.setBlock(0, 0, 0, block).isnumeric():
            badcounter += 1
            print()
            print(interfaceUtils.setBlock(0, 0, 0, block))
            print("Cannot verify " + block)
        counter += 1
        passed.append(block)
        print(str(counter) + " blocks verified.", end='\r')
    interfaceUtils.setBlock(0, 0, 0, 'air')
    print()
    print("Scan complete.")
    if badcounter > 0:
        print("{}/{} blocks duplicate or could not be verified.".format(
            badcounter, counter))
        print("Please check you are running on Minecraft " + VERSION)
    else:
        print("All blocks successfully verified.")
    print()
コード例 #2
0
def setBlock(x, y, z, block):
    """Place blocks or add them to batch."""
    if USE_BATCHING:
        # add block to buffer, send once buffer has 100 items in it
        interfaceUtils.placeBlockBatched(x, y, z, block, 100)
    else:
        interfaceUtils.setBlock(x, y, z, block)
コード例 #3
0
def buildByCondition(condition, y, blockID):
    buildPositions = np.where(condition)
    for p in zip(*buildPositions):
        x = area[0] + p[0]
        z = area[1] + p[1]
        if BUILD:
            interfaceUtils.setBlock(x, y, z, blockID)
    interfaceUtils.sendBlocks()
コード例 #4
0
 def flattenArea(self):
     edgeMap = np.zeros((self._size, self._size))
     for i in range(self._x, self._x + self._size):
         for j in range(self._z, self._z + self._size):
             edges = self._findEdges(i, j)
             for edge in edges:
                 edgeMap[edge[0]][edge[1]] = 1
     for i in range(self._size):
         for j in range(self._size):
             if(edgeMap[i][j] == 1):
                 x = i + self._x
                 z = j + self._z
                 neighbour = self.getBlockAt(x, 0, z)
                 if(self.getHeightAt(x, z) < self.getHeightAt(x - 1, z)):
                     self.setBlockAt(x, 0, z, neighbour)
                 else:
                     interfaceUtils.setBlock(x, self.getHeightAt(x - 1, z), z, neighbour)
コード例 #5
0
def buildHouse(x1, y1, z1, x2, y2, z2):
    """Build a small house."""
    # floor
    interfaceUtils.fill(x1, y1, z1, x2 - 1, y1, z2 - 1, "cobblestone")

    # walls
    interfaceUtils.fill(x1 + 1, y1, z1, x2 - 2, y2, z1, "oak_planks")
    interfaceUtils.fill(x1 + 1, y1, z2 - 1, x2 - 2, y2, z2 - 1, "oak_planks")
    interfaceUtils.fill(x1, y1, z1 + 1, x1, y2, z2 - 2, "oak_planks")
    interfaceUtils.fill(x2 - 1, y1, z1 + 1, x2 - 1, y2, z2 - 2, "oak_planks")

    # corners
    interfaceUtils.fill(x1, y1, z1, x1, y2, z1, "oak_log")
    interfaceUtils.fill(x2 - 1, y1, z1, x2 - 1, y2, z1, "oak_log")
    interfaceUtils.fill(x1, y1, z2 - 1, x1, y2, z2 - 1, "oak_log")
    interfaceUtils.fill(x2 - 1, y1, z2 - 1, x2 - 1, y2, z2 - 1, "oak_log")

    # clear interior
    for y in range(y1 + 1, y2):
        for x in range(x1 + 1, x2 - 1):
            for z in range(z1 + 1, z2 - 1):
                # check what's at that place and only delete if not air
                if "air" not in interfaceUtils.getBlock(x, y, z):
                    interfaceUtils.setBlock(x, y, z, "air")

    # roof
    if x2 - x1 < z2 - z1:  # if the house is longer in Z-direction
        for i in range(0, (1 - x1 + x2) // 2):
            interfaceUtils.fill(x1 + i, y2 + i, z1, x2 - 1 - i, y2 + i, z2 - 1,
                                "bricks")
    else:
        # same as above but with x and z swapped
        for i in range(0, (1 - z1 + z2) // 2):
            interfaceUtils.fill(x1, y2 + i, z1 + i, x2 - 1, y2 + i, z2 - 1 - i,
                                "bricks")

    if interfaceUtils.isBuffering():
        interfaceUtils.sendBlocks()
コード例 #6
0
ファイル: structures.py プロジェクト: lilmert/gdmc
 def _xAxisWall(self, z):
     x1 = self._houseX
     for height in range(1, 5):
         for i in range(1, 6):
             if(height == 4):
                 interfaceUtils.setBlock(x1 + i, self._first_floor_level + height, z, 'dark_oak_log')
                 continue
             if(height == 2 and (i == 2 or i == 4)):
                 interfaceUtils.setBlock(x1 + i, self._first_floor_level + height, z, 'glass_pane')
             else:
                 interfaceUtils.setBlock(x1 + i, self._first_floor_level + height, z, self._color)
コード例 #7
0
ファイル: structures.py プロジェクト: lilmert/gdmc
 def _layFirstFloor(self):
     average = 0
     for i in range(self._houseX, self._houseX + self._houseSize):
         for j in range(self._houseZ, self._houseZ + self._houseSize):
             average += self._builder.getHeightAt(i, j)
     average /= self._houseSize * self._houseSize
     average = int(average) - 1
     for i in range(self._houseX, self._houseX + self._houseSize):
         for j in range(self._houseZ, self._houseZ + self._houseSize):
             curHeight = self._builder.getHeightAt(i, j)
             while(curHeight < average):
                 interfaceUtils.setBlock(i, curHeight, j, 'stone_bricks')
                 curHeight += 1
             while(curHeight > average):
                 interfaceUtils.setBlock(i, curHeight, j, 'air')
                 curHeight -= 1
             interfaceUtils.setBlock(i, curHeight, j, 'dark_oak_planks')
     return curHeight
コード例 #8
0
 def setBlockAt(self, x, y_incr, z, block):
     y = y_incr + self.getHeightAt(x,z)
     if self._batching:
         interfaceUtils.placeBlockBatched(x, y, z, block, 100)
     else:
         interfaceUtils.setBlock(x, y, z, block)
コード例 #9
0
            if (ws.getBlockAt(_x, _y, _z) == "minecraft:water"):
                _water = 100
            _y -= 1

        _block = ws.getBlockAt(_x, _y, _z)
        _food = ft.getFood(_x, _y, _z)

        _score = _food + _y/20 + utils.mdist2d(_x, _z, *center) - _water
        location.append((-1*_score, (_x, _y, _z)))
    location.sort()

    location = location[0][1]

    # DEBUG
    for _y in range(location[1]+6, location[1]+16):
        iu.setBlock(location[0],_y,location[2],"minecraft:glowstone")
    iu.sendBlocks()

    steps = set()

    # aco = acoEngine.ACO(ws, ft, location)
    dfs = dfsEngine.DFS(ws, ft, location)
    for i in range(10):
        food, s = dfs.runDFS(location)
        steps = steps.union(s)


    for s in steps:
        iu.setBlock(*s, "minecraft:netherrack")
    iu.sendBlocks()
    print("The Kraken has landed at {}.".format(location))
コード例 #10
0
difference = (flattenedHM.astype(np.int) - heightmap)

fill = np.where((difference > 0) & (difference < 6))
bridge = np.where((difference > 0) & (difference >= 6))
cut = np.where(difference < 0)
pave = np.where(forbiddenMap > 0)

TERRAFORM = False

if TERRAFORM:
    cutTrees = np.where(hmTrees > heightmap)

    # cut trees
    for p in zip(cutTrees[0], cutTrees[1]):
        for y in range(hmTrees[p] - 1, heightmap[p] - 1, -1):
            interfaceUtils.setBlock(p[0] + area[0], y, p[1] + area[1], "air")
    # fill
    for p in zip(fill[0], fill[1]):
        for y in range(heightmap[p], flattenedHM[p]):
            interfaceUtils.setBlock(p[0] + area[0], y, p[1] + area[1], "dirt")
    # bridge
    for p in zip(bridge[0], bridge[1]):
        interfaceUtils.setBlock(p[0] + area[0], flattenedHM[p] - 1,
                                p[1] + area[1], "light_gray_wool")
    # cut
    for p in zip(cut[0], cut[1]):
        for y in range(heightmap[p] - 1, flattenedHM[p] - 1, -1):
            interfaceUtils.setBlock(p[0] + area[0], y, p[1] + area[1], "air")
    # pave
    for p in zip(pave[0], pave[1]):
        print(f"wool at{p[0]} {p[1]}")
コード例 #11
0
ファイル: structures.py プロジェクト: lilmert/gdmc
    def _decorateInterior(self):
        rand = random.rand()
        if(rand < 0.25):
            bed = 'green_bed'
        elif(rand < 0.5):
            bed = 'brown_bed'
        elif(rand < 0.75):
            bed = 'yellow_bed'
        else:
            bed = 'blue_bed'
        if(self._direction == 'N'):
            interfaceUtils.setBlock(self._houseX + 5, self._first_floor_level + 1, self._houseZ + 3, bed + '[facing=east]')
            interfaceUtils.setBlock(self._houseX + 6, self._first_floor_level + 1, self._houseZ + 3, bed + '[part=head, facing=east]')
            

        elif(self._direction == 'S'):
            interfaceUtils.setBlock(self._houseX + 2, self._first_floor_level + 1, self._houseZ + 3, bed + '[facing=west]')
            interfaceUtils.setBlock(self._houseX + 1, self._first_floor_level + 1, self._houseZ + 3, bed + '[part=head, facing=west]')
            interfaceUtils.setBlock(self._houseX + 2, self._first_floor_level + 1, self._houseZ + 1, 'chest[facing=south]')
            interfaceUtils.setBlock(self._houseX + 1, self._first_floor_level + 1, self._houseZ + 1, 'chest[facing=south]')
            interfaceUtils.setBlock(self._houseX + 5, self._first_floor_level + 1, self._houseZ + 5, 'crafting_table')
            interfaceUtils.setBlock(self._houseX + 1, self._first_floor_level + 2, self._houseZ + 3, 'wall:torch[facing=east]')
            interfaceUtils.setBlock(self._houseX + 3, self._first_floor_level + 1, self._houseZ + 5, 'furnace')

        elif(self._direction == 'E'):
            interfaceUtils.setBlock(self._houseX + 3, self._first_floor_level + 1, self._houseZ + 5, bed + '[facing=south]')
            interfaceUtils.setBlock(self._houseX + 3, self._first_floor_level + 1, self._houseZ + 6, bed + '[part=head, facing=south]')
        else:
            interfaceUtils.setBlock(self._houseX + 3, self._first_floor_level + 1, self._houseZ + 2, bed)
            interfaceUtils.setBlock(self._houseX + 3, self._first_floor_level + 1, self._houseZ + 1, bed + '[part=head]')
            interfaceUtils.setBlock(self._houseX + 1, self._first_floor_level + 1, self._houseZ + 1, 'chest[facing=east]')
            interfaceUtils.setBlock(self._houseX + 1, self._first_floor_level + 1, self._houseZ + 2, 'chest[facing=east]')
            interfaceUtils.setBlock(self._houseX + 5, self._first_floor_level + 1, self._houseZ + 5, 'crafting_table')
            interfaceUtils.setBlock(self._houseX + 3, self._first_floor_level + 2, self._houseZ + 1, 'wall:torch[facing=south]')
            interfaceUtils.setBlock(self._houseX + 5, self._first_floor_level + 1, self._houseZ + 3, 'furnace[facing=west]')
            
コード例 #12
0
ファイル: structures.py プロジェクト: lilmert/gdmc
    def _buildFrontWall(self):
        if(self._direction == 'N' or self._direction == 'S'):
            z1 = self._houseZ
            z2 = self._houseZ + self._houseSize - 1
            if(self._direction == 'N'):
                x = self._houseX
            if(self._direction == 'S'):
                x = self._houseX + self._houseSize - 1

            # adjacent to corners
            for i in range(1, 5):
                if( i == 1 or i == 3):
                    interfaceUtils.setBlock(x, self._first_floor_level + i, z1 + 1, self._color)
                    interfaceUtils.setBlock(x, self._first_floor_level + i, z2 - 1, self._color)
                if(i == 2):
                    interfaceUtils.setBlock(x, self._first_floor_level + i, z1 + 1, 'glass_pane')
                    interfaceUtils.setBlock(x, self._first_floor_level + i, z2 - 1, 'glass_pane')  
                if(i == 4):
                    interfaceUtils.setBlock(x, self._first_floor_level + i, z1 + 1, 'dark_oak_log')
                    interfaceUtils.setBlock(x, self._first_floor_level + i, z2 - 1, 'dark_oak_log')

            # one away from middle
            for i in range(1, 5):
                interfaceUtils.setBlock(x, self._first_floor_level + i, z1 + 2, 'dark_oak_log')
                interfaceUtils.setBlock(x, self._first_floor_level + i, z2 - 2, 'dark_oak_log')

            # middle
            interfaceUtils.setBlock(x, self._first_floor_level + 1, z1 + 3, 'dark_oak_door[half=lower, facing=east]')
            interfaceUtils.setBlock(x, self._first_floor_level + 2, z1 + 3, 'dark_oak_door[half=upper, facing=east]')
            interfaceUtils.setBlock(x, self._first_floor_level + 3, z1 + 3, self._color)
            interfaceUtils.setBlock(x, self._first_floor_level + 4, z1 + 3, 'dark_oak_log')

            # add stone doorstep and updating build map
            for out in range(1, 3):
                for i in range(3):
                    if(self._direction == 'S'):
                        interfaceUtils.setBlock(x + out, self._first_floor_level, z1 + 2 + i, 'stone_bricks')
                        interfaceUtils.setBlock(x + out, self._first_floor_level + 1, z1 + 2 + i, 'air')            
                        self._build_map.setBuildAt(x + 3, z1 + 3, 3)
                    else:
                        interfaceUtils.setBlock(x - out, self._first_floor_level, z1 + 2 + i, 'stone_bricks')
                        interfaceUtils.setBlock(x - out, self._first_floor_level + 1, z1 + 2 + i, 'air')
                        self._build_map.setBuildAt(x - 3, z1 + 3, 3)

        if(self._direction == 'E' or self._direction == 'W'):
            x1 = self._houseX
            x2 = self._houseX + self._houseSize - 1
            if(self._direction == 'E'):
                z = self._houseZ
            if(self._direction == 'W'):
                z = self._houseZ + self._houseSize - 1

            # adjacent to corners
            for i in range(1, 5):
                if( i == 1 or i == 3):
                    interfaceUtils.setBlock(x1 + 1, self._first_floor_level + i, z, self._color)
                    interfaceUtils.setBlock(x2 - 1, self._first_floor_level + i, z, self._color)
                if(i == 2):
                    interfaceUtils.setBlock(x1 + 1, self._first_floor_level + i, z, 'glass_pane')
                    interfaceUtils.setBlock(x2 - 1, self._first_floor_level + i, z, 'glass_pane')  
                if(i == 4):
                    interfaceUtils.setBlock(x1 + 1, self._first_floor_level + i, z, 'dark_oak_log')
                    interfaceUtils.setBlock(x2 - 1, self._first_floor_level + i, z, 'dark_oak_log')

            # one away from middle
            for i in range(1, 5):
                interfaceUtils.setBlock(x1 + 2, self._first_floor_level + i, z, 'dark_oak_log')
                interfaceUtils.setBlock(x2 - 2, self._first_floor_level + i, z, 'dark_oak_log')

            # middle
            interfaceUtils.setBlock(x1 + 3, self._first_floor_level + 1, z, 'dark_oak_door[half=lower, facing=east]')
            interfaceUtils.setBlock(x1 + 3, self._first_floor_level + 2, z, 'dark_oak_door[half=upper, facing=east]')
            interfaceUtils.setBlock(x1 + 3, self._first_floor_level + 3, z, self._color)
            interfaceUtils.setBlock(x1 + 3, self._first_floor_level + 4, z, 'dark_oak_log')
            
            # add stone doorstep and updating build map
            for out in range(1, 3):
                for i in range(3):
                    if(self._direction == 'W'):
                        interfaceUtils.setBlock(x1 + 2 + i, self._first_floor_level, z + out, 'stone_bricks')
                        interfaceUtils.setBlock(x1 + 2 + i, self._first_floor_level + 1, z + out, 'air')
                        self._build_map.setBuildAt(x1 + 3, z + 3, 3)
                    
                    else:
                        interfaceUtils.setBlock(x1 + 2 + i, self._first_floor_level, z - out, 'stone_bricks')
                        interfaceUtils.setBlock(x1 + 2 + i, self._first_floor_level + 1, z - out, 'air')
                        self._build_map.setBuildAt(x1 + 3, z - 3, 3)
コード例 #13
0
ファイル: structures.py プロジェクト: lilmert/gdmc
    def _zAxisRoof(self):
        # creating peaks
        for i in range(1, 6):
            if(i != 2 and i != 4):
                interfaceUtils.setBlock(self._houseX, self._first_floor_level + 5, self._houseZ + i, self._color)
                interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + 5, self._houseZ + i, self._color)
            else:
                interfaceUtils.setBlock(self._houseX, self._first_floor_level + 5, self._houseZ + i, 'dark_oak_log')
                interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + 5, self._houseZ + i, 'dark_oak_log')
        interfaceUtils.setBlock(self._houseX, self._first_floor_level + 6, self._houseZ + 2, 'dark_oak_log')
        interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + 6, self._houseZ + 2, 'dark_oak_log')
        interfaceUtils.setBlock(self._houseX, self._first_floor_level + 6, self._houseZ + 3, 'glass_pane')
        interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + 6, self._houseZ + 3, 'glass_pane')
        interfaceUtils.setBlock(self._houseX, self._first_floor_level + 6, self._houseZ + 4, 'dark_oak_log')
        interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + 6, self._houseZ + 4, 'dark_oak_log')
        interfaceUtils.setBlock(self._houseX, self._first_floor_level + 7, self._houseZ + 3, self._color)
        interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + 7, self._houseZ + 3, self._color)

        # shingles
        spacing = -1
        for height in range(4, 9):
            for j in range(self._houseSize):
                if(height == 8):
                    interfaceUtils.setBlock(self._houseX + j, self._first_floor_level + height, self._houseZ + spacing, 'dark_oak_slab')
                    continue
                interfaceUtils.setBlock(self._houseX + j, self._first_floor_level + height, self._houseZ + spacing, 'dark_oak_stairs[facing=south]')
                interfaceUtils.setBlock(self._houseX + j, self._first_floor_level + height, self._houseZ + self._houseSize - 1 - spacing, 'dark_oak_stairs[facing=north]')
            spacing += 1
コード例 #14
0
ファイル: structures.py プロジェクト: lilmert/gdmc
 def _buildCorners(self):
     for i in range(0, 5):
         interfaceUtils.setBlock(self._houseX, self._first_floor_level + i, self._houseZ, "dark_oak_log")
         interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + i, self._houseZ, "dark_oak_log")
         interfaceUtils.setBlock(self._houseX, self._first_floor_level + i, self._houseZ + self._houseSize - 1, "dark_oak_log")
         interfaceUtils.setBlock(self._houseX + self._houseSize - 1, self._first_floor_level + i, self._houseZ + self._houseSize - 1, "dark_oak_log")
コード例 #15
0
ファイル: structures.py プロジェクト: lilmert/gdmc
    def _buildFountain(self):
        centerX = self._x + math.floor(0.5 * self._size)
        centerZ = self._z + math.floor(0.5 * self._size)

        for i in range(3):
            if(i == 2):
                interfaceUtils.setBlock(centerX + 3, self._base_level + 1 + i, centerZ + 3, 'stone_brick_slab')
                interfaceUtils.setBlock(centerX + 3, self._base_level + 1 + i, centerZ - 3, 'stone_brick_slab')
                interfaceUtils.setBlock(centerX - 3, self._base_level + 1 + i, centerZ + 3, 'stone_brick_slab')
                interfaceUtils.setBlock(centerX - 3, self._base_level + 1 + i, centerZ - 3, 'stone_brick_slab')
            else:
                interfaceUtils.setBlock(centerX + 3, self._base_level + 1 + i, centerZ + 3, 'chiseled_stone_bricks')
                interfaceUtils.setBlock(centerX + 3, self._base_level + 1 + i, centerZ - 3, 'chiseled_stone_bricks')
                interfaceUtils.setBlock(centerX - 3, self._base_level + 1 + i, centerZ + 3, 'chiseled_stone_bricks')
                interfaceUtils.setBlock(centerX - 3, self._base_level + 1 + i, centerZ - 3, 'chiseled_stone_bricks')
        for i in range(5):
            interfaceUtils.setBlock(centerX - 2 + i, self._base_level + 1, centerZ - 3, 'stone_brick_stairs[facing=south]')
            interfaceUtils.setBlock(centerX - 2 + i, self._base_level + 1, centerZ + 3, 'stone_brick_stairs[facing=north]')
            interfaceUtils.setBlock(centerX - 3, self._base_level + 1, centerZ - 2 + i, 'stone_brick_stairs[facing=east]')
            interfaceUtils.setBlock(centerX + 3, self._base_level + 1, centerZ - 2 + i, 'stone_brick_stairs[facing=west]')
        
        interfaceUtils.setBlock(centerX, self._base_level + 1, centerZ - 1, 'chiseled_stone_bricks')
        interfaceUtils.setBlock(centerX - 1, self._base_level + 1, centerZ, 'chiseled_stone_bricks')
        interfaceUtils.setBlock(centerX, self._base_level + 1, centerZ + 1, 'chiseled_stone_bricks')
        interfaceUtils.setBlock(centerX + 1, self._base_level + 1, centerZ, 'chiseled_stone_bricks')

        interfaceUtils.setBlock(centerX, self._base_level + 2, centerZ - 1, 'stone_brick_stairs[facing=south]')
        interfaceUtils.setBlock(centerX - 1, self._base_level + 2, centerZ, 'stone_brick_stairs[facing=north]')
        interfaceUtils.setBlock(centerX, self._base_level + 2, centerZ + 1, 'stone_brick_stairs[facing=east]')
        interfaceUtils.setBlock(centerX + 1, self._base_level + 2, centerZ, 'stone_brick_stairs[facing=west]')

        interfaceUtils.setBlock(centerX, self._base_level + 6, centerZ - 1, 'chiseled_stone_bricks')
        interfaceUtils.setBlock(centerX - 1, self._base_level + 6, centerZ, 'chiseled_stone_bricks')
        interfaceUtils.setBlock(centerX, self._base_level + 6, centerZ + 1, 'chiseled_stone_bricks')
        interfaceUtils.setBlock(centerX + 1, self._base_level + 6, centerZ, 'chiseled_stone_bricks')



        for i in range(-1, 2):
            for j in range(-1, 2):
                interfaceUtils.setBlock(centerX + i, self._base_level + 7, centerZ + j, 'chiseled_stone_bricks')
        for i in range(2):
            interfaceUtils.setBlock(centerX, self._base_level + 7 + i, centerZ - 2, 'chiseled_stone_bricks')
            interfaceUtils.setBlock(centerX - 2, self._base_level + 7 + i, centerZ, 'chiseled_stone_bricks')
            interfaceUtils.setBlock(centerX, self._base_level + 7 + i, centerZ + 2, 'chiseled_stone_bricks')
            interfaceUtils.setBlock(centerX + 2, self._base_level + 7 + i, centerZ, 'chiseled_stone_bricks')

        interfaceUtils.setBlock(centerX, self._base_level + 9, centerZ - 2, 'stone_brick_stairs[facing=south]')
        interfaceUtils.setBlock(centerX - 2, self._base_level + 9, centerZ, 'stone_brick_stairs[facing=east]')
        interfaceUtils.setBlock(centerX, self._base_level + 9, centerZ + 2, 'stone_brick_stairs[facing=north]')
        interfaceUtils.setBlock(centerX + 2, self._base_level + 9, centerZ, 'stone_brick_stairs[facing=west]')
        
        for i in range(10):
            interfaceUtils.setBlock(centerX, self._base_level + i, centerZ, 'chiseled_stone_bricks')
        interfaceUtils.setBlock(centerX, self._base_level + 10, centerZ, 'water')
コード例 #16
0
    # mapUtils.visualize(hmo, heightmap)

    # example alternative heightmaps:
    # >>> heightmap = worldSlice.heightmaps["MOTION_BLOCKING"]
    # >>> heightmap = worldSlice.heightmaps["MOTION_BLOCKING_NO_LEAVES"]
    # >>> heightmap = worldSlice.heightmaps["OCEAN_FLOOR"]
    # >>> heightmap = worldSlice.heightmaps["WORLD_SURFACE"]

    # show the heightmap as an image
    # >>> mapUtils.visualize(heightmap, title="heightmap")

    # build a fence around the perimeter
    for x in range(startx, endx):
        z = startz
        y = heightAt(x, z)
        interfaceUtils.setBlock(x, y - 1, z, "cobblestone")
        interfaceUtils.setBlock(x, y, z, "oak_fence")
    for z in range(startz, endz):
        x = startx
        y = heightAt(x, z)
        interfaceUtils.setBlock(x, y - 1, z, "cobblestone")
        interfaceUtils.setBlock(x, y, z, "oak_fence")
    for x in range(startx, endx):
        z = endz - 1
        y = heightAt(x, z)
        interfaceUtils.setBlock(x, y - 1, z, "cobblestone")
        interfaceUtils.setBlock(x, y, z, "oak_fence")
    for z in range(startz, endz):
        x = endx - 1
        y = heightAt(x, z)
        interfaceUtils.setBlock(x, y - 1, z, "cobblestone")