Closed mcneds closed 10 months ago
The universal format is undefined so you should not use it directly.
You need to convert the universal block to a game version of your choice and compare block states in that format.
level.get_version_block
will do most of the work for you.
This can be a little slow on a per-block basis because it needs to run the translator for each block location. You can optimise it by instead iterating over the block palette and using numpy but that requires a bit more knowledge.
im trying to remove blocks in a region of a world based on this whitelist: WHITELIST = { ('iron_ore', None), ('glass', 'color=lime'), ('terracotta', 'color=cyan'), ('coal_ore', None), ('prismarine', None), ('prismarine_bricks', None), ('wool', 'color=light_blue'), ('glass', 'color=light_blue'), ('glass', 'color=magenta'), ('glass_pane', 'color=lime'), ('redstone_ore', None), ('gold_ore', None), ('glass_pane', 'color=light_blue'), ('wool', 'color=gray'), ('glass', 'color=orange'), ('glass', 'color=gray'), ('glass', 'color=yellow'), ('lapis_ore', None), ('glass_pane', 'color=magenta'), ('glass', 'color=pink'), ('dark_prismarine', None), ('glass_pane', 'color=orange'), ('diamond_ore', None), ('glass_pane', 'color=yellow'), ('glass_pane', 'color=pink'), ('emerald_ore', None) } but any block that has any data other than none isn't found, and I suspect that I'm giving the wrong info for these kind of blocks for the library to find them, and I couldn't see an example of the naming scheme for these kind of blocks on the documentation. The world version is 1.12, that's why I have the dictionary for the extra data instead of just a list