Compare commits

..

No commits in common. "5ff0394dc36137417575e99b15924bfa9fc4fbf4" and "fc929db6589e68409efd364f8b6d988d07e3dc40" have entirely different histories.

4 changed files with 109 additions and 46 deletions

100
blocks.py
View File

@ -28,6 +28,10 @@ EMERALD_BLOCK = 5407
TEST_BLOCK = (616, 78, 496) TEST_BLOCK = (616, 78, 496)
WATER = [
'water',
]
AVOID = [ AVOID = [
'lava', 'lava',
'water', 'water',
@ -259,37 +263,89 @@ INDEXED = [
'barrel', 'barrel',
] + BEDS ] + BEDS
def get_set(ids):
result = set() NON_SOLID_IDS = set([SINGLE_SNOW])
for block_name in ids: for block_name in NON_SOLID:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']: for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
result.add(state['id']) NON_SOLID_IDS.add(state['id'])
return result
AVOID_IDS = set()
for block_name in AVOID:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
AVOID_IDS.add(state['id'])
WATER_IDS = set()
for block_name in WATER:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
WATER_IDS.add(state['id'])
LOG_IDS = set()
for block_name in LOGS:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
LOG_IDS.add(state['id'])
LEAF_IDS = set()
for block_name in LEAVES:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
LEAF_IDS.add(state['id'])
CHEST_IDS = set()
for block_name in ['chest']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
CHEST_IDS.add(state['id'])
BARREL_IDS = set()
for block_name in ['barrel']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
BARREL_IDS.add(state['id'])
TRAPPED_CHEST_IDS = set()
for block_name in ['trapped_chest']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
TRAPPED_CHEST_IDS.add(state['id'])
NETHERWART_IDS = set()
for block_name in ['nether_wart']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
NETHERWART_IDS.add(state['id'])
WHEAT_IDS = set()
for block_name in ['wheat']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
WHEAT_IDS.add(state['id'])
POTATO_IDS = set()
for block_name in ['potatoes']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
POTATO_IDS.add(state['id'])
CARROT_IDS = set()
for block_name in ['carrots']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
CARROT_IDS.add(state['id'])
BEETROOT_IDS = set()
for block_name in ['beetroots']:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
BEETROOT_IDS.add(state['id'])
SAPLING_IDS = set()
for block_name in SAPLINGS:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
SAPLING_IDS.add(state['id'])
BED_IDS = set()
for block_name in BEDS:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
BED_IDS.add(state['id'])
NON_SOLID_IDS = get_set(NON_SOLID)
NON_SOLID_IDS.add(SINGLE_SNOW)
AVOID_IDS = get_set(AVOID)
WATER_IDS = get_set(['water'])
LOG_IDS = get_set(LOGS)
LEAF_IDS = get_set(LEAVES)
CHEST_IDS = get_set(['chest'])
BARREL_IDS = get_set(['barrel'])
TRAPPED_CHEST_IDS = get_set(['trapped_chest'])
NETHERWART_IDS = get_set(['nether_wart'])
WHEAT_IDS = get_set(['wheat'])
POTATO_IDS = get_set(['potatoes'])
CARROT_IDS = get_set(['carrots'])
BEETROOT_IDS = get_set(['beetroots'])
SAPLING_IDS = get_set(SAPLINGS)
BED_IDS = get_set(BEDS)
INDEXED_IDS = set() INDEXED_IDS = set()
for block_name in INDEXED: for block_name in INDEXED:
for state in JSON_BLOCKS['minecraft:' + block_name]['states']: for state in JSON_BLOCKS['minecraft:' + block_name]['states']:
INDEXED_IDS.add(state['id']) INDEXED_IDS.add(state['id'])
MATURE_WHEAT_ID = max(WHEAT_IDS) MATURE_WHEAT_ID = max(WHEAT_IDS)
MATURE_POTATO_ID = max(POTATO_IDS) MATURE_POTATO_ID = max(POTATO_IDS)
MATURE_CARROT_ID = max(CARROT_IDS) MATURE_CARROT_ID = max(CARROT_IDS)

4
bot.py
View File

@ -226,8 +226,8 @@ def init(global_state):
g.filling = False g.filling = False
g.minimum_cache_slots = 27 g.minimum_cache_slots = 33
g.maximum_supply_slots = 33 g.maximum_supply_slots = 27
def bot(global_state): def bot(global_state):
g = global_state g = global_state

View File

@ -67,25 +67,34 @@ LOGS = [
'dark_oak_log', 'dark_oak_log',
] ]
BED_IDS = set()
for item_name in BEDS:
BED_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id'])
def get_set(ids): SHOVEL_IDS = set()
result = set() for item_name in SHOVELS:
for item_name in ids: SHOVEL_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id'])
result.add(ITEMS['minecraft:'+item_name]['protocol_id'])
return result
BED_IDS = get_set(BEDS) AXE_IDS = set()
SHOVEL_IDS = get_set(SHOVELS) for item_name in AXES:
AXE_IDS = get_set(AXES) AXE_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id'])
FOOD_IDS = get_set(FOOD)
SAPLING_IDS = get_set(SAPLINGS) FOOD_IDS = set()
LOG_IDS = get_set(LOGS) for item_name in FOOD:
FOOD_IDS.add(ITEMS['minecraft:'+item_name]['protocol_id'])
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 = {} 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:', '')
def get_id(name): def get_id(name):
return ITEMS['minecraft:' + name]['protocol_id'] return ITEMS['minecraft:' + name]['protocol_id']
@ -106,16 +115,14 @@ BERRIES_ID = get_id('sweet_berries')
IRON_INGOT_ID = get_id('iron_ingot') IRON_INGOT_ID = get_id('iron_ingot')
INIT_NEEDED_ITEMS = BED_IDS | FOOD_IDS INIT_NEEDED_ITEMS = BED_IDS | FOOD_IDS | set([CHEST_ID])
INIT_NEEDED_ITEMS.add(CHEST_ID)
NEEDED_ITEMS = INIT_NEEDED_ITEMS NEEDED_ITEMS = INIT_NEEDED_ITEMS
INIT_WANTED_ITEMS = set() INIT_WANTED_ITEMS = set()
WANTED_ITEMS = INIT_WANTED_ITEMS WANTED_ITEMS = INIT_WANTED_ITEMS
def set_needed(items): def set_needed(items):
NEEDED_ITEMS = INIT_NEEDED_ITEMS | items NEEDED_ITEMS = INIT_WANTED_ITEMS | items
def set_wanted(items): def set_wanted(items):
WANTED_ITEMS = INIT_WANTED_ITEMS | items WANTED_ITEMS = INIT_WANTED_ITEMS | items

10
jobs.py
View File

@ -2298,11 +2298,11 @@ class JobStates:
self.sleep_with_bed_states.silent = True self.sleep_with_bed_states.silent = True
self.cache_items_states.silent = True self.cache_items_states.silent = True
self.grab_supplies_states.supplies = { self.grab_supplies_states.supplies = {
tuple([items.PUMPKIN_ID]): (64, 3), tuple([items.PUMPKIN_ID]): (64, 9),
tuple([items.BERRIES_ID]): (64, 3), tuple([items.BERRIES_ID]): (64, 9),
tuple([items.IRON_INGOT_ID]): (64, 3), tuple([items.IRON_INGOT_ID]): (64, 9),
tuple([items.WHEAT_ID]): (64, 3), tuple([items.WHEAT_ID]): (64, 9),
tuple([items.POTATO_ID]): (64, 3), tuple([items.POTATO_ID]): (64, 9),
} }
items.set_needed(set([ items.set_needed(set([