Last active
January 14, 2024 15:06
-
-
Save Noxitu/3092b8d4262b8ddfa0de44cf4d41b472 to your computer and use it in GitHub Desktop.
Parsing decked out 2 area (finding holes and other random stuff)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from pathlib import Path | |
| import rich.progress | |
| import numpy as np | |
| from noxitu.minecraft.io.assets import Assets | |
| from noxitu.minecraft.io.world import World | |
| ROOT = Path(__file__).parent | |
| DATA_PATH = Path(__file__).parents[3] / "Data" | |
| COLLECT_CONTENT_IDS = False | |
| USE_COLORS = False | |
| # COLLECT_CONTENT_IDS = True | |
| # USE_COLORS = True | |
| # NEW_MODE = "calculate_inside" | |
| # NEW_MODE = "calculate_outside" | |
| NEW_MODE = "calculate_holes" | |
| if USE_COLORS: | |
| from h9_colors import BLOCK_COLORS | |
| for key, value in list(BLOCK_COLORS.items()): | |
| if value is None: | |
| del BLOCK_COLORS[key] | |
| def main(): | |
| # world_path = DATA_PATH / "Worlds/test_120" | |
| world_path = Path( | |
| # R"C:\Users\grzeg\AppData\Roaming\.minecraft\profiles\h9\saves\hc9" | |
| R"C:\Users\grzeg\AppData\Roaming\.minecraft\profiles\h9\saves\h9.5" | |
| ) | |
| world = World(world_path) | |
| level = world.level() | |
| version_id = level["Data"]["Version"]["Id"] | |
| version = level["Data"]["Version"]["Name"].decode() | |
| print(f"{version_id=}") | |
| print(f"{version=}") | |
| assets = Assets(DATA_PATH / f"Versions/{version}", track=rich.progress.track) | |
| world.add_assets(version_id, assets) | |
| z_chunk_size, y_chunk_size, x_chunk_size = 17, 9, 17 | |
| # z0, y0, x0 = 120, -3, -40 | |
| z0, y0, x0 = 112, -4, -44 | |
| x_size = 16 * x_chunk_size | |
| y_size = 16 * y_chunk_size | |
| z_size = 16 * z_chunk_size | |
| SOURCES = np.array( | |
| [ | |
| [-622, 48, 1944, 0], | |
| [-454, 21, 1981, 280], | |
| [-594, 13, 1943, 450], | |
| [-641, -25, 1904, 590], | |
| ] | |
| ) - 16 * np.array([x0, y0, z0, 0]) | |
| # source_pos = np.array([-621, 47, 1967]) - 16 * np.array([x0, y0, z0]) | |
| sinks = [ | |
| [-606, 56, 1971], # | |
| [-590, 57, 1955], # | |
| [-597, 43, 1984], # | |
| [-605, 53, 2026], # | |
| [-624, 39, 2033], # | |
| [-516, 55, 2016], # | |
| [-515, 45, 1964], # | |
| [-588, -1, 1926], # | |
| [-640, -1, 1916], # | |
| [-649, 0, 1882], # | |
| [-591, 9, 1889], # | |
| [-631, -28, 1888], # | |
| [-597, -47, 1833], # | |
| [-621, -53, 1877], # | |
| ] | |
| sinks = [np.array(sink) - 16 * np.array([x0, y0, z0]) for sink in sinks] | |
| data = np.zeros((y_size, z_size, x_size), dtype=int) | |
| deltas = [(dx, dz) for dz in range(z_chunk_size) for dx in range(x_chunk_size)] | |
| if COLLECT_CONTENT_IDS or USE_COLORS: | |
| content = np.load(ROOT / "content.npy") | |
| assert content.shape == data.shape | |
| if COLLECT_CONTENT_IDS: | |
| all_content_ids = set() | |
| if USE_COLORS: | |
| all_colors_mask = np.zeros((y_size, z_size, x_size), dtype=bool) | |
| all_colors = np.zeros((y_size, z_size, x_size, 3), dtype="u1") | |
| from h9_transparent import TRANSPARENT_BLOCKS | |
| name_mapping = {block: 1 for block in TRANSPARENT_BLOCKS} | |
| # name_mapping[b"minecraft:diamond_block"] = 2 | |
| # name_mapping[b"minecraft:dropper"] = 3 | |
| # name_mapping[b"minecraft:dispenser"] = 3 | |
| # name_mapping[b"minecraft:sweet_berry_bush"] = 4 | |
| for dx, dz in rich.progress.track(deltas): | |
| chunk_x, chunk_z = x0 + dx, z0 + dz | |
| chunk = world[chunk_z, chunk_x] | |
| for dy in range(y_chunk_size): | |
| chunk_y = y0 + dy | |
| subchunk = chunk[chunk_y + 4] | |
| # subchunk_coords = np.mgrid[0:16, 0:16, 0:16] | |
| # subchunk_coords = np.moveaxis(subchunk_coords, 0, -1) | |
| if "palette" not in subchunk: | |
| continue | |
| palette_map = np.array( | |
| [name_mapping.get(p["Name"], 0) for p in subchunk["palette"]] | |
| ) | |
| mapped_subchunk = palette_map[subchunk["data"]] | |
| xs = slice(16 * dx, 16 * dx + 16) | |
| ys = slice(16 * dy, 16 * dy + 16) | |
| zs = slice(16 * dz, 16 * dz + 16) | |
| data[ys, zs, xs] = mapped_subchunk | |
| if COLLECT_CONTENT_IDS: | |
| mask = content[ys, zs, xs] | |
| if np.count_nonzero(mask) > 0: | |
| content_ids = np.unique(subchunk["data"][mask]) | |
| content_ids = {subchunk["palette"][i]["Name"] for i in content_ids} | |
| all_content_ids |= content_ids | |
| if USE_COLORS: | |
| colors_mask_map = np.array( | |
| [ | |
| BLOCK_COLORS.get(p["Name"]) is not None | |
| for p in subchunk["palette"] | |
| ] | |
| ) | |
| colors_map = np.array( | |
| [ | |
| BLOCK_COLORS.get(p["Name"], (0, 0, 0)) | |
| for p in subchunk["palette"] | |
| ] | |
| ) | |
| mask = content[ys, zs, xs] & colors_mask_map[subchunk["data"]] | |
| colors = colors_map[subchunk["data"][mask]] | |
| all_colors_mask[ys, zs, xs][mask] = True | |
| all_colors[ys, zs, xs][mask] = colors | |
| if False: | |
| mask = data == 4 | |
| print(np.count_nonzero(mask)) | |
| yzx = np.moveaxis(np.mgrid[0:y_size, 0:z_size, 0:x_size], 0, -1) | |
| yzx = yzx[mask] | |
| DESC = { | |
| 38: "Frozen Crypt - Camp", | |
| 43: "Frozen Crypt - Deadly Bush", | |
| 42: "Frozen Crypt - Tnt", | |
| 39: "Frozen Crypt - Dripstone tunnel", | |
| 44: "Frozen Crypt - Dead End Tunnel", | |
| 47: "Frozen Crypt - Ravine", | |
| 35: "Frozen Crypt - Library", | |
| 36: "Frozen Crypt - Library - Jump", | |
| 37: "Frozen Crypt - Library - Jump", | |
| 48: "Frozen Crypt - Lava Room", | |
| 49: "Frozen Crypt - Tomb", | |
| 33: "Caves of Carnage - Spiders Back", | |
| 34: "Caves of Carnage - Spiders Front", | |
| 28: "Caves of Carnage - Red Tomb", | |
| 22: "Caves of Carnage - Ravagers Den", | |
| 29: "Caves of Carnage - Mushrooms", | |
| 32: "Caves of Carnage - Ship", | |
| 27: "Caves of Carnage - Back of Cove", | |
| 14: "Black Mines - Ore Distribution Room", | |
| 11: "Black Mines - Front Stairs", | |
| 13: "Black Mines - TNT Shaft", | |
| 12: "Black Mines - Back Tower", | |
| 15: "Black Mines - Back Looparound", | |
| 10: "Black Mines - Front Jump Spot", | |
| } | |
| output = [] | |
| order = {v: i for i, v in enumerate(DESC)} | |
| with open(R"C:\tmp\berries.txt", "wt") as fd: | |
| for i, (y, z, x) in enumerate(yzx): | |
| x1 = x + 16 * x0 | |
| y1 = y + 16 * y0 | |
| z1 = z + 16 * z0 | |
| if i in DESC: | |
| output.append( | |
| { | |
| "idx": i, | |
| "pos": [+int(x1), +int(y1), +int(z1)], | |
| "description": DESC[i], | |
| } | |
| ) | |
| if i in DESC: | |
| print(-x1, y1, z1, DESC.get(i, f"#{i}"), file=fd) | |
| print(len(output)) | |
| output.sort(key=lambda item: order[item["idx"]]) | |
| print(len(output)) | |
| for item in output: | |
| del item["idx"] | |
| print(len(output)) | |
| print(output) | |
| print(json.dumps(output)) | |
| exit() | |
| if False: | |
| with open( | |
| R"C:\Users\grzeg\AppData\Roaming\.minecraft\profiles\h9\saves\h9.3\datapacks\noxitu_do2_refill\data\do2_refill\functions\dev\analyse.mcfunction", | |
| "wt", | |
| ) as fd: | |
| mask = data == 3 | |
| print(np.count_nonzero(mask)) | |
| yzx = np.moveaxis(np.mgrid[0:y_size, 0:z_size, 0:x_size], 0, -1) | |
| yzx = yzx[mask] | |
| yzx_append = np.array( | |
| [ | |
| [-561, 109, 1982], | |
| [-560, 109, 1982], | |
| [-559, 109, 1982], | |
| [-558, 109, 1982], | |
| [-557, 109, 1982], | |
| [-549, 106, 1979], | |
| [-549, 106, 1978], | |
| [-549, 106, 1977], | |
| [-549, 106, 1976], | |
| [-549, 106, 1975], | |
| [-549, 106, 1974], | |
| [-549, 106, 1973], | |
| [-549, 106, 1972], | |
| [-549, 106, 1971], | |
| [-549, 106, 1970], | |
| [-629, 59, 1945], | |
| [-630, 59, 1945], | |
| [-518, 53, 2011], | |
| [-547, 116, 1965], | |
| [-509, 104, 1972], | |
| [-508, 104, 1972], | |
| [-507, 104, 1972], | |
| [-506, 104, 1972], | |
| [-505, 104, 1972], | |
| [-504, 104, 1972], | |
| [-503, 104, 1972], | |
| [-502, 104, 1972], | |
| [-501, 104, 1972], | |
| [-500, 104, 1972], | |
| [-499, 104, 1972], | |
| [-498, 104, 1972], | |
| [-497, 104, 1972], | |
| [-496, 104, 1972], | |
| [-608, -57, 1887], | |
| [-631, -15, 1987], | |
| ] | |
| )[:, [1, 2, 0]] | |
| yzx = np.concatenate([yzx, yzx_append], axis=0) | |
| print("data modify storage tmp output set value []", file=fd) | |
| for y, z, x in yzx: | |
| if 1800 < z < 2100: | |
| x1, y1, z1 = x, y, z | |
| else: | |
| x1 = x + 16 * x0 | |
| y1 = y + 16 * y0 | |
| z1 = z + 16 * z0 | |
| pos = f"{x1} {y1} {z1}" | |
| # print(pos) | |
| print( | |
| f'data modify storage tmp tmp set value {{pos: "{pos}"}}', file=fd | |
| ) | |
| print( | |
| f"data modify storage tmp tmp.Items set from block {pos} Items", | |
| file=fd, | |
| ) | |
| print( | |
| f"execute if data block {pos} Items[0].id " | |
| "run data modify storage tmp tmp.name set from " | |
| f"block {pos} Items[0].id", | |
| file=fd, | |
| ) | |
| print( | |
| f"execute if data block {pos} Items[0].tag.display.Name " | |
| "run data modify storage tmp tmp.name set from " | |
| f"block {pos} Items[0].tag.display.Name", | |
| file=fd, | |
| ) | |
| print( | |
| f"execute store result score count do2_refill " | |
| f"run data get block {pos} Items[0].Count", | |
| file=fd, | |
| ) | |
| print( | |
| "execute " | |
| "if data storage tmp tmp.name " | |
| "if score count do2_refill matches 2.. " | |
| "run data modify storage tmp output append from " | |
| "storage tmp tmp", | |
| file=fd, | |
| ) | |
| print( | |
| "say /data get storage tmp output", | |
| file=fd, | |
| ) | |
| return | |
| if COLLECT_CONTENT_IDS: | |
| print(*all_content_ids, sep="\n") | |
| print(f" => Total {len(all_content_ids)} ids.") | |
| if USE_COLORS: | |
| print(f"Render colorized cloud ({np.count_nonzero(all_colors_mask)})") | |
| yzx = np.moveaxis(np.mgrid[0:y_size, 0:z_size, 0:x_size], 0, -1) | |
| yzx = yzx[all_colors_mask] | |
| with open(ROOT / "colorized.txt", "wt") as fd: | |
| for y, z, x in yzx: | |
| color = all_colors[y, z, x] | |
| x1 = x + 16 * x0 | |
| y1 = y + 16 * y0 | |
| z1 = z + 16 * z0 | |
| print(-x1, z1, y1, *color, file=fd) | |
| # y, z, x = data.shape | |
| # pos = np.moveaxis(np.mgrid[0:y, 0:z, 0:x], 0, -1) | |
| # pos = pos[data == 2] | |
| # y, z, x = pos.T | |
| # x1 = x + 16 * x0 | |
| # y1 = y + 16 * y0 | |
| # z1 = z + 16 * z0 | |
| # print(np.stack([x1, y1, z1], axis=-1)) | |
| # return | |
| # np.save(ROOT / "data.npy", data) | |
| # return | |
| distance = np.full(data.shape, float("inf")) | |
| previous_shape = *data.shape, 3 | |
| previous = np.full(previous_shape, -1) | |
| VISITED_VALUE = 3 | |
| EDGE_VALUE = 4 | |
| queue = [] | |
| # Init all inside points as sources and clear all blockers | |
| if NEW_MODE == "calculate_outside": | |
| inside = np.load(ROOT / "inside.npy") | |
| yzx = np.mgrid[0:y_size, 0:z_size, 0:x_size] | |
| yzx = np.moveaxis(yzx, 0, -1) | |
| yzx = yzx[inside] | |
| xyz = yzx[..., [2, 0, 1]] | |
| SOURCES = np.concatenate([xyz, np.zeros_like(xyz[..., -1:])], axis=-1) | |
| data[...] = 1 | |
| if NEW_MODE == "calculate_holes": | |
| inside = np.load(ROOT / "inside.npy") & (data == 1) | |
| outside = np.load(ROOT / "outside.npy") | |
| yzx = np.mgrid[0:y_size, 0:z_size, 0:x_size] | |
| yzx = np.moveaxis(yzx, 0, -1) | |
| yzx = yzx[outside & (data == 1)] | |
| xyz = yzx[..., [2, 0, 1]] | |
| SOURCES = np.concatenate([xyz, np.zeros_like(xyz[..., -1:])], axis=-1) | |
| data[inside] = 12 | |
| for source_pos in SOURCES: | |
| d0 = source_pos[-1] | |
| source_pos = source_pos[:-1] | |
| x, y, z = source_pos | |
| data[y, z, x] = VISITED_VALUE | |
| distance[y, z, x] = 0 | |
| # distance[y, z, x] = d0 | |
| queue.append(source_pos) | |
| print("BFS") | |
| def check(x, y, z, d, p): | |
| if not all((0 <= x < x_size, 0 <= y < y_size, 0 <= z < z_size)): | |
| return | |
| if data[y, z, x] != 1: | |
| if data[y, z, x] != VISITED_VALUE: | |
| data[y, z, x] = EDGE_VALUE | |
| return | |
| data[y, z, x] = VISITED_VALUE | |
| distance[y, z, x] = d | |
| previous[y, z, x] = p | |
| queue.append((x, y, z)) | |
| shape = data.shape | |
| total_tiles = shape[0] * shape[1] * shape[2] | |
| print(f"total_tiles = {total_tiles}") | |
| for (x, y, z), _ in zip(queue, rich.progress.track(range(total_tiles))): | |
| d = distance[y, z, x] + 1 | |
| p = x, y, z | |
| check(x + 1, y, z, d, p) | |
| check(x - 1, y, z, d, p) | |
| check(x, y + 1, z, d, p) | |
| check(x, y - 1, z, d, p) | |
| check(x, y, z + 1, d, p) | |
| check(x, y, z - 1, d, p) | |
| if NEW_MODE is None: | |
| print("Render paths") | |
| with open(ROOT / "path.txt", "wt") as fd: | |
| for i, sink_pos in enumerate(sinks): | |
| x, y, z = sink_pos | |
| while x != -1: | |
| x1 = x + 16 * x0 | |
| y1 = y + 16 * y0 | |
| z1 = z + 16 * z0 | |
| print(-x1, z1, y1, i, file=fd) | |
| x, y, z = previous[y, z, x] | |
| print("visited", np.count_nonzero(data == VISITED_VALUE)) | |
| print("edge", np.count_nonzero(data == EDGE_VALUE)) | |
| if NEW_MODE == "calculate_inside": | |
| if True: | |
| inside = data == VISITED_VALUE | |
| np.save(ROOT / "inside.npy", inside) | |
| if True: | |
| content = (data == VISITED_VALUE) | (data == EDGE_VALUE) | |
| np.save(ROOT / "content.npy", content) | |
| if NEW_MODE == "calculate_outside": | |
| outside = distance > 5 | |
| np.save(ROOT / "outside.npy", outside) | |
| print("huh") | |
| if NEW_MODE == "calculate_holes": | |
| holes = inside & (data == EDGE_VALUE) | |
| print(np.count_nonzero(holes)) | |
| yzx = np.mgrid[0:y_size, 0:z_size, 0:x_size] | |
| yzx = np.moveaxis(yzx, 0, -1) | |
| yzx = yzx[holes] | |
| xyz = yzx[..., [2, 0, 1]] | |
| xyz = xyz[:3000] | |
| print("Datapack holes") | |
| datapack_path = world_path / "datapacks/bfs/data/bfs/functions" | |
| with open(datapack_path / f"holes.mcfunction", "wt") as fd2: | |
| print(f"kill @e[type=armor_stand,name=bfs]", file=fd2) | |
| for x, y, z in xyz: | |
| x1 = x + 16 * x0 | |
| y1 = y + 16 * y0 | |
| z1 = z + 16 * z0 | |
| text = f"summon minecraft:armor_stand {x1} {y1} {z1} {{CustomName: '\"bfs\"', NoGravity: 1b, Small: 1b, Glowing: 1}}" | |
| print(text, file=fd2) | |
| print("huh") | |
| if NEW_MODE is None: | |
| print("Render cloud") | |
| with open(ROOT / "out.txt", "wt") as fd: | |
| for x, y, z in queue: | |
| x1 = x + 16 * x0 | |
| y1 = y + 16 * y0 | |
| z1 = z + 16 * z0 | |
| print(-x1, z1, y1, distance[y, z, x], file=fd) | |
| print("Datapack paths") | |
| datapack_path = world_path / "datapacks/bfs/data/bfs/functions" | |
| for existing_path in datapack_path.glob("path*.mcfunction"): | |
| existing_path.unlink() | |
| with open(datapack_path / f"paths.mcfunction", "wt") as fd2: | |
| print(f"kill @e[type=armor_stand,name=bfs]", file=fd2) | |
| SKIP = 2 | |
| skip = SKIP | |
| for i, sink_pos in enumerate(sinks): | |
| # with open(datapack_path / f"path{i}.mcfunction", "wt") as fd: | |
| x, y, z = sink_pos | |
| # print(f"kill @e[type=armor_stand,name=bfs]", file=fd) | |
| while x != -1: | |
| x1 = x + 16 * x0 | |
| y1 = y + 16 * y0 | |
| z1 = z + 16 * z0 | |
| if skip == 0: | |
| text = f"summon minecraft:armor_stand {x1} {y1} {z1} {{CustomName: '\"bfs\"', Marker: 1b, Small: 1b}}" | |
| # print(text, file=fd) | |
| print(text, file=fd2) | |
| skip = SKIP | |
| else: | |
| skip -= 1 | |
| x, y, z = previous[y, z, x] | |
| if False: | |
| print("matplotlib") | |
| import matplotlib.pyplot as plt | |
| # ax = plt.figure().add_subplot(projection="3d") | |
| # ax.set_box_aspect(r) | |
| # ax.scatter(*coords[chunk == 1].T, c="#bb3333") | |
| # ax.scatter(*coords[chunk == 2].T, c="#666666") | |
| canvas = np.amin(distance, axis=0) | |
| canvas[canvas > 1e10] = float("nan") | |
| plt.figure() | |
| plt.imshow(canvas[::-1, ::-1]) | |
| # plt.figure() | |
| # for i, y in enumerate([8, 12, 16, 20, 24, 28]): | |
| # canvas = np.amin(distance[y : y + 4], axis=0) | |
| # canvas[canvas > 1e10] = float("nan") | |
| # plt.subplot(2, 3, i + 1).imshow(canvas[::-1, ::-1]) | |
| plt.show() | |
| if __name__ == "__main__": | |
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from os import PathLike | |
| from pathlib import Path | |
| class Assets: | |
| def __init__(self, path: PathLike, *, track=lambda x: x): | |
| self._path = Path(path) | |
| with open(path / "generated/reports/blocks.json", "rt") as fd: | |
| self._blocks = json.load(fd) | |
| self._states = {} | |
| for block_id, desc in track(self._blocks.items()): | |
| for state in desc["states"]: | |
| self._states[state["id"]] = { | |
| "block_id": block_id, | |
| "desc": desc, | |
| "state": state, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BLOCK_COLORS = { | |
| b"minecraft:acacia_planks": None, | |
| b"minecraft:acacia_slab": None, | |
| b"minecraft:acacia_wood": None, | |
| b"minecraft:air": None, | |
| b"minecraft:amethyst_block": None, | |
| b"minecraft:amethyst_cluster": None, | |
| b"minecraft:ancient_debris": None, | |
| b"minecraft:andesite_slab": (112, 112, 112), | |
| b"minecraft:andesite_stairs": (112, 112, 112), | |
| b"minecraft:andesite_wall": (112, 112, 112), | |
| b"minecraft:andesite": (112, 112, 112), | |
| b"minecraft:anvil": None, | |
| b"minecraft:azalea_leaves": None, | |
| b"minecraft:bamboo_block": None, | |
| b"minecraft:barrel": None, | |
| b"minecraft:basalt": None, | |
| b"minecraft:beacon": None, | |
| b"minecraft:bedrock": None, | |
| b"minecraft:beehive": None, | |
| b"minecraft:bell": None, | |
| b"minecraft:big_dripleaf_stem": None, | |
| b"minecraft:big_dripleaf": None, | |
| b"minecraft:birch_planks": None, | |
| b"minecraft:birch_trapdoor": None, | |
| b"minecraft:black_candle": None, | |
| b"minecraft:black_carpet": None, | |
| b"minecraft:black_concrete_powder": None, | |
| b"minecraft:black_concrete": None, | |
| b"minecraft:black_stained_glass_pane": None, | |
| b"minecraft:black_wool": None, | |
| b"minecraft:blackstone_slab": (25, 25, 25), | |
| b"minecraft:blackstone_stairs": (25, 25, 25), | |
| b"minecraft:blackstone_wall": (25, 25, 25), | |
| b"minecraft:blackstone": (25, 25, 25), | |
| b"minecraft:blast_furnace": None, | |
| b"minecraft:blue_ice": (160, 160, 255), | |
| b"minecraft:blue_stained_glass_pane": None, | |
| b"minecraft:blue_wool": None, | |
| b"minecraft:bone_block": None, | |
| b"minecraft:bookshelf": None, | |
| b"minecraft:brewing_stand": None, | |
| b"minecraft:brown_candle": None, | |
| b"minecraft:brown_mushroom_block": None, | |
| b"minecraft:brown_mushroom": None, | |
| b"minecraft:bubble_column": None, | |
| b"minecraft:calcite": None, | |
| b"minecraft:calibrated_sculk_sensor": None, | |
| b"minecraft:campfire": None, | |
| b"minecraft:candle": None, | |
| b"minecraft:carved_pumpkin": None, | |
| b"minecraft:cauldron": None, | |
| b"minecraft:cave_air": None, | |
| b"minecraft:cave_vines_plant": None, | |
| b"minecraft:cave_vines": None, | |
| b"minecraft:chain": None, | |
| b"minecraft:chest": None, | |
| b"minecraft:chiseled_bookshelf": None, | |
| b"minecraft:chiseled_deepslate": None, | |
| b"minecraft:chiseled_polished_blackstone": None, | |
| b"minecraft:chiseled_sandstone": None, | |
| b"minecraft:chiseled_stone_bricks": (112, 112, 112), | |
| b"minecraft:clay": None, | |
| b"minecraft:coal_block": None, | |
| b"minecraft:coal_ore": (112, 112, 112), | |
| b"minecraft:coarse_dirt": None, | |
| b"minecraft:cobbled_deepslate_slab": None, | |
| b"minecraft:cobbled_deepslate_stairs": None, | |
| b"minecraft:cobbled_deepslate_wall": None, | |
| b"minecraft:cobbled_deepslate": None, | |
| b"minecraft:cobblestone_slab": (112, 112, 112), | |
| b"minecraft:cobblestone_stairs": (112, 112, 112), | |
| b"minecraft:cobblestone_wall": (112, 112, 112), | |
| b"minecraft:cobblestone": (112, 112, 112), | |
| b"minecraft:cobweb": None, | |
| b"minecraft:composter": None, | |
| b"minecraft:copper_ore": None, | |
| b"minecraft:cracked_deepslate_bricks": None, | |
| b"minecraft:cracked_deepslate_tiles": None, | |
| b"minecraft:cracked_polished_blackstone_bricks": None, | |
| b"minecraft:cracked_stone_bricks": (112, 112, 112), | |
| b"minecraft:crimson_button": None, | |
| b"minecraft:crimson_fence_gate": None, | |
| b"minecraft:crimson_nylium": None, | |
| b"minecraft:crimson_slab": None, | |
| b"minecraft:crimson_stem": None, | |
| b"minecraft:crimson_trapdoor": None, | |
| b"minecraft:crying_obsidian": None, | |
| b"minecraft:cut_sandstone_slab": None, | |
| b"minecraft:cut_sandstone": None, | |
| b"minecraft:cyan_candle": None, | |
| b"minecraft:cyan_carpet": None, | |
| b"minecraft:cyan_stained_glass_pane": None, | |
| b"minecraft:cyan_stained_glass": None, | |
| b"minecraft:cyan_terracotta": None, | |
| b"minecraft:cyan_wool": None, | |
| b"minecraft:dark_oak_button": None, | |
| b"minecraft:dark_oak_door": None, | |
| b"minecraft:dark_oak_fence_gate": None, | |
| b"minecraft:dark_oak_fence": None, | |
| b"minecraft:dark_oak_log": None, | |
| b"minecraft:dark_oak_planks": None, | |
| b"minecraft:dark_oak_pressure_plate": None, | |
| b"minecraft:dark_oak_slab": None, | |
| b"minecraft:dark_oak_stairs": None, | |
| b"minecraft:dark_oak_trapdoor": None, | |
| b"minecraft:dark_oak_wall_sign": None, | |
| b"minecraft:dark_oak_wood": None, | |
| b"minecraft:daylight_detector": None, | |
| b"minecraft:dead_brain_coral": None, | |
| b"minecraft:dead_bush": None, | |
| b"minecraft:deepslate_brick_slab": None, | |
| b"minecraft:deepslate_brick_stairs": None, | |
| b"minecraft:deepslate_brick_wall": None, | |
| b"minecraft:deepslate_bricks": None, | |
| b"minecraft:deepslate_copper_ore": None, | |
| b"minecraft:deepslate_diamond_ore": None, | |
| b"minecraft:deepslate_gold_ore": None, | |
| b"minecraft:deepslate_iron_ore": None, | |
| b"minecraft:deepslate_lapis_ore": None, | |
| b"minecraft:deepslate_redstone_ore": None, | |
| b"minecraft:deepslate_tile_slab": None, | |
| b"minecraft:deepslate_tile_stairs": None, | |
| b"minecraft:deepslate_tile_wall": None, | |
| b"minecraft:deepslate_tiles": None, | |
| b"minecraft:deepslate": None, | |
| b"minecraft:diamond_block": None, | |
| b"minecraft:diamond_ore": None, | |
| b"minecraft:diorite_slab": None, | |
| b"minecraft:diorite_stairs": None, | |
| b"minecraft:diorite_wall": None, | |
| b"minecraft:diorite": None, | |
| b"minecraft:dirt": None, | |
| b"minecraft:dispenser": None, | |
| b"minecraft:dripstone_block": None, | |
| b"minecraft:dropper": None, | |
| b"minecraft:enchanting_table": None, | |
| b"minecraft:end_rod": None, | |
| b"minecraft:end_stone": None, | |
| b"minecraft:fire": (255, 0, 0), | |
| b"minecraft:flower_pot": None, | |
| b"minecraft:flowering_azalea_leaves": None, | |
| b"minecraft:flowering_azalea": None, | |
| b"minecraft:gilded_blackstone": None, | |
| b"minecraft:glow_lichen": None, | |
| b"minecraft:glowstone": None, | |
| b"minecraft:gold_block": None, | |
| b"minecraft:gold_ore": (112, 112, 112), | |
| b"minecraft:granite_slab": None, | |
| b"minecraft:granite_stairs": None, | |
| b"minecraft:granite_wall": None, | |
| b"minecraft:granite": None, | |
| b"minecraft:gravel": None, | |
| b"minecraft:gray_candle": None, | |
| b"minecraft:gray_carpet": None, | |
| b"minecraft:gray_wall_banner": None, | |
| b"minecraft:gray_wool": None, | |
| b"minecraft:green_candle": None, | |
| b"minecraft:green_carpet": None, | |
| b"minecraft:grindstone": None, | |
| b"minecraft:hanging_roots": None, | |
| b"minecraft:hay_block": None, | |
| b"minecraft:heavy_weighted_pressure_plate": None, | |
| b"minecraft:honey_block": None, | |
| b"minecraft:hopper": None, | |
| b"minecraft:ice": (160, 160, 255), | |
| b"minecraft:iron_bars": None, | |
| b"minecraft:iron_block": None, | |
| b"minecraft:iron_door": None, | |
| b"minecraft:iron_ore": None, | |
| b"minecraft:iron_trapdoor": None, | |
| b"minecraft:jack_o_lantern": None, | |
| b"minecraft:jungle_door": None, | |
| b"minecraft:jungle_fence_gate": None, | |
| b"minecraft:jungle_fence": None, | |
| b"minecraft:jungle_planks": None, | |
| b"minecraft:jungle_slab": None, | |
| b"minecraft:jungle_stairs": None, | |
| b"minecraft:jungle_trapdoor": None, | |
| b"minecraft:jungle_wall_sign": None, | |
| b"minecraft:kelp_plant": None, | |
| b"minecraft:kelp": None, | |
| b"minecraft:ladder": None, | |
| b"minecraft:lantern": None, | |
| b"minecraft:lapis_block": None, | |
| b"minecraft:lapis_ore": None, | |
| b"minecraft:large_amethyst_bud": None, | |
| b"minecraft:lava_cauldron": None, | |
| b"minecraft:lava": (255, 0, 0), | |
| b"minecraft:lectern": None, | |
| b"minecraft:lever": None, | |
| b"minecraft:light_blue_carpet": None, | |
| b"minecraft:light_blue_stained_glass_pane": None, | |
| b"minecraft:light_blue_terracotta": None, | |
| b"minecraft:light_blue_wool": None, | |
| b"minecraft:light_gray_carpet": None, | |
| b"minecraft:light_gray_wall_banner": None, | |
| b"minecraft:light_weighted_pressure_plate": None, | |
| b"minecraft:lightning_rod": None, | |
| b"minecraft:lily_pad": None, | |
| b"minecraft:lime_stained_glass_pane": None, | |
| b"minecraft:loom": None, | |
| b"minecraft:magenta_terracotta": None, | |
| b"minecraft:magma_block": None, | |
| b"minecraft:mangrove_button": None, | |
| b"minecraft:mangrove_door": None, | |
| b"minecraft:mangrove_fence_gate": None, | |
| b"minecraft:mangrove_fence": None, | |
| b"minecraft:mangrove_leaves": None, | |
| b"minecraft:mangrove_log": None, | |
| b"minecraft:mangrove_planks": None, | |
| b"minecraft:mangrove_roots": None, | |
| b"minecraft:mangrove_slab": None, | |
| b"minecraft:mangrove_stairs": None, | |
| b"minecraft:mangrove_trapdoor": None, | |
| b"minecraft:mangrove_wall_sign": None, | |
| b"minecraft:mangrove_wood": None, | |
| b"minecraft:medium_amethyst_bud": None, | |
| b"minecraft:moss_block": None, | |
| b"minecraft:moss_carpet": None, | |
| b"minecraft:mossy_cobblestone_slab": None, | |
| b"minecraft:mossy_cobblestone_stairs": None, | |
| b"minecraft:mossy_cobblestone_wall": None, | |
| b"minecraft:mossy_cobblestone": None, | |
| b"minecraft:mossy_stone_brick_slab": None, | |
| b"minecraft:mossy_stone_brick_stairs": None, | |
| b"minecraft:mossy_stone_brick_wall": None, | |
| b"minecraft:mossy_stone_bricks": None, | |
| b"minecraft:mud_brick_slab": None, | |
| b"minecraft:mud_brick_stairs": None, | |
| b"minecraft:mud_brick_wall": None, | |
| b"minecraft:mud_bricks": None, | |
| b"minecraft:mud": None, | |
| b"minecraft:muddy_mangrove_roots": None, | |
| b"minecraft:mushroom_stem": None, | |
| b"minecraft:mycelium": None, | |
| b"minecraft:nether_brick_fence": None, | |
| b"minecraft:nether_brick_slab": None, | |
| b"minecraft:nether_brick_stairs": None, | |
| b"minecraft:nether_brick_wall": None, | |
| b"minecraft:nether_bricks": None, | |
| b"minecraft:nether_quartz_ore": None, | |
| b"minecraft:nether_sprouts": None, | |
| b"minecraft:nether_wart_block": None, | |
| b"minecraft:netherite_block": None, | |
| b"minecraft:netherrack": None, | |
| b"minecraft:note_block": None, | |
| b"minecraft:oak_door": None, | |
| b"minecraft:oak_fence": None, | |
| b"minecraft:oak_leaves": None, | |
| b"minecraft:oak_log": None, | |
| b"minecraft:oak_stairs": None, | |
| b"minecraft:oak_trapdoor": None, | |
| b"minecraft:oak_wall_sign": None, | |
| b"minecraft:oak_wood": None, | |
| b"minecraft:observer": None, | |
| b"minecraft:obsidian": None, | |
| b"minecraft:ochre_froglight": None, | |
| b"minecraft:orange_carpet": None, | |
| b"minecraft:orange_terracotta": None, | |
| b"minecraft:oxidized_copper": (22, 126, 134), | |
| b"minecraft:oxidized_cut_copper_slab": (22, 126, 134), | |
| b"minecraft:packed_ice": (160, 160, 255), | |
| b"minecraft:packed_mud": None, | |
| b"minecraft:piston_head": None, | |
| b"minecraft:player_head": None, | |
| b"minecraft:player_wall_head": None, | |
| b"minecraft:podzol": None, | |
| b"minecraft:pointed_dripstone": None, | |
| b"minecraft:polished_andesite_stairs": (112, 112, 112), | |
| b"minecraft:polished_andesite": (112, 112, 112), | |
| b"minecraft:polished_basalt": None, | |
| b"minecraft:polished_blackstone_brick_slab": (25, 25, 25), | |
| b"minecraft:polished_blackstone_brick_stairs": (25, 25, 25), | |
| b"minecraft:polished_blackstone_brick_wall": (25, 25, 25), | |
| b"minecraft:polished_blackstone_bricks": (25, 25, 25), | |
| b"minecraft:polished_blackstone_button": None, | |
| b"minecraft:polished_blackstone_pressure_plate": None, | |
| b"minecraft:polished_blackstone_slab": (25, 25, 25), | |
| b"minecraft:polished_blackstone_stairs": (25, 25, 25), | |
| b"minecraft:polished_blackstone_wall": (25, 25, 25), | |
| b"minecraft:polished_blackstone": (25, 25, 25), | |
| b"minecraft:polished_deepslate_slab": None, | |
| b"minecraft:polished_deepslate_stairs": None, | |
| b"minecraft:polished_deepslate_wall": None, | |
| b"minecraft:polished_deepslate": None, | |
| b"minecraft:polished_granite_slab": None, | |
| b"minecraft:polished_granite_stairs": None, | |
| b"minecraft:polished_granite": None, | |
| b"minecraft:potted_brown_mushroom": None, | |
| b"minecraft:potted_crimson_fungus": None, | |
| b"minecraft:potted_dead_bush": None, | |
| b"minecraft:potted_warped_fungus": None, | |
| b"minecraft:potted_warped_roots": None, | |
| b"minecraft:potted_wither_rose": None, | |
| b"minecraft:powder_snow": (255, 255, 255), | |
| b"minecraft:pumpkin": None, | |
| b"minecraft:purple_terracotta": None, | |
| b"minecraft:quartz_block": None, | |
| b"minecraft:quartz_slab": None, | |
| b"minecraft:quartz_stairs": None, | |
| b"minecraft:rail": None, | |
| b"minecraft:raw_copper_block": (216, 127, 51), | |
| b"minecraft:raw_gold_block": None, | |
| b"minecraft:raw_iron_block": None, | |
| b"minecraft:red_candle": None, | |
| b"minecraft:red_carpet": None, | |
| b"minecraft:red_concrete": None, | |
| b"minecraft:red_mushroom_block": None, | |
| b"minecraft:red_mushroom": None, | |
| b"minecraft:red_nether_bricks": None, | |
| b"minecraft:red_sand": None, | |
| b"minecraft:red_stained_glass_pane": None, | |
| b"minecraft:red_stained_glass": None, | |
| b"minecraft:red_wall_banner": None, | |
| b"minecraft:red_wool": None, | |
| b"minecraft:redstone_block": (255, 0, 0), | |
| b"minecraft:redstone_torch": None, | |
| b"minecraft:redstone_wire": None, | |
| b"minecraft:respawn_anchor": None, | |
| b"minecraft:rooted_dirt": None, | |
| b"minecraft:sandstone_stairs": None, | |
| b"minecraft:sandstone": None, | |
| b"minecraft:scaffolding": None, | |
| b"minecraft:sculk_shrieker": None, | |
| b"minecraft:sculk_vein": None, | |
| b"minecraft:sculk": None, | |
| b"minecraft:sea_lantern": None, | |
| b"minecraft:sea_pickle": None, | |
| b"minecraft:seagrass": None, | |
| b"minecraft:shroomlight": None, | |
| b"minecraft:skeleton_skull": None, | |
| b"minecraft:small_amethyst_bud": None, | |
| b"minecraft:smithing_table": None, | |
| b"minecraft:smoker": None, | |
| b"minecraft:smooth_basalt": None, | |
| b"minecraft:smooth_quartz_slab": None, | |
| b"minecraft:smooth_quartz_stairs": None, | |
| b"minecraft:smooth_quartz": None, | |
| b"minecraft:smooth_red_sandstone": None, | |
| b"minecraft:smooth_sandstone_slab": None, | |
| b"minecraft:smooth_sandstone_stairs": None, | |
| b"minecraft:smooth_stone_slab": None, | |
| b"minecraft:smooth_stone": None, | |
| b"minecraft:snow_block": (255, 255, 255), | |
| b"minecraft:snow": (255, 255, 255), | |
| b"minecraft:soul_campfire": None, | |
| b"minecraft:soul_fire": None, | |
| b"minecraft:soul_lantern": None, | |
| b"minecraft:soul_sand": None, | |
| b"minecraft:soul_soil": None, | |
| b"minecraft:soul_torch": None, | |
| b"minecraft:soul_wall_torch": None, | |
| b"minecraft:spore_blossom": None, | |
| b"minecraft:spruce_fence_gate": None, | |
| b"minecraft:spruce_fence": None, | |
| b"minecraft:spruce_log": None, | |
| b"minecraft:spruce_planks": None, | |
| b"minecraft:spruce_pressure_plate": None, | |
| b"minecraft:spruce_sign": None, | |
| b"minecraft:spruce_slab": None, | |
| b"minecraft:spruce_stairs": None, | |
| b"minecraft:spruce_trapdoor": None, | |
| b"minecraft:spruce_wall_sign": None, | |
| b"minecraft:spruce_wood": None, | |
| b"minecraft:sticky_piston": None, | |
| b"minecraft:stone_brick_slab": (112, 112, 112), | |
| b"minecraft:stone_brick_stairs": (112, 112, 112), | |
| b"minecraft:stone_brick_wall": (112, 112, 112), | |
| b"minecraft:stone_bricks": (112, 112, 112), | |
| b"minecraft:stone_button": None, | |
| b"minecraft:stone_pressure_plate": None, | |
| b"minecraft:stone_slab": (112, 112, 112), | |
| b"minecraft:stone_stairs": (112, 112, 112), | |
| b"minecraft:stone": (112, 112, 112), | |
| b"minecraft:stonecutter": (112, 112, 112), | |
| b"minecraft:stripped_birch_log": None, | |
| b"minecraft:stripped_dark_oak_log": None, | |
| b"minecraft:stripped_dark_oak_wood": None, | |
| b"minecraft:stripped_jungle_log": None, | |
| b"minecraft:stripped_jungle_wood": None, | |
| b"minecraft:stripped_mangrove_log": None, | |
| b"minecraft:stripped_mangrove_wood": None, | |
| b"minecraft:stripped_spruce_log": None, | |
| b"minecraft:stripped_spruce_wood": None, | |
| b"minecraft:stripped_warped_hyphae": None, | |
| b"minecraft:stripped_warped_stem": None, | |
| b"minecraft:sweet_berry_bush": None, | |
| b"minecraft:tall_seagrass": None, | |
| b"minecraft:terracotta": None, | |
| b"minecraft:tnt": (255, 0, 0), | |
| b"minecraft:torch": None, | |
| b"minecraft:trapped_chest": None, | |
| b"minecraft:tripwire_hook": None, | |
| b"minecraft:tripwire": None, | |
| b"minecraft:tuff": None, | |
| b"minecraft:turtle_egg": None, | |
| b"minecraft:twisting_vines_plant": None, | |
| b"minecraft:twisting_vines": None, | |
| b"minecraft:vine": None, | |
| b"minecraft:wall_torch": None, | |
| b"minecraft:warped_button": None, | |
| b"minecraft:warped_fence_gate": (20, 180, 133), | |
| b"minecraft:warped_fence": (20, 180, 133), | |
| b"minecraft:warped_fungus": None, | |
| b"minecraft:warped_hanging_sign": (20, 180, 133), | |
| b"minecraft:warped_nylium": (20, 180, 133), | |
| b"minecraft:warped_planks": (20, 180, 133), | |
| b"minecraft:warped_pressure_plate": None, | |
| b"minecraft:warped_roots": (20, 180, 133), | |
| b"minecraft:warped_sign": None, | |
| b"minecraft:warped_slab": (20, 180, 133), | |
| b"minecraft:warped_stairs": (20, 180, 133), | |
| b"minecraft:warped_trapdoor": (20, 180, 133), | |
| b"minecraft:warped_wall_sign": None, | |
| b"minecraft:warped_wart_block": (20, 180, 133), | |
| b"minecraft:water": (64, 64, 255), | |
| b"minecraft:waxed_cut_copper": (216, 127, 51), | |
| b"minecraft:waxed_exposed_copper": (135, 107, 98), | |
| b"minecraft:white_carpet": None, | |
| b"minecraft:wither_rose": None, | |
| b"minecraft:wither_skeleton_skull": None, | |
| b"minecraft:wither_skeleton_wall_skull": None, | |
| b"minecraft:yellow_candle": None, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TRANSPARENT_BLOCKS = [ | |
| # b"minecraft:acacia_planks", | |
| # b"minecraft:acacia_slab", | |
| # b"minecraft:acacia_wood", | |
| b"minecraft:air", | |
| # b"minecraft:amethyst_block", | |
| b"minecraft:amethyst_cluster", | |
| # b"minecraft:ancient_debris", | |
| # b"minecraft:andesite_slab", | |
| # b"minecraft:andesite_stairs", | |
| # b"minecraft:andesite_wall", | |
| # b"minecraft:andesite", | |
| b"minecraft:anvil", | |
| b"minecraft:azalea_leaves", | |
| # b"minecraft:bamboo_block", | |
| # b"minecraft:barrel", | |
| # b"minecraft:basalt", | |
| b"minecraft:beacon", | |
| # b"minecraft:bedrock", | |
| # b"minecraft:beehive", | |
| b"minecraft:bell", | |
| b"minecraft:big_dripleaf_stem", | |
| b"minecraft:big_dripleaf", | |
| # b"minecraft:birch_planks", | |
| b"minecraft:birch_trapdoor", | |
| b"minecraft:black_candle", | |
| b"minecraft:black_carpet", | |
| # b"minecraft:black_concrete_powder", | |
| # b"minecraft:black_concrete", | |
| b"minecraft:black_stained_glass_pane", | |
| # b"minecraft:black_wool", | |
| # b"minecraft:blackstone_slab", | |
| # b"minecraft:blackstone_stairs", | |
| # b"minecraft:blackstone_wall", | |
| # b"minecraft:blackstone", | |
| # b"minecraft:blast_furnace", | |
| # b"minecraft:blue_ice", | |
| b"minecraft:blue_stained_glass_pane", | |
| # b"minecraft:blue_wool", | |
| # b"minecraft:bone_block", | |
| # b"minecraft:bookshelf", | |
| b"minecraft:brewing_stand", | |
| b"minecraft:brown_candle", | |
| # b"minecraft:brown_mushroom_block", | |
| b"minecraft:brown_mushroom", | |
| b"minecraft:bubble_column", | |
| # b"minecraft:calcite", | |
| b"minecraft:calibrated_sculk_sensor", | |
| b"minecraft:campfire", | |
| b"minecraft:candle", | |
| # b"minecraft:carved_pumpkin", | |
| b"minecraft:cauldron", | |
| b"minecraft:cave_air", | |
| b"minecraft:cave_vines_plant", | |
| b"minecraft:cave_vines", | |
| b"minecraft:chain", | |
| b"minecraft:chest", | |
| # b"minecraft:chiseled_bookshelf", | |
| # b"minecraft:chiseled_deepslate", | |
| # b"minecraft:chiseled_polished_blackstone", | |
| # b"minecraft:chiseled_sandstone", | |
| # b"minecraft:chiseled_stone_bricks", | |
| # b"minecraft:clay", | |
| # b"minecraft:coal_block", | |
| # b"minecraft:coal_ore", | |
| # b"minecraft:coarse_dirt", | |
| # b"minecraft:cobbled_deepslate_slab", | |
| # b"minecraft:cobbled_deepslate_stairs", | |
| # b"minecraft:cobbled_deepslate_wall", | |
| # b"minecraft:cobbled_deepslate", | |
| # b"minecraft:cobblestone_slab", | |
| # b"minecraft:cobblestone_stairs", | |
| # b"minecraft:cobblestone_wall", | |
| # b"minecraft:cobblestone", | |
| b"minecraft:cobweb", | |
| # b"minecraft:composter", | |
| # b"minecraft:copper_ore", | |
| # b"minecraft:cracked_deepslate_bricks", | |
| # b"minecraft:cracked_deepslate_tiles", | |
| # b"minecraft:cracked_polished_blackstone_bricks", | |
| # b"minecraft:cracked_stone_bricks", | |
| b"minecraft:crimson_button", | |
| b"minecraft:crimson_fence_gate", | |
| # b"minecraft:crimson_nylium", | |
| # b"minecraft:crimson_slab", | |
| # b"minecraft:crimson_stem", | |
| b"minecraft:crimson_trapdoor", | |
| # b"minecraft:crying_obsidian", | |
| # b"minecraft:cut_sandstone_slab", | |
| # b"minecraft:cut_sandstone", | |
| b"minecraft:cyan_candle", | |
| b"minecraft:cyan_carpet", | |
| b"minecraft:cyan_stained_glass_pane", | |
| b"minecraft:cyan_stained_glass", | |
| # b"minecraft:cyan_terracotta", | |
| # b"minecraft:cyan_wool", | |
| b"minecraft:dark_oak_button", | |
| b"minecraft:dark_oak_door", | |
| b"minecraft:dark_oak_fence_gate", | |
| b"minecraft:dark_oak_fence", | |
| # b"minecraft:dark_oak_log", | |
| # b"minecraft:dark_oak_planks", | |
| b"minecraft:dark_oak_pressure_plate", | |
| # b"minecraft:dark_oak_slab", | |
| # b"minecraft:dark_oak_stairs", | |
| b"minecraft:dark_oak_trapdoor", | |
| b"minecraft:dark_oak_wall_sign", | |
| # b"minecraft:dark_oak_wood", | |
| b"minecraft:daylight_detector", | |
| b"minecraft:dead_brain_coral", | |
| b"minecraft:dead_bush", | |
| # b"minecraft:deepslate_brick_slab", | |
| # b"minecraft:deepslate_brick_stairs", | |
| # b"minecraft:deepslate_brick_wall", | |
| # b"minecraft:deepslate_bricks", | |
| # b"minecraft:deepslate_copper_ore", | |
| # b"minecraft:deepslate_diamond_ore", | |
| # b"minecraft:deepslate_gold_ore", | |
| # b"minecraft:deepslate_iron_ore", | |
| # b"minecraft:deepslate_lapis_ore", | |
| # b"minecraft:deepslate_redstone_ore", | |
| # b"minecraft:deepslate_tile_slab", | |
| # b"minecraft:deepslate_tile_stairs", | |
| # b"minecraft:deepslate_tile_wall", | |
| # b"minecraft:deepslate_tiles", | |
| # b"minecraft:deepslate", | |
| # b"minecraft:diamond_block", | |
| # b"minecraft:diamond_ore", | |
| # b"minecraft:diorite_slab", | |
| # b"minecraft:diorite_stairs", | |
| # b"minecraft:diorite_wall", | |
| # b"minecraft:diorite", | |
| # b"minecraft:dirt", | |
| # b"minecraft:dispenser", | |
| # b"minecraft:dripstone_block", | |
| # b"minecraft:dropper", | |
| b"minecraft:enchanting_table", | |
| b"minecraft:end_rod", | |
| # b"minecraft:end_stone", | |
| b"minecraft:fire", | |
| b"minecraft:flower_pot", | |
| b"minecraft:flowering_azalea_leaves", | |
| b"minecraft:flowering_azalea", | |
| # b"minecraft:gilded_blackstone", | |
| b"minecraft:glow_lichen", | |
| # b"minecraft:glowstone", | |
| # b"minecraft:gold_block", | |
| # b"minecraft:gold_ore", | |
| # b"minecraft:granite_slab", | |
| # b"minecraft:granite_stairs", | |
| # b"minecraft:granite_wall", | |
| # b"minecraft:granite", | |
| # b"minecraft:gravel", | |
| b"minecraft:gray_candle", | |
| b"minecraft:gray_carpet", | |
| b"minecraft:gray_wall_banner", | |
| # b"minecraft:gray_wool", | |
| b"minecraft:green_candle", | |
| b"minecraft:green_carpet", | |
| b"minecraft:grindstone", | |
| b"minecraft:hanging_roots", | |
| # b"minecraft:hay_block", | |
| b"minecraft:heavy_weighted_pressure_plate", | |
| b"minecraft:honey_block", | |
| b"minecraft:hopper", | |
| b"minecraft:ice", | |
| b"minecraft:iron_bars", | |
| # b"minecraft:iron_block", | |
| b"minecraft:iron_door", | |
| # b"minecraft:iron_ore", | |
| b"minecraft:iron_trapdoor", | |
| # b"minecraft:jack_o_lantern", | |
| b"minecraft:jungle_door", | |
| b"minecraft:jungle_fence_gate", | |
| b"minecraft:jungle_fence", | |
| # b"minecraft:jungle_planks", | |
| # b"minecraft:jungle_slab", | |
| # b"minecraft:jungle_stairs", | |
| b"minecraft:jungle_trapdoor", | |
| b"minecraft:jungle_wall_sign", | |
| b"minecraft:kelp_plant", | |
| b"minecraft:kelp", | |
| b"minecraft:ladder", | |
| b"minecraft:lantern", | |
| # b"minecraft:lapis_block", | |
| # b"minecraft:lapis_ore", | |
| b"minecraft:large_amethyst_bud", | |
| b"minecraft:lava_cauldron", | |
| b"minecraft:lava", | |
| b"minecraft:lectern", | |
| b"minecraft:lever", | |
| b"minecraft:light_blue_carpet", | |
| b"minecraft:light_blue_stained_glass_pane", | |
| # b"minecraft:light_blue_terracotta", | |
| # b"minecraft:light_blue_wool", | |
| b"minecraft:light_gray_carpet", | |
| b"minecraft:light_gray_wall_banner", | |
| b"minecraft:light_weighted_pressure_plate", | |
| b"minecraft:lightning_rod", | |
| b"minecraft:lily_pad", | |
| b"minecraft:lime_stained_glass_pane", | |
| # b"minecraft:loom", | |
| # b"minecraft:magenta_terracotta", | |
| # b"minecraft:magma_block", | |
| b"minecraft:mangrove_button", | |
| b"minecraft:mangrove_door", | |
| b"minecraft:mangrove_fence_gate", | |
| b"minecraft:mangrove_fence", | |
| b"minecraft:mangrove_leaves", | |
| # b"minecraft:mangrove_log", | |
| # b"minecraft:mangrove_planks", | |
| b"minecraft:mangrove_roots", | |
| # b"minecraft:mangrove_slab", | |
| # b"minecraft:mangrove_stairs", | |
| b"minecraft:mangrove_trapdoor", | |
| b"minecraft:mangrove_wall_sign", | |
| # b"minecraft:mangrove_wood", | |
| b"minecraft:medium_amethyst_bud", | |
| # b"minecraft:moss_block", | |
| b"minecraft:moss_carpet", | |
| # b"minecraft:mossy_cobblestone_slab", | |
| # b"minecraft:mossy_cobblestone_stairs", | |
| # b"minecraft:mossy_cobblestone_wall", | |
| # b"minecraft:mossy_cobblestone", | |
| # b"minecraft:mossy_stone_brick_slab", | |
| # b"minecraft:mossy_stone_brick_stairs", | |
| # b"minecraft:mossy_stone_brick_wall", | |
| # b"minecraft:mossy_stone_bricks", | |
| # b"minecraft:mud_brick_slab", | |
| # b"minecraft:mud_brick_stairs", | |
| # b"minecraft:mud_brick_wall", | |
| # b"minecraft:mud_bricks", | |
| # b"minecraft:mud", | |
| # b"minecraft:muddy_mangrove_roots", | |
| # b"minecraft:mushroom_stem", | |
| # b"minecraft:mycelium", | |
| b"minecraft:nether_brick_fence", | |
| # b"minecraft:nether_brick_slab", | |
| # b"minecraft:nether_brick_stairs", | |
| # b"minecraft:nether_brick_wall", | |
| # b"minecraft:nether_bricks", | |
| # b"minecraft:nether_quartz_ore", | |
| b"minecraft:nether_sprouts", | |
| # b"minecraft:nether_wart_block", | |
| # b"minecraft:netherite_block", | |
| # b"minecraft:netherrack", | |
| # b"minecraft:note_block", | |
| b"minecraft:oak_door", | |
| b"minecraft:oak_fence", | |
| b"minecraft:oak_leaves", | |
| # b"minecraft:oak_log", | |
| # b"minecraft:oak_stairs", | |
| b"minecraft:oak_trapdoor", | |
| b"minecraft:oak_wall_sign", | |
| # b"minecraft:oak_wood", | |
| # b"minecraft:observer", | |
| # b"minecraft:obsidian", | |
| # b"minecraft:ochre_froglight", | |
| b"minecraft:orange_carpet", | |
| # b"minecraft:orange_terracotta", | |
| # b"minecraft:oxidized_copper", | |
| # b"minecraft:oxidized_cut_copper_slab", | |
| # b"minecraft:packed_ice", | |
| # b"minecraft:packed_mud", | |
| b"minecraft:piston_head", | |
| b"minecraft:player_head", | |
| b"minecraft:player_wall_head", | |
| # b"minecraft:podzol", | |
| b"minecraft:pointed_dripstone", | |
| # b"minecraft:polished_andesite_stairs", | |
| # b"minecraft:polished_andesite", | |
| # b"minecraft:polished_basalt", | |
| # b"minecraft:polished_blackstone_brick_slab", | |
| # b"minecraft:polished_blackstone_brick_stairs", | |
| # b"minecraft:polished_blackstone_brick_wall", | |
| # b"minecraft:polished_blackstone_bricks", | |
| b"minecraft:polished_blackstone_button", | |
| b"minecraft:polished_blackstone_pressure_plate", | |
| # b"minecraft:polished_blackstone_slab", | |
| # b"minecraft:polished_blackstone_stairs", | |
| # b"minecraft:polished_blackstone_wall", | |
| # b"minecraft:polished_blackstone", | |
| # b"minecraft:polished_deepslate_slab", | |
| # b"minecraft:polished_deepslate_stairs", | |
| # b"minecraft:polished_deepslate_wall", | |
| # b"minecraft:polished_deepslate", | |
| # b"minecraft:polished_granite_slab", | |
| # b"minecraft:polished_granite_stairs", | |
| # b"minecraft:polished_granite", | |
| b"minecraft:potted_brown_mushroom", | |
| b"minecraft:potted_crimson_fungus", | |
| b"minecraft:potted_dead_bush", | |
| b"minecraft:potted_warped_fungus", | |
| b"minecraft:potted_warped_roots", | |
| b"minecraft:potted_wither_rose", | |
| b"minecraft:powder_snow", | |
| # b"minecraft:pumpkin", | |
| # b"minecraft:purple_terracotta", | |
| # b"minecraft:quartz_block", | |
| # b"minecraft:quartz_slab", | |
| # b"minecraft:quartz_stairs", | |
| b"minecraft:rail", | |
| # b"minecraft:raw_copper_block", | |
| # b"minecraft:raw_gold_block", | |
| # b"minecraft:raw_iron_block", | |
| b"minecraft:red_candle", | |
| b"minecraft:red_carpet", | |
| # b"minecraft:red_concrete", | |
| # b"minecraft:red_mushroom_block", | |
| b"minecraft:red_mushroom", | |
| # b"minecraft:red_nether_bricks", | |
| # b"minecraft:red_sand", | |
| b"minecraft:red_stained_glass_pane", | |
| # b"minecraft:red_stained_glass", | |
| b"minecraft:red_wall_banner", | |
| # b"minecraft:red_wool", | |
| # b"minecraft:redstone_block", | |
| b"minecraft:redstone_torch", | |
| b"minecraft:redstone_wire", | |
| # b"minecraft:respawn_anchor", | |
| # b"minecraft:rooted_dirt", | |
| # b"minecraft:sandstone_stairs", | |
| # b"minecraft:sandstone", | |
| b"minecraft:scaffolding", | |
| b"minecraft:sculk_shrieker", | |
| b"minecraft:sculk_vein", | |
| # b"minecraft:sculk", | |
| # b"minecraft:sea_lantern", | |
| b"minecraft:sea_pickle", | |
| b"minecraft:seagrass", | |
| # b"minecraft:shroomlight", | |
| b"minecraft:skeleton_skull", | |
| b"minecraft:small_amethyst_bud", | |
| # b"minecraft:smithing_table", | |
| # b"minecraft:smoker", | |
| # b"minecraft:smooth_basalt", | |
| # b"minecraft:smooth_quartz_slab", | |
| # b"minecraft:smooth_quartz_stairs", | |
| # b"minecraft:smooth_quartz", | |
| # b"minecraft:smooth_red_sandstone", | |
| # b"minecraft:smooth_sandstone_slab", | |
| # b"minecraft:smooth_sandstone_stairs", | |
| # b"minecraft:smooth_stone_slab", | |
| # b"minecraft:smooth_stone", | |
| # b"minecraft:snow_block", | |
| b"minecraft:snow", | |
| b"minecraft:soul_campfire", | |
| b"minecraft:soul_fire", | |
| b"minecraft:soul_lantern", | |
| # b"minecraft:soul_sand", | |
| # b"minecraft:soul_soil", | |
| b"minecraft:soul_torch", | |
| b"minecraft:soul_wall_torch", | |
| b"minecraft:spore_blossom", | |
| b"minecraft:spruce_fence_gate", | |
| b"minecraft:spruce_fence", | |
| # b"minecraft:spruce_log", | |
| # b"minecraft:spruce_planks", | |
| b"minecraft:spruce_pressure_plate", | |
| b"minecraft:spruce_sign", | |
| # b"minecraft:spruce_slab", | |
| # b"minecraft:spruce_stairs", | |
| b"minecraft:spruce_trapdoor", | |
| b"minecraft:spruce_wall_sign", | |
| # b"minecraft:spruce_wood", | |
| # b"minecraft:sticky_piston", | |
| # b"minecraft:stone_brick_slab", | |
| # b"minecraft:stone_brick_stairs", | |
| # b"minecraft:stone_brick_wall", | |
| # b"minecraft:stone_bricks", | |
| b"minecraft:stone_button", | |
| b"minecraft:stone_pressure_plate", | |
| # b"minecraft:stone_slab", | |
| # b"minecraft:stone_stairs", | |
| # b"minecraft:stone", | |
| b"minecraft:stonecutter", | |
| # b"minecraft:stripped_birch_log", | |
| # b"minecraft:stripped_dark_oak_log", | |
| # b"minecraft:stripped_dark_oak_wood", | |
| # b"minecraft:stripped_jungle_log", | |
| # b"minecraft:stripped_jungle_wood", | |
| # b"minecraft:stripped_mangrove_log", | |
| # b"minecraft:stripped_mangrove_wood", | |
| # b"minecraft:stripped_spruce_log", | |
| # b"minecraft:stripped_spruce_wood", | |
| # b"minecraft:stripped_warped_hyphae", | |
| # b"minecraft:stripped_warped_stem", | |
| b"minecraft:sweet_berry_bush", | |
| b"minecraft:tall_seagrass", | |
| # b"minecraft:terracotta", | |
| # b"minecraft:tnt", | |
| b"minecraft:torch", | |
| b"minecraft:trapped_chest", | |
| b"minecraft:tripwire_hook", | |
| b"minecraft:tripwire", | |
| # b"minecraft:tuff", | |
| b"minecraft:turtle_egg", | |
| b"minecraft:twisting_vines_plant", | |
| b"minecraft:twisting_vines", | |
| b"minecraft:vine", | |
| b"minecraft:wall_torch", | |
| b"minecraft:warped_button", | |
| b"minecraft:warped_fence_gate", | |
| b"minecraft:warped_fence", | |
| b"minecraft:warped_fungus", | |
| b"minecraft:warped_hanging_sign", | |
| # b"minecraft:warped_nylium", | |
| # b"minecraft:warped_planks", | |
| b"minecraft:warped_pressure_plate", | |
| b"minecraft:warped_roots", | |
| b"minecraft:warped_sign", | |
| # b"minecraft:warped_slab", | |
| # b"minecraft:warped_stairs", | |
| b"minecraft:warped_trapdoor", | |
| b"minecraft:warped_wall_sign", | |
| # b"minecraft:warped_wart_block", | |
| b"minecraft:water", | |
| # b"minecraft:waxed_cut_copper", | |
| # b"minecraft:waxed_exposed_copper", | |
| b"minecraft:white_carpet", | |
| b"minecraft:wither_rose", | |
| b"minecraft:wither_skeleton_skull", | |
| b"minecraft:wither_skeleton_wall_skull", | |
| b"minecraft:yellow_candle", | |
| ] | |
| if True: | |
| TRANSPARENT_BLOCKS = [ | |
| # b"minecraft:acacia_planks", | |
| # b"minecraft:acacia_slab", | |
| # b"minecraft:acacia_wood", | |
| b"minecraft:air", | |
| # b"minecraft:amethyst_block", | |
| b"minecraft:amethyst_cluster", | |
| # b"minecraft:ancient_debris", | |
| # b"minecraft:andesite_slab", | |
| # b"minecraft:andesite_stairs", | |
| # b"minecraft:andesite_wall", | |
| # b"minecraft:andesite", | |
| b"minecraft:anvil", | |
| b"minecraft:azalea_leaves", | |
| # b"minecraft:bamboo_block", | |
| # b"minecraft:barrel", | |
| # b"minecraft:basalt", | |
| b"minecraft:beacon", | |
| # b"minecraft:bedrock", | |
| # b"minecraft:beehive", | |
| b"minecraft:bell", | |
| b"minecraft:big_dripleaf_stem", | |
| b"minecraft:big_dripleaf", | |
| # b"minecraft:birch_planks", | |
| b"minecraft:birch_trapdoor", | |
| b"minecraft:black_candle", | |
| b"minecraft:black_carpet", | |
| # b"minecraft:black_concrete_powder", | |
| # b"minecraft:black_concrete", | |
| b"minecraft:black_stained_glass_pane", | |
| # b"minecraft:black_wool", | |
| # b"minecraft:blackstone_slab", | |
| # b"minecraft:blackstone_stairs", | |
| # b"minecraft:blackstone_wall", | |
| # b"minecraft:blackstone", | |
| # b"minecraft:blast_furnace", | |
| # b"minecraft:blue_ice", | |
| b"minecraft:blue_stained_glass_pane", | |
| # b"minecraft:blue_wool", | |
| # b"minecraft:bone_block", | |
| # b"minecraft:bookshelf", | |
| b"minecraft:brewing_stand", | |
| b"minecraft:brown_candle", | |
| # b"minecraft:brown_mushroom_block", | |
| b"minecraft:brown_mushroom", | |
| b"minecraft:bubble_column", | |
| # b"minecraft:calcite", | |
| # b"minecraft:calibrated_sculk_sensor", | |
| # b"minecraft:campfire", | |
| b"minecraft:candle", | |
| # b"minecraft:carved_pumpkin", | |
| b"minecraft:cauldron", | |
| b"minecraft:cave_air", | |
| b"minecraft:cave_vines_plant", | |
| b"minecraft:cave_vines", | |
| b"minecraft:chain", | |
| b"minecraft:chest", | |
| # b"minecraft:chiseled_bookshelf", | |
| # b"minecraft:chiseled_deepslate", | |
| # b"minecraft:chiseled_polished_blackstone", | |
| # b"minecraft:chiseled_sandstone", | |
| # b"minecraft:chiseled_stone_bricks", | |
| # b"minecraft:clay", | |
| # b"minecraft:coal_block", | |
| # b"minecraft:coal_ore", | |
| # b"minecraft:coarse_dirt", | |
| # b"minecraft:cobbled_deepslate_slab", | |
| # b"minecraft:cobbled_deepslate_stairs", | |
| # b"minecraft:cobbled_deepslate_wall", | |
| # b"minecraft:cobbled_deepslate", | |
| # b"minecraft:cobblestone_slab", | |
| # b"minecraft:cobblestone_stairs", | |
| # b"minecraft:cobblestone_wall", | |
| # b"minecraft:cobblestone", | |
| b"minecraft:cobweb", | |
| # b"minecraft:composter", | |
| # b"minecraft:copper_ore", | |
| # b"minecraft:cracked_deepslate_bricks", | |
| # b"minecraft:cracked_deepslate_tiles", | |
| # b"minecraft:cracked_polished_blackstone_bricks", | |
| # b"minecraft:cracked_stone_bricks", | |
| b"minecraft:crimson_button", | |
| b"minecraft:crimson_fence_gate", | |
| # b"minecraft:crimson_nylium", | |
| # b"minecraft:crimson_slab", | |
| # b"minecraft:crimson_stem", | |
| b"minecraft:crimson_trapdoor", | |
| # b"minecraft:crying_obsidian", | |
| # b"minecraft:cut_sandstone_slab", | |
| # b"minecraft:cut_sandstone", | |
| b"minecraft:cyan_candle", | |
| b"minecraft:cyan_carpet", | |
| b"minecraft:cyan_stained_glass_pane", | |
| b"minecraft:cyan_stained_glass", | |
| # b"minecraft:cyan_terracotta", | |
| # b"minecraft:cyan_wool", | |
| b"minecraft:dark_oak_button", | |
| b"minecraft:dark_oak_door", | |
| b"minecraft:dark_oak_fence_gate", | |
| b"minecraft:dark_oak_fence", | |
| # b"minecraft:dark_oak_log", | |
| # b"minecraft:dark_oak_planks", | |
| b"minecraft:dark_oak_pressure_plate", | |
| # b"minecraft:dark_oak_slab", | |
| # b"minecraft:dark_oak_stairs", | |
| b"minecraft:dark_oak_trapdoor", | |
| b"minecraft:dark_oak_wall_sign", | |
| # b"minecraft:dark_oak_wood", | |
| b"minecraft:daylight_detector", | |
| b"minecraft:dead_brain_coral", | |
| b"minecraft:dead_bush", | |
| # b"minecraft:deepslate_brick_slab", | |
| # b"minecraft:deepslate_brick_stairs", | |
| # b"minecraft:deepslate_brick_wall", | |
| # b"minecraft:deepslate_bricks", | |
| # b"minecraft:deepslate_copper_ore", | |
| # b"minecraft:deepslate_diamond_ore", | |
| # b"minecraft:deepslate_gold_ore", | |
| # b"minecraft:deepslate_iron_ore", | |
| # b"minecraft:deepslate_lapis_ore", | |
| # b"minecraft:deepslate_redstone_ore", | |
| # b"minecraft:deepslate_tile_slab", | |
| # b"minecraft:deepslate_tile_stairs", | |
| # b"minecraft:deepslate_tile_wall", | |
| # b"minecraft:deepslate_tiles", | |
| # b"minecraft:deepslate", | |
| # b"minecraft:diamond_block", | |
| # b"minecraft:diamond_ore", | |
| # b"minecraft:diorite_slab", | |
| # b"minecraft:diorite_stairs", | |
| # b"minecraft:diorite_wall", | |
| # b"minecraft:diorite", | |
| # b"minecraft:dirt", | |
| # b"minecraft:dispenser", | |
| # b"minecraft:dripstone_block", | |
| # b"minecraft:dropper", | |
| b"minecraft:enchanting_table", | |
| b"minecraft:end_rod", | |
| # b"minecraft:end_stone", | |
| b"minecraft:fire", | |
| b"minecraft:flower_pot", | |
| b"minecraft:flowering_azalea_leaves", | |
| b"minecraft:flowering_azalea", | |
| # b"minecraft:gilded_blackstone", | |
| b"minecraft:glow_lichen", | |
| # b"minecraft:glowstone", | |
| # b"minecraft:gold_block", | |
| # b"minecraft:gold_ore", | |
| # b"minecraft:granite_slab", | |
| # b"minecraft:granite_stairs", | |
| # b"minecraft:granite_wall", | |
| # b"minecraft:granite", | |
| # b"minecraft:gravel", | |
| b"minecraft:gray_candle", | |
| b"minecraft:gray_carpet", | |
| b"minecraft:gray_wall_banner", | |
| # b"minecraft:gray_wool", | |
| b"minecraft:green_candle", | |
| b"minecraft:green_carpet", | |
| b"minecraft:grindstone", | |
| b"minecraft:hanging_roots", | |
| # b"minecraft:hay_block", | |
| b"minecraft:heavy_weighted_pressure_plate", | |
| b"minecraft:honey_block", | |
| b"minecraft:hopper", | |
| b"minecraft:ice", | |
| b"minecraft:iron_bars", | |
| # b"minecraft:iron_block", | |
| b"minecraft:iron_door", | |
| # b"minecraft:iron_ore", | |
| b"minecraft:iron_trapdoor", | |
| # b"minecraft:jack_o_lantern", | |
| b"minecraft:jungle_door", | |
| b"minecraft:jungle_fence_gate", | |
| b"minecraft:jungle_fence", | |
| # b"minecraft:jungle_planks", | |
| # b"minecraft:jungle_slab", | |
| # b"minecraft:jungle_stairs", | |
| b"minecraft:jungle_trapdoor", | |
| b"minecraft:jungle_wall_sign", | |
| b"minecraft:kelp_plant", | |
| b"minecraft:kelp", | |
| b"minecraft:ladder", | |
| b"minecraft:lantern", | |
| # b"minecraft:lapis_block", | |
| # b"minecraft:lapis_ore", | |
| b"minecraft:large_amethyst_bud", | |
| b"minecraft:lava_cauldron", | |
| b"minecraft:lava", | |
| b"minecraft:lectern", | |
| b"minecraft:lever", | |
| b"minecraft:light_blue_carpet", | |
| b"minecraft:light_blue_stained_glass_pane", | |
| # b"minecraft:light_blue_terracotta", | |
| # b"minecraft:light_blue_wool", | |
| b"minecraft:light_gray_carpet", | |
| b"minecraft:light_gray_wall_banner", | |
| b"minecraft:light_weighted_pressure_plate", | |
| b"minecraft:lightning_rod", | |
| b"minecraft:lily_pad", | |
| b"minecraft:lime_stained_glass_pane", | |
| # b"minecraft:loom", | |
| # b"minecraft:magenta_terracotta", | |
| # b"minecraft:magma_block", | |
| b"minecraft:mangrove_button", | |
| b"minecraft:mangrove_door", | |
| b"minecraft:mangrove_fence_gate", | |
| b"minecraft:mangrove_fence", | |
| b"minecraft:mangrove_leaves", | |
| # b"minecraft:mangrove_log", | |
| # b"minecraft:mangrove_planks", | |
| b"minecraft:mangrove_roots", | |
| # b"minecraft:mangrove_slab", | |
| # b"minecraft:mangrove_stairs", | |
| b"minecraft:mangrove_trapdoor", | |
| b"minecraft:mangrove_wall_sign", | |
| # b"minecraft:mangrove_wood", | |
| b"minecraft:medium_amethyst_bud", | |
| # b"minecraft:moss_block", | |
| b"minecraft:moss_carpet", | |
| # b"minecraft:mossy_cobblestone_slab", | |
| # b"minecraft:mossy_cobblestone_stairs", | |
| # b"minecraft:mossy_cobblestone_wall", | |
| # b"minecraft:mossy_cobblestone", | |
| # b"minecraft:mossy_stone_brick_slab", | |
| # b"minecraft:mossy_stone_brick_stairs", | |
| # b"minecraft:mossy_stone_brick_wall", | |
| # b"minecraft:mossy_stone_bricks", | |
| # b"minecraft:mud_brick_slab", | |
| # b"minecraft:mud_brick_stairs", | |
| # b"minecraft:mud_brick_wall", | |
| # b"minecraft:mud_bricks", | |
| # b"minecraft:mud", | |
| # b"minecraft:muddy_mangrove_roots", | |
| # b"minecraft:mushroom_stem", | |
| # b"minecraft:mycelium", | |
| b"minecraft:nether_brick_fence", | |
| # b"minecraft:nether_brick_slab", | |
| # b"minecraft:nether_brick_stairs", | |
| # b"minecraft:nether_brick_wall", | |
| # b"minecraft:nether_bricks", | |
| # b"minecraft:nether_quartz_ore", | |
| b"minecraft:nether_sprouts", | |
| # b"minecraft:nether_wart_block", | |
| # b"minecraft:netherite_block", | |
| # b"minecraft:netherrack", | |
| # b"minecraft:note_block", | |
| b"minecraft:oak_door", | |
| b"minecraft:oak_fence", | |
| b"minecraft:oak_leaves", | |
| # b"minecraft:oak_log", | |
| # b"minecraft:oak_stairs", | |
| b"minecraft:oak_trapdoor", | |
| b"minecraft:oak_wall_sign", | |
| # b"minecraft:oak_wood", | |
| # b"minecraft:observer", | |
| # b"minecraft:obsidian", | |
| # b"minecraft:ochre_froglight", | |
| b"minecraft:orange_carpet", | |
| # b"minecraft:orange_terracotta", | |
| # b"minecraft:oxidized_copper", | |
| # b"minecraft:oxidized_cut_copper_slab", | |
| # b"minecraft:packed_ice", | |
| # b"minecraft:packed_mud", | |
| b"minecraft:piston_head", | |
| b"minecraft:player_head", | |
| b"minecraft:player_wall_head", | |
| # b"minecraft:podzol", | |
| b"minecraft:pointed_dripstone", | |
| # b"minecraft:polished_andesite_stairs", | |
| # b"minecraft:polished_andesite", | |
| # b"minecraft:polished_basalt", | |
| # b"minecraft:polished_blackstone_brick_slab", | |
| # b"minecraft:polished_blackstone_brick_stairs", | |
| # b"minecraft:polished_blackstone_brick_wall", | |
| # b"minecraft:polished_blackstone_bricks", | |
| b"minecraft:polished_blackstone_button", | |
| b"minecraft:polished_blackstone_pressure_plate", | |
| # b"minecraft:polished_blackstone_slab", | |
| # b"minecraft:polished_blackstone_stairs", | |
| # b"minecraft:polished_blackstone_wall", | |
| # b"minecraft:polished_blackstone", | |
| # b"minecraft:polished_deepslate_slab", | |
| # b"minecraft:polished_deepslate_stairs", | |
| # b"minecraft:polished_deepslate_wall", | |
| # b"minecraft:polished_deepslate", | |
| # b"minecraft:polished_granite_slab", | |
| # b"minecraft:polished_granite_stairs", | |
| # b"minecraft:polished_granite", | |
| b"minecraft:potted_brown_mushroom", | |
| b"minecraft:potted_crimson_fungus", | |
| b"minecraft:potted_dead_bush", | |
| b"minecraft:potted_warped_fungus", | |
| b"minecraft:potted_warped_roots", | |
| b"minecraft:potted_wither_rose", | |
| # b"minecraft:powder_snow", ############### | |
| # b"minecraft:pumpkin", | |
| # b"minecraft:purple_terracotta", | |
| # b"minecraft:quartz_block", | |
| # b"minecraft:quartz_slab", | |
| # b"minecraft:quartz_stairs", | |
| b"minecraft:rail", | |
| # b"minecraft:raw_copper_block", | |
| # b"minecraft:raw_gold_block", | |
| # b"minecraft:raw_iron_block", | |
| b"minecraft:red_candle", | |
| b"minecraft:red_carpet", | |
| # b"minecraft:red_concrete", | |
| # b"minecraft:red_mushroom_block", | |
| b"minecraft:red_mushroom", | |
| # b"minecraft:red_nether_bricks", | |
| # b"minecraft:red_sand", | |
| b"minecraft:red_stained_glass_pane", | |
| # b"minecraft:red_stained_glass", | |
| b"minecraft:red_wall_banner", | |
| # b"minecraft:red_wool", | |
| # b"minecraft:redstone_block", | |
| b"minecraft:redstone_torch", | |
| b"minecraft:redstone_wire", | |
| # b"minecraft:respawn_anchor", | |
| # b"minecraft:rooted_dirt", | |
| # b"minecraft:sandstone_stairs", | |
| # b"minecraft:sandstone", | |
| b"minecraft:scaffolding", | |
| b"minecraft:sculk_shrieker", | |
| b"minecraft:sculk_vein", | |
| # b"minecraft:sculk", | |
| # b"minecraft:sea_lantern", | |
| b"minecraft:sea_pickle", | |
| b"minecraft:seagrass", | |
| # b"minecraft:shroomlight", | |
| b"minecraft:skeleton_skull", | |
| b"minecraft:small_amethyst_bud", | |
| # b"minecraft:smithing_table", | |
| # b"minecraft:smoker", | |
| # b"minecraft:smooth_basalt", | |
| # b"minecraft:smooth_quartz_slab", | |
| # b"minecraft:smooth_quartz_stairs", | |
| # b"minecraft:smooth_quartz", | |
| # b"minecraft:smooth_red_sandstone", | |
| # b"minecraft:smooth_sandstone_slab", | |
| # b"minecraft:smooth_sandstone_stairs", | |
| # b"minecraft:smooth_stone_slab", | |
| # b"minecraft:smooth_stone", | |
| # b"minecraft:snow_block", | |
| b"minecraft:snow", | |
| b"minecraft:soul_campfire", | |
| b"minecraft:soul_fire", | |
| b"minecraft:soul_lantern", | |
| # b"minecraft:soul_sand", | |
| # b"minecraft:soul_soil", | |
| b"minecraft:soul_torch", | |
| b"minecraft:soul_wall_torch", | |
| b"minecraft:spore_blossom", | |
| b"minecraft:spruce_fence_gate", | |
| b"minecraft:spruce_fence", | |
| # b"minecraft:spruce_log", | |
| # b"minecraft:spruce_planks", | |
| b"minecraft:spruce_pressure_plate", | |
| b"minecraft:spruce_sign", | |
| # b"minecraft:spruce_slab", | |
| # b"minecraft:spruce_stairs", | |
| b"minecraft:spruce_trapdoor", | |
| b"minecraft:spruce_wall_sign", | |
| # b"minecraft:spruce_wood", | |
| # b"minecraft:sticky_piston", | |
| # b"minecraft:stone_brick_slab", | |
| # b"minecraft:stone_brick_stairs", | |
| # b"minecraft:stone_brick_wall", | |
| # b"minecraft:stone_bricks", | |
| b"minecraft:stone_button", | |
| b"minecraft:stone_pressure_plate", | |
| # b"minecraft:stone_slab", | |
| # b"minecraft:stone_stairs", | |
| # b"minecraft:stone", | |
| b"minecraft:stonecutter", | |
| # b"minecraft:stripped_birch_log", | |
| # b"minecraft:stripped_dark_oak_log", | |
| # b"minecraft:stripped_dark_oak_wood", | |
| # b"minecraft:stripped_jungle_log", | |
| # b"minecraft:stripped_jungle_wood", | |
| # b"minecraft:stripped_mangrove_log", | |
| # b"minecraft:stripped_mangrove_wood", | |
| # b"minecraft:stripped_spruce_log", | |
| # b"minecraft:stripped_spruce_wood", | |
| # b"minecraft:stripped_warped_hyphae", | |
| # b"minecraft:stripped_warped_stem", | |
| b"minecraft:sweet_berry_bush", | |
| b"minecraft:tall_seagrass", | |
| # b"minecraft:terracotta", | |
| # b"minecraft:tnt", | |
| b"minecraft:torch", | |
| b"minecraft:trapped_chest", | |
| b"minecraft:tripwire_hook", | |
| b"minecraft:tripwire", | |
| # b"minecraft:tuff", | |
| b"minecraft:turtle_egg", | |
| b"minecraft:twisting_vines_plant", | |
| b"minecraft:twisting_vines", | |
| b"minecraft:vine", | |
| b"minecraft:wall_torch", | |
| b"minecraft:warped_button", | |
| b"minecraft:warped_fence_gate", | |
| b"minecraft:warped_fence", | |
| b"minecraft:warped_fungus", | |
| b"minecraft:warped_hanging_sign", | |
| # b"minecraft:warped_nylium", | |
| # b"minecraft:warped_planks", | |
| b"minecraft:warped_pressure_plate", | |
| b"minecraft:warped_roots", | |
| b"minecraft:warped_sign", | |
| # b"minecraft:warped_slab", | |
| # b"minecraft:warped_stairs", | |
| b"minecraft:warped_trapdoor", | |
| b"minecraft:warped_wall_sign", | |
| # b"minecraft:warped_wart_block", | |
| b"minecraft:water", | |
| # b"minecraft:waxed_cut_copper", | |
| # b"minecraft:waxed_exposed_copper", | |
| b"minecraft:white_carpet", | |
| b"minecraft:wither_rose", | |
| b"minecraft:wither_skeleton_skull", | |
| b"minecraft:wither_skeleton_wall_skull", | |
| b"minecraft:yellow_candle", | |
| ] | |
| if False: | |
| # For new algo | |
| TRANSPARENT_BLOCKS = [ | |
| b"minecraft:air", | |
| b"minecraft:amethyst_cluster", | |
| b"minecraft:big_dripleaf_stem", | |
| b"minecraft:big_dripleaf", | |
| b"minecraft:black_candle", | |
| b"minecraft:brown_candle", | |
| b"minecraft:bubble_column", | |
| b"minecraft:candle", | |
| b"minecraft:cave_air", | |
| b"minecraft:cave_vines_plant", | |
| b"minecraft:cave_vines", | |
| b"minecraft:chain", | |
| b"minecraft:cobweb", | |
| b"minecraft:crimson_button", | |
| b"minecraft:crimson_fence_gate", | |
| b"minecraft:cyan_candle", | |
| b"minecraft:dark_oak_button", | |
| b"minecraft:dark_oak_pressure_plate", | |
| b"minecraft:dark_oak_wall_sign", | |
| b"minecraft:dead_bush", | |
| b"minecraft:end_rod", | |
| b"minecraft:fire", | |
| b"minecraft:glow_lichen", | |
| b"minecraft:gray_candle", | |
| b"minecraft:gray_wall_banner", | |
| b"minecraft:green_candle", | |
| b"minecraft:heavy_weighted_pressure_plate", | |
| b"minecraft:jungle_wall_sign", | |
| b"minecraft:kelp_plant", | |
| b"minecraft:kelp", | |
| b"minecraft:ladder", | |
| b"minecraft:lever", | |
| b"minecraft:light_weighted_pressure_plate", | |
| b"minecraft:lightning_rod", | |
| b"minecraft:mangrove_button", | |
| b"minecraft:mangrove_wall_sign", | |
| b"minecraft:oak_wall_sign", | |
| b"minecraft:player_wall_head", | |
| b"minecraft:polished_blackstone_button", | |
| b"minecraft:polished_blackstone_pressure_plate", | |
| b"minecraft:rail", | |
| b"minecraft:red_candle", | |
| b"minecraft:red_mushroom", | |
| b"minecraft:red_wall_banner", | |
| b"minecraft:redstone_torch", | |
| b"minecraft:redstone_wire", | |
| b"minecraft:sculk_vein", | |
| b"minecraft:sea_pickle", | |
| b"minecraft:seagrass", | |
| b"minecraft:skeleton_skull", | |
| b"minecraft:small_amethyst_bud", | |
| b"minecraft:snow", | |
| b"minecraft:soul_fire", | |
| b"minecraft:soul_torch", | |
| b"minecraft:soul_wall_torch", | |
| b"minecraft:spruce_pressure_plate", | |
| b"minecraft:spruce_sign", | |
| b"minecraft:spruce_wall_sign", | |
| b"minecraft:stone_button", | |
| b"minecraft:stone_pressure_plate", | |
| b"minecraft:sweet_berry_bush", | |
| b"minecraft:tall_seagrass", | |
| b"minecraft:torch", | |
| b"minecraft:tripwire_hook", | |
| b"minecraft:tripwire", | |
| b"minecraft:turtle_egg", | |
| b"minecraft:twisting_vines_plant", | |
| b"minecraft:twisting_vines", | |
| b"minecraft:vine", | |
| b"minecraft:wall_torch", | |
| b"minecraft:warped_button", | |
| b"minecraft:warped_fungus", | |
| b"minecraft:warped_hanging_sign", | |
| b"minecraft:warped_pressure_plate", | |
| b"minecraft:warped_roots", | |
| b"minecraft:warped_sign", | |
| b"minecraft:warped_wall_sign", | |
| b"minecraft:water", | |
| b"minecraft:wither_skeleton_skull", | |
| b"minecraft:wither_skeleton_wall_skull", | |
| b"minecraft:yellow_candle", | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import struct | |
| def parse(buffer, offset=0, *, key_encoding="utf-8", return_offset=False): | |
| def key_decode(text): | |
| if key_encoding is not None: | |
| text = text.decode(key_encoding) | |
| return text | |
| def pop_byte(): | |
| nonlocal offset | |
| offset += 1 | |
| return struct.unpack_from(">b", buffer, offset - 1)[0] | |
| def pop_short(): | |
| nonlocal offset | |
| offset += 2 | |
| return struct.unpack_from(">h", buffer, offset - 2)[0] | |
| def pop_int(): | |
| nonlocal offset | |
| offset += 4 | |
| return struct.unpack_from(">i", buffer, offset - 4)[0] | |
| def pop_long(): | |
| nonlocal offset | |
| offset += 8 | |
| return struct.unpack_from(">q", buffer, offset - 8)[0] | |
| def pop_float(): | |
| nonlocal offset | |
| offset += 4 | |
| return struct.unpack_from(">f", buffer, offset - 4)[0] | |
| def pop_double(): | |
| nonlocal offset | |
| offset += 8 | |
| return struct.unpack_from(">d", buffer, offset - 8)[0] | |
| def pop_string(): | |
| nonlocal offset | |
| length = struct.unpack_from(">H", buffer, offset)[0] | |
| offset += 2 + length | |
| return buffer[offset - length : offset] | |
| def pop_list(): | |
| item_type = tags.get(pop_byte()) | |
| length = pop_int() | |
| return [item_type() for _ in range(length)] | |
| def pop_compound(): | |
| ret = {} | |
| while True: | |
| item = pop_compound_item() | |
| if item is None: | |
| break | |
| key, value = item | |
| ret[key_decode(key)] = value | |
| return ret | |
| def pop_byte_array(): | |
| length = pop_int() | |
| return [pop_byte() for _ in range(length)] | |
| def pop_int_array(): | |
| length = pop_int() | |
| return [pop_int() for _ in range(length)] | |
| def pop_long_array(): | |
| length = pop_int() | |
| return [pop_long() for _ in range(length)] | |
| tags = { | |
| 0x01: pop_byte, | |
| 0x02: pop_short, | |
| 0x03: pop_int, | |
| 0x04: pop_long, | |
| 0x05: pop_float, | |
| 0x06: pop_double, | |
| 0x07: pop_byte_array, | |
| 0x08: pop_string, | |
| 0x09: pop_list, | |
| 0x0A: pop_compound, | |
| 0x0B: pop_int_array, | |
| 0x0C: pop_long_array, | |
| } | |
| def pop_compound_item(): | |
| item_type = pop_byte() | |
| if item_type == 0x00: | |
| return | |
| item_name = pop_string() | |
| item_value = tags[item_type]() | |
| return item_name, item_value | |
| key, value = pop_compound_item() | |
| ret = {key_decode(key): value} | |
| if return_offset: | |
| return ret, offset | |
| return ret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import struct | |
| import uuid | |
| from noxitu.minecraft.io.packet_core import varint32 | |
| import noxitu.minecraft.io.nbt | |
| class Packet: | |
| def __init__(self, buffer): | |
| self._buffer = buffer | |
| self.offset = 0 | |
| def boolean(self): | |
| return self.ubyte() != 0 | |
| def ubyte(self): | |
| self.offset += 1 | |
| return self._buffer[self.offset - 1] | |
| def short(self): | |
| (value,) = struct.unpack_from(">h", self._buffer, self.offset) | |
| self.offset += 2 | |
| return value | |
| def ushort(self): | |
| (value,) = struct.unpack_from(">H", self._buffer, self.offset) | |
| self.offset += 2 | |
| return value | |
| def int(self): | |
| (value,) = struct.unpack_from(">i", self._buffer, self.offset) | |
| self.offset += 4 | |
| return value | |
| def long(self): | |
| (value,) = struct.unpack_from(">q", self._buffer, self.offset) | |
| self.offset += 8 | |
| return value | |
| def ulong(self): | |
| (value,) = struct.unpack_from(">Q", self._buffer, self.offset) | |
| self.offset += 8 | |
| return value | |
| def varint(self): | |
| value, skip = varint32(self._buffer, self.offset) | |
| self.offset += skip | |
| return value | |
| def string(self, n): | |
| length = self.varint() | |
| value = self._buffer[self.offset : self.offset + length] | |
| self.offset += length | |
| return value | |
| def nbt(self): | |
| value, self.offset = noxitu.minecraft.io.nbt.parse( | |
| self._buffer, self.offset, return_offset=True | |
| ) | |
| return value | |
| def uuid(self): | |
| value = uuid.UUID(bytes=self._buffer[self.offset : self.offset + 16]) | |
| self.offset += 16 | |
| return value | |
| def bytearray(self, length): | |
| value = self._buffer[self.offset : self.offset + length] | |
| self.offset += length | |
| return value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _sign32(value): | |
| if value > 0x7FFF_FFFF: | |
| return value - 0x1_0000_0000 | |
| return value | |
| def _sign64(value): | |
| if value > 0x7FFF_FFFF_FFFF_FFFF: | |
| return value - 0x1_0000_0000_0000_0000 | |
| return value | |
| def _varint(buffer, offset, max_length, sign): | |
| ret = 0 | |
| for i in range(max_length): | |
| if offset + i >= len(buffer): | |
| return None, i + 1 | |
| val = buffer[offset + i] | |
| ret += (val & 0x7F) << (7 * i) | |
| if (val & 0x80) == 0: | |
| return sign(ret), i + 1 | |
| # LOGGER.warning('Too long varint read.') | |
| return sign(ret), max_length | |
| def varint32(buffer, offset=0): | |
| return _varint(buffer, offset, 5, _sign32) | |
| def varint64(buffer, offset=0): | |
| return _varint(buffer, offset, 10, _sign64) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gzip | |
| from os import PathLike | |
| from pathlib import Path | |
| import zlib | |
| import numpy as np | |
| import noxitu.minecraft.io.nbt | |
| import noxitu.minecraft.io.packet | |
| class World: | |
| def __init__(self, path: PathLike): | |
| self._path = Path(path) | |
| self._assets = {} | |
| self._where = {} | |
| self._world = {} | |
| self._collect_chunks() | |
| def level(self): | |
| with gzip.open(self._path / "level.dat", "rb") as fd: | |
| buffer = fd.read() | |
| nbt = noxitu.minecraft.io.nbt.parse(buffer) | |
| return nbt[""] | |
| def add_assets(self, version_id, assets): | |
| self._assets[version_id] = assets | |
| def __getitem__(self, item): | |
| ret = self._world.get(item) | |
| if ret is not None: | |
| return ret | |
| desc = self._where.get(item) | |
| if desc is None: | |
| return None | |
| ret = _load_chunk(*desc, item) | |
| self._world[item] = ret | |
| return ret | |
| def _collect_chunks_from_file(self, path): | |
| global_x, global_z = np.array(path.stem.split(".")[1:]).astype(int) * 32 | |
| with open(path, "rb") as fd: | |
| header = fd.read(4096) | |
| if len(header) == 0: | |
| return | |
| if len(header) < 4096: | |
| raise Exception("?") | |
| header = np.frombuffer(header, dtype=">i4") | |
| for i, (x, z) in enumerate([(x, z) for z in range(32) for x in range(32)]): | |
| offset = 4096 * (header[i] >> 8) | |
| size = 4096 * (header[i] & 0xFF) | |
| if size > 0: | |
| self._where[global_z + z, global_x + x] = (path, offset, size) | |
| def _collect_chunks(self): | |
| files = list(self._path.glob("region/r.*.*.mca")) | |
| track = lambda x: x | |
| for mca_file in track(files): | |
| self._collect_chunks_from_file(mca_file) | |
| def _unpack_long(value, bits): | |
| if value < 0: | |
| value += 2**64 | |
| mask = 2**bits - 1 | |
| for i in range(0, 64 - bits + 1, bits): | |
| yield (value >> i) & mask | |
| def _unpack_section(section_data, palette_size): | |
| bits_per_block = 4 | |
| while 2**bits_per_block < palette_size: | |
| bits_per_block += 1 | |
| result = [ | |
| val for packed in section_data for val in _unpack_long(packed, bits_per_block) | |
| ] | |
| dtype = "u1" if bits_per_block <= 8 else "u2" | |
| return np.array(result[: 16 * 16 * 16], dtype=dtype).reshape(16, 16, 16) | |
| def _parse_chunk(buffer, item): | |
| chunk_data = noxitu.minecraft.io.packet.Packet(buffer[:5]) | |
| size = chunk_data.int() | |
| encryption = chunk_data.ubyte() | |
| assert encryption == 2 | |
| chunk_data = zlib.decompress(buffer[5 : size + 4]) | |
| chunk_data = noxitu.minecraft.io.nbt.parse(chunk_data)[""] | |
| # print(f"{chunk_data['DataVersion']=}") | |
| assert chunk_data["xPos"] == item[1] | |
| assert chunk_data["zPos"] == item[0] | |
| chunk = [] | |
| for section in chunk_data["sections"]: | |
| # print(*section, section["Y"]) | |
| y = section["Y"] | |
| subchunk = {} | |
| subchunk["y"] = y | |
| if "block_states" not in section: | |
| subchunk["data"] = np.zeros((16, 16, 16), dtype="u1") | |
| subchunk["palette"] = [{"Name": b"minecraft:air"}] | |
| continue | |
| block_states = section["block_states"] | |
| palette = block_states["palette"] | |
| if "data" in block_states: | |
| subchunk["data"] = _unpack_section(block_states["data"], len(palette)) | |
| subchunk["palette"] = palette | |
| stone_mask = np.array( | |
| [ | |
| (p["Name"] == b"minecraft:stone") + (p["Name"] != b"minecraft:air") | |
| for p in palette | |
| ], | |
| dtype="u1", | |
| ) | |
| subchunk["stone"] = stone_mask[subchunk["data"]] | |
| else: | |
| subchunk["stone"] = np.zeros((16, 16, 16), dtype="u1") | |
| chunk.append(subchunk) | |
| return chunk | |
| # if b"BlockStates" in section: | |
| # palette = [] | |
| # for entry in section[b"Palette"]: | |
| # block = BLOCKS[entry[b"Name"].decode()] | |
| # if b"Properties" in entry: | |
| # properties = { | |
| # key.decode(): value.decode() | |
| # for key, value in entry[b"Properties"].items() | |
| # } | |
| # n = 0 | |
| # for state in block["states"]: | |
| # if all( | |
| # properties.get(key) == value | |
| # for key, value in state["properties"].items() | |
| # ): | |
| # palette.append(state["id"]) | |
| # n += 1 | |
| # if n != 1: | |
| # raise Exception(f"Failed to determine unique state id") | |
| # else: | |
| # n = 0 | |
| # for state in block["states"]: | |
| # if state.get("default", False): | |
| # palette.append(state["id"]) | |
| # n += 1 | |
| # if n != 1: | |
| # raise Exception() | |
| # palette = np.array(palette) | |
| # chunk[y] = unpack_section(section[b"BlockStates"], palette) | |
| # return chunk.reshape(256, 16, 16) | |
| def _load_chunk(path, offset, size, item): | |
| with open(path, "rb") as fd: | |
| fd.seek(offset) | |
| buffer = fd.read(size) | |
| return _parse_chunk(buffer, item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment