Grab block data from PrismarineJS/minecraft-data
This commit is contained in:
parent
27b8f71452
commit
2f9a918431
385
blocks.py
385
blocks.py
|
@ -1,216 +1,235 @@
|
||||||
|
import minecraft_data
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
mcd = minecraft_data('1.16.2')
|
||||||
|
|
||||||
|
MCD_BLOCKS = {}
|
||||||
|
for data in mcd.blocks.values():
|
||||||
|
MCD_BLOCKS[data['name']] = data
|
||||||
|
|
||||||
with open('mcdata/blocks.json') as f:
|
with open('mcdata/blocks.json') as f:
|
||||||
BLOCKS = json.load(f)
|
JSON_BLOCKS = json.load(f)
|
||||||
|
|
||||||
|
BLOCKS = {}
|
||||||
|
for name, data in JSON_BLOCKS.items():
|
||||||
|
for state in data['states']:
|
||||||
|
BLOCKS[state['id']] = name.replace('minecraft:', '')
|
||||||
|
|
||||||
AVOID = [
|
AVOID = [
|
||||||
'minecraft:lava',
|
'lava',
|
||||||
'minecraft:water',
|
'water',
|
||||||
'minecraft:fire',
|
'fire',
|
||||||
'minecraft:magma_block',
|
'magma_block',
|
||||||
'minecraft:oak_fence',
|
'oak_fence',
|
||||||
'minecraft:oak_fence_gate',
|
'oak_fence_gate',
|
||||||
'minecraft:nether_brick_fence',
|
'nether_brick_fence',
|
||||||
'minecraft:spruce_fence_gate',
|
'spruce_fence_gate',
|
||||||
'minecraft:birch_fence_gate',
|
'birch_fence_gate',
|
||||||
'minecraft:jungle_fence_gate',
|
'jungle_fence_gate',
|
||||||
'minecraft:acacia_fence_gate',
|
'acacia_fence_gate',
|
||||||
'minecraft:dark_oak_fence_gate',
|
'dark_oak_fence_gate',
|
||||||
'minecraft:spruce_fence',
|
'spruce_fence',
|
||||||
'minecraft:birch_fence',
|
'birch_fence',
|
||||||
'minecraft:jungle_fence',
|
'jungle_fence',
|
||||||
'minecraft:acacia_fence',
|
'acacia_fence',
|
||||||
'minecraft:dark_oak_fence',
|
'dark_oak_fence',
|
||||||
'minecraft:sweet_berry_bush',
|
'sweet_berry_bush',
|
||||||
'minecraft:nether_portal',
|
'nether_portal',
|
||||||
'minecraft:end_portal',
|
'end_portal',
|
||||||
'minecraft:cobblestone_wall',
|
'cobblestone_wall',
|
||||||
'minecraft:mossy_cobblestone_wall',
|
'mossy_cobblestone_wall',
|
||||||
'minecraft:brick_wall',
|
'brick_wall',
|
||||||
'minecraft:prismarine_wall',
|
'prismarine_wall',
|
||||||
'minecraft:red_sandstone_wall',
|
'red_sandstone_wall',
|
||||||
'minecraft:mossy_stone_brick_wall',
|
'mossy_stone_brick_wall',
|
||||||
'minecraft:granite_wall',
|
'granite_wall',
|
||||||
'minecraft:stone_brick_wall',
|
'stone_brick_wall',
|
||||||
'minecraft:nether_brick_wall',
|
'nether_brick_wall',
|
||||||
'minecraft:andesite_wall',
|
'andesite_wall',
|
||||||
'minecraft:red_nether_brick_wall',
|
'red_nether_brick_wall',
|
||||||
'minecraft:sandstone_wall',
|
'sandstone_wall',
|
||||||
'minecraft:end_stone_brick_wall',
|
'end_stone_brick_wall',
|
||||||
'minecraft:diorite_wall',
|
'diorite_wall',
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
NON_SOLID = [
|
NON_SOLID = [
|
||||||
'minecraft:air',
|
'air',
|
||||||
'minecraft:powered_rail',
|
'powered_rail',
|
||||||
'minecraft:detector_rail',
|
'detector_rail',
|
||||||
'minecraft:grass',
|
'grass',
|
||||||
'minecraft:fern',
|
'fern',
|
||||||
'minecraft:dead_bush',
|
'dead_bush',
|
||||||
'minecraft:seagrass',
|
'seagrass',
|
||||||
'minecraft:tall_seagrass',
|
'tall_seagrass',
|
||||||
'minecraft:dandelion',
|
'dandelion',
|
||||||
'minecraft:poppy',
|
'poppy',
|
||||||
'minecraft:blue_orchid',
|
'blue_orchid',
|
||||||
'minecraft:allium',
|
'allium',
|
||||||
'minecraft:azure_bluet',
|
'azure_bluet',
|
||||||
'minecraft:red_tulip',
|
'red_tulip',
|
||||||
'minecraft:orange_tulip',
|
'orange_tulip',
|
||||||
'minecraft:white_tulip',
|
'white_tulip',
|
||||||
'minecraft:pink_tulip',
|
'pink_tulip',
|
||||||
'minecraft:oxeye_daisy',
|
'oxeye_daisy',
|
||||||
'minecraft:cornflower',
|
'cornflower',
|
||||||
'minecraft:wither_rose',
|
'wither_rose',
|
||||||
'minecraft:lily_of_the_valley',
|
'lily_of_the_valley',
|
||||||
'minecraft:brown_mushroom',
|
'brown_mushroom',
|
||||||
'minecraft:red_mushroom',
|
'red_mushroom',
|
||||||
'minecraft:torch',
|
'torch',
|
||||||
'minecraft:wall_torch',
|
'wall_torch',
|
||||||
'minecraft:redstone_wire',
|
'redstone_wire',
|
||||||
'minecraft:wheat',
|
'wheat',
|
||||||
'minecraft:oak_sign',
|
'oak_sign',
|
||||||
'minecraft:spruce_sign',
|
'spruce_sign',
|
||||||
'minecraft:birch_sign',
|
'birch_sign',
|
||||||
'minecraft:acacia_sign',
|
'acacia_sign',
|
||||||
'minecraft:jungle_sign',
|
'jungle_sign',
|
||||||
'minecraft:dark_oak_sign',
|
'dark_oak_sign',
|
||||||
'minecraft:rail',
|
'rail',
|
||||||
'minecraft:oak_wall_sign',
|
'oak_wall_sign',
|
||||||
'minecraft:spruce_wall_sign',
|
'spruce_wall_sign',
|
||||||
'minecraft:birch_wall_sign',
|
'birch_wall_sign',
|
||||||
'minecraft:acacia_wall_sign',
|
'acacia_wall_sign',
|
||||||
'minecraft:jungle_wall_sign',
|
'jungle_wall_sign',
|
||||||
'minecraft:dark_oak_wall_sign',
|
'dark_oak_wall_sign',
|
||||||
'minecraft:lever',
|
'lever',
|
||||||
'minecraft:stone_pressure_plate',
|
'stone_pressure_plate',
|
||||||
'minecraft:oak_pressure_plate',
|
'oak_pressure_plate',
|
||||||
'minecraft:spruce_pressure_plate',
|
'spruce_pressure_plate',
|
||||||
'minecraft:birch_pressure_plate',
|
'birch_pressure_plate',
|
||||||
'minecraft:jungle_pressure_plate',
|
'jungle_pressure_plate',
|
||||||
'minecraft:acacia_pressure_plate',
|
'acacia_pressure_plate',
|
||||||
'minecraft:dark_oak_pressure_plate',
|
'dark_oak_pressure_plate',
|
||||||
'minecraft:redstone_torch',
|
'redstone_torch',
|
||||||
'minecraft:redstone_wall_torch',
|
'redstone_wall_torch',
|
||||||
'minecraft:stone_button',
|
'stone_button',
|
||||||
'minecraft:sugar_cane',
|
'sugar_cane',
|
||||||
'minecraft:repeater',
|
'repeater',
|
||||||
'minecraft:attached_pumpkin_stem',
|
'attached_pumpkin_stem',
|
||||||
'minecraft:attached_melon_stem',
|
'attached_melon_stem',
|
||||||
'minecraft:pumpkin_stem',
|
'pumpkin_stem',
|
||||||
'minecraft:melon_stem',
|
'melon_stem',
|
||||||
'minecraft:nether_wart',
|
'nether_wart',
|
||||||
'minecraft:tripwire_hook',
|
'tripwire_hook',
|
||||||
'minecraft:tripwire',
|
'tripwire',
|
||||||
'minecraft:carrots',
|
'carrots',
|
||||||
'minecraft:potatoes',
|
'potatoes',
|
||||||
'minecraft:oak_button',
|
'oak_button',
|
||||||
'minecraft:spruce_button',
|
'spruce_button',
|
||||||
'minecraft:birch_button',
|
'birch_button',
|
||||||
'minecraft:jungle_button',
|
'jungle_button',
|
||||||
'minecraft:acacia_button',
|
'acacia_button',
|
||||||
'minecraft:dark_oak_button',
|
'dark_oak_button',
|
||||||
'minecraft:light_weighted_pressure_plate',
|
'light_weighted_pressure_plate',
|
||||||
'minecraft:heavy_weighted_pressure_plate',
|
'heavy_weighted_pressure_plate',
|
||||||
'minecraft:comparator',
|
'comparator',
|
||||||
'minecraft:activator_rail',
|
'activator_rail',
|
||||||
'minecraft:white_carpet',
|
'white_carpet',
|
||||||
'minecraft:orange_carpet',
|
'orange_carpet',
|
||||||
'minecraft:magenta_carpet',
|
'magenta_carpet',
|
||||||
'minecraft:light_blue_carpet',
|
'light_blue_carpet',
|
||||||
'minecraft:yellow_carpet',
|
'yellow_carpet',
|
||||||
'minecraft:lime_carpet',
|
'lime_carpet',
|
||||||
'minecraft:pink_carpet',
|
'pink_carpet',
|
||||||
'minecraft:gray_carpet',
|
'gray_carpet',
|
||||||
'minecraft:light_gray_carpet',
|
'light_gray_carpet',
|
||||||
'minecraft:cyan_carpet',
|
'cyan_carpet',
|
||||||
'minecraft:purple_carpet',
|
'purple_carpet',
|
||||||
'minecraft:blue_carpet',
|
'blue_carpet',
|
||||||
'minecraft:brown_carpet',
|
'brown_carpet',
|
||||||
'minecraft:green_carpet',
|
'green_carpet',
|
||||||
'minecraft:red_carpet',
|
'red_carpet',
|
||||||
'minecraft:black_carpet',
|
'black_carpet',
|
||||||
'minecraft:sunflower',
|
'sunflower',
|
||||||
'minecraft:lilac',
|
'lilac',
|
||||||
'minecraft:rose_bush',
|
'rose_bush',
|
||||||
'minecraft:peony',
|
'peony',
|
||||||
'minecraft:tall_grass',
|
'tall_grass',
|
||||||
'minecraft:large_fern',
|
'large_fern',
|
||||||
'minecraft:white_banner',
|
'white_banner',
|
||||||
'minecraft:orange_banner',
|
'orange_banner',
|
||||||
'minecraft:magenta_banner',
|
'magenta_banner',
|
||||||
'minecraft:light_blue_banner',
|
'light_blue_banner',
|
||||||
'minecraft:yellow_banner',
|
'yellow_banner',
|
||||||
'minecraft:lime_banner',
|
'lime_banner',
|
||||||
'minecraft:pink_banner',
|
'pink_banner',
|
||||||
'minecraft:gray_banner',
|
'gray_banner',
|
||||||
'minecraft:light_gray_banner',
|
'light_gray_banner',
|
||||||
'minecraft:cyan_banner',
|
'cyan_banner',
|
||||||
'minecraft:purple_banner',
|
'purple_banner',
|
||||||
'minecraft:blue_banner',
|
'blue_banner',
|
||||||
'minecraft:brown_banner',
|
'brown_banner',
|
||||||
'minecraft:green_banner',
|
'green_banner',
|
||||||
'minecraft:red_banner',
|
'red_banner',
|
||||||
'minecraft:black_banner',
|
'black_banner',
|
||||||
'minecraft:white_wall_banner',
|
'white_wall_banner',
|
||||||
'minecraft:orange_wall_banner',
|
'orange_wall_banner',
|
||||||
'minecraft:magenta_wall_banner',
|
'magenta_wall_banner',
|
||||||
'minecraft:light_blue_wall_banner',
|
'light_blue_wall_banner',
|
||||||
'minecraft:yellow_wall_banner',
|
'yellow_wall_banner',
|
||||||
'minecraft:lime_wall_banner',
|
'lime_wall_banner',
|
||||||
'minecraft:pink_wall_banner',
|
'pink_wall_banner',
|
||||||
'minecraft:gray_wall_banner',
|
'gray_wall_banner',
|
||||||
'minecraft:light_gray_wall_banner',
|
'light_gray_wall_banner',
|
||||||
'minecraft:cyan_wall_banner',
|
'cyan_wall_banner',
|
||||||
'minecraft:purple_wall_banner',
|
'purple_wall_banner',
|
||||||
'minecraft:blue_wall_banner',
|
'blue_wall_banner',
|
||||||
'minecraft:brown_wall_banner',
|
'brown_wall_banner',
|
||||||
'minecraft:green_wall_banner',
|
'green_wall_banner',
|
||||||
'minecraft:red_wall_banner',
|
'red_wall_banner',
|
||||||
'minecraft:black_wall_banner',
|
'black_wall_banner',
|
||||||
'minecraft:beetroots',
|
'beetroots',
|
||||||
'minecraft:bamboo_sapling',
|
'bamboo_sapling',
|
||||||
'minecraft:void_air',
|
'void_air',
|
||||||
'minecraft:cave_air',
|
'cave_air',
|
||||||
'minecraft:lantern',
|
'lantern',
|
||||||
]
|
]
|
||||||
SINGLE_SNOW = 3919
|
SINGLE_SNOW = 3919
|
||||||
|
|
||||||
LOGS = [
|
LOGS = [
|
||||||
'minecraft:oak_log',
|
'oak_log',
|
||||||
'minecraft:spruce_log',
|
'spruce_log',
|
||||||
'minecraft:birch_log',
|
'birch_log',
|
||||||
'minecraft:jungle_log',
|
'jungle_log',
|
||||||
'minecraft:acacia_log',
|
'acacia_log',
|
||||||
'minecraft:dark_oak_log',
|
'dark_oak_log',
|
||||||
]
|
]
|
||||||
|
|
||||||
LEAVES = [
|
LEAVES = [
|
||||||
'minecraft:oak_leaves',
|
'oak_leaves',
|
||||||
'minecraft:spruce_leaves',
|
'spruce_leaves',
|
||||||
'minecraft:birch_leaves',
|
'birch_leaves',
|
||||||
'minecraft:jungle_leaves',
|
'jungle_leaves',
|
||||||
'minecraft:acacia_leaves',
|
'acacia_leaves',
|
||||||
'minecraft:dark_oak_leaves',
|
'dark_oak_leaves',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
NON_SOLID_IDS = set([SINGLE_SNOW])
|
NON_SOLID_IDS = set([SINGLE_SNOW])
|
||||||
for block_name in NON_SOLID:
|
for block_name in NON_SOLID:
|
||||||
for state in BLOCKS[block_name]['states']:
|
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
|
||||||
NON_SOLID_IDS.add(state['id'])
|
NON_SOLID_IDS.add(state['id'])
|
||||||
|
|
||||||
AVOID_IDS = set()
|
AVOID_IDS = set()
|
||||||
for block_name in AVOID:
|
for block_name in AVOID:
|
||||||
for state in BLOCKS[block_name]['states']:
|
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
|
||||||
AVOID_IDS.add(state['id'])
|
AVOID_IDS.add(state['id'])
|
||||||
|
|
||||||
LOG_IDS = set()
|
LOG_IDS = set()
|
||||||
for block_name in LOGS:
|
for block_name in LOGS:
|
||||||
for state in BLOCKS[block_name]['states']:
|
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
|
||||||
LOG_IDS.add(state['id'])
|
LOG_IDS.add(state['id'])
|
||||||
|
|
||||||
LEAF_IDS = set()
|
LEAF_IDS = set()
|
||||||
for block_name in LEAVES:
|
for block_name in LEAVES:
|
||||||
for state in BLOCKS[block_name]['states']:
|
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
|
||||||
LEAF_IDS.add(state['id'])
|
LEAF_IDS.add(state['id'])
|
||||||
|
|
||||||
|
|
||||||
|
def get(bid):
|
||||||
|
name = BLOCKS[bid]
|
||||||
|
return MCD_BLOCKS[name]
|
||||||
|
|
||||||
|
def find(name):
|
||||||
|
return MCD_BLOCKS[name]
|
||||||
|
|
|
@ -10,6 +10,7 @@ idna==2.10
|
||||||
itsdangerous==1.1.0
|
itsdangerous==1.1.0
|
||||||
Jinja2==2.11.2
|
Jinja2==2.11.2
|
||||||
MarkupSafe==1.1.1
|
MarkupSafe==1.1.1
|
||||||
|
minecraft-data==2.67.0
|
||||||
panda3d==1.10.6.post2
|
panda3d==1.10.6.post2
|
||||||
pathtools==0.1.2
|
pathtools==0.1.2
|
||||||
pycparser==2.20
|
pycparser==2.20
|
||||||
|
|
Loading…
Reference in New Issue
Block a user