Select a log to avoid using tools

This commit is contained in:
Tanner Collin 2021-02-15 08:27:56 +00:00
parent 3c3287a1d5
commit f65967342a
2 changed files with 19 additions and 3 deletions

View File

@ -58,6 +58,15 @@ FOOD = [
'cooked_salmon', 'cooked_salmon',
] ]
LOGS = [
'oak_log',
'spruce_log',
'birch_log',
'jungle_log',
'acacia_log',
'dark_oak_log',
]
BED_IDS = set() BED_IDS = set()
for item_name in BEDS: for item_name in BEDS:
BED_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id']) BED_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id'])
@ -78,6 +87,10 @@ SAPLING_IDS = set()
for item_name in SAPLINGS: for item_name in SAPLINGS:
SAPLING_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id']) 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 = {} ITEM_NAMES = {}
for item_name, item in ITEMS.items(): for item_name, item in ITEMS.items():
ITEM_NAMES[ITEMS[item_name]['protocol_id']] = item_name.replace('minecraft:', '') ITEM_NAMES[ITEMS[item_name]['protocol_id']] = item_name.replace('minecraft:', '')

View File

@ -5,8 +5,6 @@ import random
from itertools import count from itertools import count
from math import hypot from math import hypot
from panda3d.core import LPoint3f
from minecraft.networking.types import BlockFace from minecraft.networking.types import BlockFace
from protocol.managers import ChunkNotLoadedException from protocol.managers import ChunkNotLoadedException
@ -1301,9 +1299,14 @@ class ClearLeavesStates:
self.state = self.cleanup self.state = self.cleanup
return return
self.state = self.find_leaves self.state = self.select_log
print('Clearing leaves...') 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): def find_leaves(self):
w = self.g.world w = self.g.world
p = utils.pint(self.g.pos) p = utils.pint(self.g.pos)