Ejemplo n.º 1
0
from worldLoader import WorldSlice
import interfaceUtils

# for testing
interfaceUtils.runCommand("execute at @p run setbuildarea ~ ~-1 ~ ~ ~ ~")

# 2D build area
buildArea = interfaceUtils.requestBuildArea()
if buildArea != -1:
    x1 = buildArea["xFrom"]
    y1 = buildArea["yFrom"]
    z1 = buildArea["zFrom"]
    x2 = buildArea["xTo"]
    y2 = buildArea["yTo"]
    z2 = buildArea["zTo"]
    # print(buildArea)
    area = (x1, z1, x2 - x1, z2 - z1)

ws = WorldSlice(area, [])

block = ws.getBlockCompoundAt((x1, y1, z1))

print(block)
print(block["Properties"])
print(block["Properties"]["half"])
Ejemplo n.º 2
0
for i in range(len(palette)):
    paletteReverseLookup[palette[i]] = i

topmap = np.zeros((rect[2], rect[3]), dtype='int')
topcolor = np.zeros(topmap.shape, dtype="int")

unknownBlocks = set()

for dx in range(rect[2]):
    for dz in range(rect[3]):
        for dy in range(5):
            x = rect[0] + dx
            z = rect[1] + dz
            y = int(heightmap1[(dx, dz)]) - dy

            blockCompound = slice.getBlockCompoundAt((x, y, z))

            if blockCompound != None:
                blockID = blockCompound["Name"].value
                if (blockID in ["minecraft:air", "minecraft:cave_air"]):
                    continue
                else:
                    numID = paletteReverseLookup.get(blockID, 0)
                    if (numID == 0): unknownBlocks.add(blockID)
                    # print("%s > %i" % (blockID, numID))
                    topmap[(dx, dz)] = numID
                    topcolor[(dx, dz)] = paletteColors[numID]
                    break

print("unknown blocks: %s" % str(unknownBlocks))