diff --git a/blocks.py b/blocks.py index 9e1ae45..80cc34e 100644 --- a/blocks.py +++ b/blocks.py @@ -15,6 +15,9 @@ 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 = [ 'lava', 'water', @@ -184,8 +187,8 @@ NON_SOLID = [ 'void_air', 'cave_air', 'lantern', + 'soul_torch', ] -SINGLE_SNOW = 3919 LOGS = [ 'oak_log', diff --git a/packet_handlers.py b/packet_handlers.py index 8833ae0..844ef2f 100644 --- a/packet_handlers.py +++ b/packet_handlers.py @@ -10,6 +10,8 @@ import utils importlib.reload(utils) import path importlib.reload(path) +import blocks +importlib.reload(blocks) def handle_join_game(packet, g): print('Connected.') @@ -19,7 +21,7 @@ def handle_join_game(packet, g): def handle_block_change(packet, g): l = g.local_state - if packet.block_state_id == 3887: + if packet.block_state_id == blocks.SOUL_TORCH: try: l.goal = LPoint3f(x=packet.location[0], y=packet.location[1], z=packet.location[2]) print('new waypoint:', l.goal) diff --git a/path.py b/path.py index deff7f0..e980ffd 100644 --- a/path.py +++ b/path.py @@ -188,47 +188,47 @@ class Pathfinder(AStar): return True def check_ascend(self, node, offset): - if not self.check_traverse(node, offset): - return False - dest = utils.padd(node, offset) if not self.bair(utils.padd(node, BLOCK_ABOVE2)): return False - return True - - def check_descend(self, node, offset): if not self.check_traverse(node, offset): return False + return True + + def check_descend(self, node, offset): dest = utils.padd(node, offset) if not self.bair(utils.padd(dest, BLOCK_ABOVE2)): return False + if not self.check_traverse(node, offset): + return False + return True def check_descend2(self, node, offset): - if not self.check_descend(node, offset): - return False - dest = utils.padd(node, offset) if not self.bair(utils.padd(dest, BLOCK_ABOVE3)): return False + if not self.check_descend(node, offset): + return False + return True def check_descend3(self, node, offset): - if not self.check_descend2(node, offset): - return False - dest = utils.padd(node, offset) if not self.bair(utils.padd(dest, BLOCK_ABOVE4)): return False + if not self.check_descend2(node, offset): + return False + return True def check_parkour(self, node, offset):