From f65967342a8c5566c36b821af535ce38a64c8c0b Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Mon, 15 Feb 2021 08:27:56 +0000 Subject: [PATCH] Select a log to avoid using tools --- items.py | 13 +++++++++++++ jobs.py | 9 ++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/items.py b/items.py index f0fcc4d..e37c86e 100644 --- a/items.py +++ b/items.py @@ -58,6 +58,15 @@ FOOD = [ 'cooked_salmon', ] +LOGS = [ + 'oak_log', + 'spruce_log', + 'birch_log', + 'jungle_log', + 'acacia_log', + 'dark_oak_log', +] + BED_IDS = set() for item_name in BEDS: BED_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id']) @@ -78,6 +87,10 @@ SAPLING_IDS = set() for item_name in SAPLINGS: SAPLING_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id']) +LOG_IDS = set() +for item_name in LOGS: + LOG_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id']) + ITEM_NAMES = {} for item_name, item in ITEMS.items(): ITEM_NAMES[ITEMS[item_name]['protocol_id']] = item_name.replace('minecraft:', '') diff --git a/jobs.py b/jobs.py index f44539f..cb9a47e 100644 --- a/jobs.py +++ b/jobs.py @@ -5,8 +5,6 @@ import random from itertools import count from math import hypot -from panda3d.core import LPoint3f - from minecraft.networking.types import BlockFace from protocol.managers import ChunkNotLoadedException @@ -1301,9 +1299,14 @@ class ClearLeavesStates: self.state = self.cleanup return - self.state = self.find_leaves + self.state = self.select_log print('Clearing leaves...') + def select_log(self): + # select a log to avoid using tools + self.g.game.select_item(items.LOG_IDS) + self.state = self.find_leaves + def find_leaves(self): w = self.g.world p = utils.pint(self.g.pos)