Compare commits
No commits in common. "a509f5d1eff7051e578718cea8bf964fe1856b9f" and "27b8f714521ca6c2860d7419761048cceea29ad0" have entirely different histories.
a509f5d1ef
...
27b8f71452
390
blocks.py
390
blocks.py
|
@ -1,238 +1,216 @@
|
||||||
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:
|
||||||
JSON_BLOCKS = json.load(f)
|
BLOCKS = json.load(f)
|
||||||
|
|
||||||
BLOCKS = {}
|
|
||||||
for name, data in JSON_BLOCKS.items():
|
|
||||||
for state in data['states']:
|
|
||||||
BLOCKS[state['id']] = name.replace('minecraft:', '')
|
|
||||||
|
|
||||||
SINGLE_SNOW = 3921
|
|
||||||
SOUL_TORCH = 4008
|
|
||||||
|
|
||||||
AVOID = [
|
AVOID = [
|
||||||
'lava',
|
'minecraft:lava',
|
||||||
'water',
|
'minecraft:water',
|
||||||
'fire',
|
'minecraft:fire',
|
||||||
'magma_block',
|
'minecraft:magma_block',
|
||||||
'oak_fence',
|
'minecraft:oak_fence',
|
||||||
'oak_fence_gate',
|
'minecraft:oak_fence_gate',
|
||||||
'nether_brick_fence',
|
'minecraft:nether_brick_fence',
|
||||||
'spruce_fence_gate',
|
'minecraft:spruce_fence_gate',
|
||||||
'birch_fence_gate',
|
'minecraft:birch_fence_gate',
|
||||||
'jungle_fence_gate',
|
'minecraft:jungle_fence_gate',
|
||||||
'acacia_fence_gate',
|
'minecraft:acacia_fence_gate',
|
||||||
'dark_oak_fence_gate',
|
'minecraft:dark_oak_fence_gate',
|
||||||
'spruce_fence',
|
'minecraft:spruce_fence',
|
||||||
'birch_fence',
|
'minecraft:birch_fence',
|
||||||
'jungle_fence',
|
'minecraft:jungle_fence',
|
||||||
'acacia_fence',
|
'minecraft:acacia_fence',
|
||||||
'dark_oak_fence',
|
'minecraft:dark_oak_fence',
|
||||||
'sweet_berry_bush',
|
'minecraft:sweet_berry_bush',
|
||||||
'nether_portal',
|
'minecraft:nether_portal',
|
||||||
'end_portal',
|
'minecraft:end_portal',
|
||||||
'cobblestone_wall',
|
'minecraft:cobblestone_wall',
|
||||||
'mossy_cobblestone_wall',
|
'minecraft:mossy_cobblestone_wall',
|
||||||
'brick_wall',
|
'minecraft:brick_wall',
|
||||||
'prismarine_wall',
|
'minecraft:prismarine_wall',
|
||||||
'red_sandstone_wall',
|
'minecraft:red_sandstone_wall',
|
||||||
'mossy_stone_brick_wall',
|
'minecraft:mossy_stone_brick_wall',
|
||||||
'granite_wall',
|
'minecraft:granite_wall',
|
||||||
'stone_brick_wall',
|
'minecraft:stone_brick_wall',
|
||||||
'nether_brick_wall',
|
'minecraft:nether_brick_wall',
|
||||||
'andesite_wall',
|
'minecraft:andesite_wall',
|
||||||
'red_nether_brick_wall',
|
'minecraft:red_nether_brick_wall',
|
||||||
'sandstone_wall',
|
'minecraft:sandstone_wall',
|
||||||
'end_stone_brick_wall',
|
'minecraft:end_stone_brick_wall',
|
||||||
'diorite_wall',
|
'minecraft:diorite_wall',
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
NON_SOLID = [
|
NON_SOLID = [
|
||||||
'air',
|
'minecraft:air',
|
||||||
'powered_rail',
|
'minecraft:powered_rail',
|
||||||
'detector_rail',
|
'minecraft:detector_rail',
|
||||||
'grass',
|
'minecraft:grass',
|
||||||
'fern',
|
'minecraft:fern',
|
||||||
'dead_bush',
|
'minecraft:dead_bush',
|
||||||
'seagrass',
|
'minecraft:seagrass',
|
||||||
'tall_seagrass',
|
'minecraft:tall_seagrass',
|
||||||
'dandelion',
|
'minecraft:dandelion',
|
||||||
'poppy',
|
'minecraft:poppy',
|
||||||
'blue_orchid',
|
'minecraft:blue_orchid',
|
||||||
'allium',
|
'minecraft:allium',
|
||||||
'azure_bluet',
|
'minecraft:azure_bluet',
|
||||||
'red_tulip',
|
'minecraft:red_tulip',
|
||||||
'orange_tulip',
|
'minecraft:orange_tulip',
|
||||||
'white_tulip',
|
'minecraft:white_tulip',
|
||||||
'pink_tulip',
|
'minecraft:pink_tulip',
|
||||||
'oxeye_daisy',
|
'minecraft:oxeye_daisy',
|
||||||
'cornflower',
|
'minecraft:cornflower',
|
||||||
'wither_rose',
|
'minecraft:wither_rose',
|
||||||
'lily_of_the_valley',
|
'minecraft:lily_of_the_valley',
|
||||||
'brown_mushroom',
|
'minecraft:brown_mushroom',
|
||||||
'red_mushroom',
|
'minecraft:red_mushroom',
|
||||||
'torch',
|
'minecraft:torch',
|
||||||
'wall_torch',
|
'minecraft:wall_torch',
|
||||||
'redstone_wire',
|
'minecraft:redstone_wire',
|
||||||
'wheat',
|
'minecraft:wheat',
|
||||||
'oak_sign',
|
'minecraft:oak_sign',
|
||||||
'spruce_sign',
|
'minecraft:spruce_sign',
|
||||||
'birch_sign',
|
'minecraft:birch_sign',
|
||||||
'acacia_sign',
|
'minecraft:acacia_sign',
|
||||||
'jungle_sign',
|
'minecraft:jungle_sign',
|
||||||
'dark_oak_sign',
|
'minecraft:dark_oak_sign',
|
||||||
'rail',
|
'minecraft:rail',
|
||||||
'oak_wall_sign',
|
'minecraft:oak_wall_sign',
|
||||||
'spruce_wall_sign',
|
'minecraft:spruce_wall_sign',
|
||||||
'birch_wall_sign',
|
'minecraft:birch_wall_sign',
|
||||||
'acacia_wall_sign',
|
'minecraft:acacia_wall_sign',
|
||||||
'jungle_wall_sign',
|
'minecraft:jungle_wall_sign',
|
||||||
'dark_oak_wall_sign',
|
'minecraft:dark_oak_wall_sign',
|
||||||
'lever',
|
'minecraft:lever',
|
||||||
'stone_pressure_plate',
|
'minecraft:stone_pressure_plate',
|
||||||
'oak_pressure_plate',
|
'minecraft:oak_pressure_plate',
|
||||||
'spruce_pressure_plate',
|
'minecraft:spruce_pressure_plate',
|
||||||
'birch_pressure_plate',
|
'minecraft:birch_pressure_plate',
|
||||||
'jungle_pressure_plate',
|
'minecraft:jungle_pressure_plate',
|
||||||
'acacia_pressure_plate',
|
'minecraft:acacia_pressure_plate',
|
||||||
'dark_oak_pressure_plate',
|
'minecraft:dark_oak_pressure_plate',
|
||||||
'redstone_torch',
|
'minecraft:redstone_torch',
|
||||||
'redstone_wall_torch',
|
'minecraft:redstone_wall_torch',
|
||||||
'stone_button',
|
'minecraft:stone_button',
|
||||||
'sugar_cane',
|
'minecraft:sugar_cane',
|
||||||
'repeater',
|
'minecraft:repeater',
|
||||||
'attached_pumpkin_stem',
|
'minecraft:attached_pumpkin_stem',
|
||||||
'attached_melon_stem',
|
'minecraft:attached_melon_stem',
|
||||||
'pumpkin_stem',
|
'minecraft:pumpkin_stem',
|
||||||
'melon_stem',
|
'minecraft:melon_stem',
|
||||||
'nether_wart',
|
'minecraft:nether_wart',
|
||||||
'tripwire_hook',
|
'minecraft:tripwire_hook',
|
||||||
'tripwire',
|
'minecraft:tripwire',
|
||||||
'carrots',
|
'minecraft:carrots',
|
||||||
'potatoes',
|
'minecraft:potatoes',
|
||||||
'oak_button',
|
'minecraft:oak_button',
|
||||||
'spruce_button',
|
'minecraft:spruce_button',
|
||||||
'birch_button',
|
'minecraft:birch_button',
|
||||||
'jungle_button',
|
'minecraft:jungle_button',
|
||||||
'acacia_button',
|
'minecraft:acacia_button',
|
||||||
'dark_oak_button',
|
'minecraft:dark_oak_button',
|
||||||
'light_weighted_pressure_plate',
|
'minecraft:light_weighted_pressure_plate',
|
||||||
'heavy_weighted_pressure_plate',
|
'minecraft:heavy_weighted_pressure_plate',
|
||||||
'comparator',
|
'minecraft:comparator',
|
||||||
'activator_rail',
|
'minecraft:activator_rail',
|
||||||
'white_carpet',
|
'minecraft:white_carpet',
|
||||||
'orange_carpet',
|
'minecraft:orange_carpet',
|
||||||
'magenta_carpet',
|
'minecraft:magenta_carpet',
|
||||||
'light_blue_carpet',
|
'minecraft:light_blue_carpet',
|
||||||
'yellow_carpet',
|
'minecraft:yellow_carpet',
|
||||||
'lime_carpet',
|
'minecraft:lime_carpet',
|
||||||
'pink_carpet',
|
'minecraft:pink_carpet',
|
||||||
'gray_carpet',
|
'minecraft:gray_carpet',
|
||||||
'light_gray_carpet',
|
'minecraft:light_gray_carpet',
|
||||||
'cyan_carpet',
|
'minecraft:cyan_carpet',
|
||||||
'purple_carpet',
|
'minecraft:purple_carpet',
|
||||||
'blue_carpet',
|
'minecraft:blue_carpet',
|
||||||
'brown_carpet',
|
'minecraft:brown_carpet',
|
||||||
'green_carpet',
|
'minecraft:green_carpet',
|
||||||
'red_carpet',
|
'minecraft:red_carpet',
|
||||||
'black_carpet',
|
'minecraft:black_carpet',
|
||||||
'sunflower',
|
'minecraft:sunflower',
|
||||||
'lilac',
|
'minecraft:lilac',
|
||||||
'rose_bush',
|
'minecraft:rose_bush',
|
||||||
'peony',
|
'minecraft:peony',
|
||||||
'tall_grass',
|
'minecraft:tall_grass',
|
||||||
'large_fern',
|
'minecraft:large_fern',
|
||||||
'white_banner',
|
'minecraft:white_banner',
|
||||||
'orange_banner',
|
'minecraft:orange_banner',
|
||||||
'magenta_banner',
|
'minecraft:magenta_banner',
|
||||||
'light_blue_banner',
|
'minecraft:light_blue_banner',
|
||||||
'yellow_banner',
|
'minecraft:yellow_banner',
|
||||||
'lime_banner',
|
'minecraft:lime_banner',
|
||||||
'pink_banner',
|
'minecraft:pink_banner',
|
||||||
'gray_banner',
|
'minecraft:gray_banner',
|
||||||
'light_gray_banner',
|
'minecraft:light_gray_banner',
|
||||||
'cyan_banner',
|
'minecraft:cyan_banner',
|
||||||
'purple_banner',
|
'minecraft:purple_banner',
|
||||||
'blue_banner',
|
'minecraft:blue_banner',
|
||||||
'brown_banner',
|
'minecraft:brown_banner',
|
||||||
'green_banner',
|
'minecraft:green_banner',
|
||||||
'red_banner',
|
'minecraft:red_banner',
|
||||||
'black_banner',
|
'minecraft:black_banner',
|
||||||
'white_wall_banner',
|
'minecraft:white_wall_banner',
|
||||||
'orange_wall_banner',
|
'minecraft:orange_wall_banner',
|
||||||
'magenta_wall_banner',
|
'minecraft:magenta_wall_banner',
|
||||||
'light_blue_wall_banner',
|
'minecraft:light_blue_wall_banner',
|
||||||
'yellow_wall_banner',
|
'minecraft:yellow_wall_banner',
|
||||||
'lime_wall_banner',
|
'minecraft:lime_wall_banner',
|
||||||
'pink_wall_banner',
|
'minecraft:pink_wall_banner',
|
||||||
'gray_wall_banner',
|
'minecraft:gray_wall_banner',
|
||||||
'light_gray_wall_banner',
|
'minecraft:light_gray_wall_banner',
|
||||||
'cyan_wall_banner',
|
'minecraft:cyan_wall_banner',
|
||||||
'purple_wall_banner',
|
'minecraft:purple_wall_banner',
|
||||||
'blue_wall_banner',
|
'minecraft:blue_wall_banner',
|
||||||
'brown_wall_banner',
|
'minecraft:brown_wall_banner',
|
||||||
'green_wall_banner',
|
'minecraft:green_wall_banner',
|
||||||
'red_wall_banner',
|
'minecraft:red_wall_banner',
|
||||||
'black_wall_banner',
|
'minecraft:black_wall_banner',
|
||||||
'beetroots',
|
'minecraft:beetroots',
|
||||||
'bamboo_sapling',
|
'minecraft:bamboo_sapling',
|
||||||
'void_air',
|
'minecraft:void_air',
|
||||||
'cave_air',
|
'minecraft:cave_air',
|
||||||
'lantern',
|
'minecraft:lantern',
|
||||||
'soul_torch',
|
|
||||||
]
|
]
|
||||||
|
SINGLE_SNOW = 3919
|
||||||
|
|
||||||
LOGS = [
|
LOGS = [
|
||||||
'oak_log',
|
'minecraft:oak_log',
|
||||||
'spruce_log',
|
'minecraft:spruce_log',
|
||||||
'birch_log',
|
'minecraft:birch_log',
|
||||||
'jungle_log',
|
'minecraft:jungle_log',
|
||||||
'acacia_log',
|
'minecraft:acacia_log',
|
||||||
'dark_oak_log',
|
'minecraft:dark_oak_log',
|
||||||
]
|
]
|
||||||
|
|
||||||
LEAVES = [
|
LEAVES = [
|
||||||
'oak_leaves',
|
'minecraft:oak_leaves',
|
||||||
'spruce_leaves',
|
'minecraft:spruce_leaves',
|
||||||
'birch_leaves',
|
'minecraft:birch_leaves',
|
||||||
'jungle_leaves',
|
'minecraft:jungle_leaves',
|
||||||
'acacia_leaves',
|
'minecraft:acacia_leaves',
|
||||||
'dark_oak_leaves',
|
'minecraft: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 JSON_BLOCKS['minecraft:' + block_name]['states']:
|
for state in BLOCKS[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 JSON_BLOCKS['minecraft:' + block_name]['states']:
|
for state in BLOCKS[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 JSON_BLOCKS['minecraft:' + block_name]['states']:
|
for state in BLOCKS[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 JSON_BLOCKS['minecraft:' + block_name]['states']:
|
for state in BLOCKS[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,8 +10,6 @@ import utils
|
||||||
importlib.reload(utils)
|
importlib.reload(utils)
|
||||||
import path
|
import path
|
||||||
importlib.reload(path)
|
importlib.reload(path)
|
||||||
import blocks
|
|
||||||
importlib.reload(blocks)
|
|
||||||
|
|
||||||
def handle_join_game(packet, g):
|
def handle_join_game(packet, g):
|
||||||
print('Connected.')
|
print('Connected.')
|
||||||
|
@ -21,7 +19,7 @@ def handle_join_game(packet, g):
|
||||||
def handle_block_change(packet, g):
|
def handle_block_change(packet, g):
|
||||||
l = g.local_state
|
l = g.local_state
|
||||||
|
|
||||||
if packet.block_state_id == blocks.SOUL_TORCH:
|
if packet.block_state_id == 3887:
|
||||||
try:
|
try:
|
||||||
l.goal = LPoint3f(x=packet.location[0], y=packet.location[1], z=packet.location[2])
|
l.goal = LPoint3f(x=packet.location[0], y=packet.location[1], z=packet.location[2])
|
||||||
print('new waypoint:', l.goal)
|
print('new waypoint:', l.goal)
|
||||||
|
|
24
path.py
24
path.py
|
@ -188,47 +188,47 @@ class Pathfinder(AStar):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check_ascend(self, node, offset):
|
def check_ascend(self, node, offset):
|
||||||
|
if not self.check_traverse(node, offset):
|
||||||
|
return False
|
||||||
|
|
||||||
dest = utils.padd(node, offset)
|
dest = utils.padd(node, offset)
|
||||||
|
|
||||||
if not self.bair(utils.padd(node, BLOCK_ABOVE2)):
|
if not self.bair(utils.padd(node, BLOCK_ABOVE2)):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not self.check_traverse(node, offset):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check_descend(self, node, offset):
|
def check_descend(self, node, offset):
|
||||||
|
if not self.check_traverse(node, offset):
|
||||||
|
return False
|
||||||
|
|
||||||
dest = utils.padd(node, offset)
|
dest = utils.padd(node, offset)
|
||||||
|
|
||||||
if not self.bair(utils.padd(dest, BLOCK_ABOVE2)):
|
if not self.bair(utils.padd(dest, BLOCK_ABOVE2)):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not self.check_traverse(node, offset):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check_descend2(self, node, offset):
|
def check_descend2(self, node, offset):
|
||||||
|
if not self.check_descend(node, offset):
|
||||||
|
return False
|
||||||
|
|
||||||
dest = utils.padd(node, offset)
|
dest = utils.padd(node, offset)
|
||||||
|
|
||||||
if not self.bair(utils.padd(dest, BLOCK_ABOVE3)):
|
if not self.bair(utils.padd(dest, BLOCK_ABOVE3)):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not self.check_descend(node, offset):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check_descend3(self, node, offset):
|
def check_descend3(self, node, offset):
|
||||||
|
if not self.check_descend2(node, offset):
|
||||||
|
return False
|
||||||
|
|
||||||
dest = utils.padd(node, offset)
|
dest = utils.padd(node, offset)
|
||||||
|
|
||||||
if not self.bair(utils.padd(dest, BLOCK_ABOVE4)):
|
if not self.bair(utils.padd(dest, BLOCK_ABOVE4)):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not self.check_descend2(node, offset):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check_parkour(self, node, offset):
|
def check_parkour(self, node, offset):
|
||||||
|
|
|
@ -10,7 +10,6 @@ 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