Compare commits

..

No commits in common. "7caa51f011fad4cb19140c8a26bb3f3fe069d811" and "650398255b57d45992d1a80d0a5ded2ba7f367b6" have entirely different histories.

8 changed files with 33 additions and 34 deletions

View File

@ -36,7 +36,7 @@ class Commands:
elif text == 'You are no longer AFK.': elif text == 'You are no longer AFK.':
self.g.afk = False self.g.afk = False
match1 = re.match(r'.*<(\w+)> (.*)', text) match1 = re.match(r'<?(\w+)> (.*)', text)
match2 = re.match(r'\[(\w+) -> me] (.*)', text) match2 = re.match(r'\[(\w+) -> me] (.*)', text)
if match1: if match1:
sender, text = match1.groups() sender, text = match1.groups()

View File

@ -54,7 +54,11 @@ class CacheItemsStates:
chest = self.trapped_chests[0] chest = self.trapped_chests[0]
navpath = w.path_to_place_faked(p, chest) tmp = c.get_block_at(*chest)
c.set_block_at(*chest, blocks.AIR)
navpath = w.path_to_place(p, chest)
c.set_block_at(*chest, tmp)
print('navpath:', navpath) print('navpath:', navpath)
if navpath: if navpath:

View File

@ -81,8 +81,10 @@ class GatherSandStates:
p = utils.pint(self.g.pos) p = utils.pint(self.g.pos)
c = self.g.chunks c = self.g.chunks
navpath = w.path_to_place_faked(p, self.sand) tmp = c.get_block_at(*self.sand)
print('navpath:', navpath) c.set_block_at(*self.sand, blocks.AIR)
navpath = w.path_to_place(p, self.sand)
c.set_block_at(*self.sand, tmp)
if navpath: if navpath:
self.g.path = navpath[:-1] self.g.path = navpath[:-1]

View File

@ -61,7 +61,7 @@ class GrabSuppliesStates:
w = self.g.world w = self.g.world
p = utils.pint(self.g.pos) p = utils.pint(self.g.pos)
self.barrels = w.find_blocks_indexed(p, blocks.BARREL_IDS, 80) self.barrels = w.find_blocks_indexed(p, blocks.BARREL_IDS)
print('Found:', self.barrels) print('Found:', self.barrels)
self.state = self.choose_barrel self.state = self.choose_barrel
@ -73,7 +73,6 @@ class GrabSuppliesStates:
if barrel in self.bad_barrels: if barrel in self.bad_barrels:
continue continue
print('Chose:', barrel)
self.barrel = barrel self.barrel = barrel
self.state = self.path_to_barrel self.state = self.path_to_barrel
return return
@ -87,20 +86,26 @@ class GrabSuppliesStates:
p = utils.pint(self.g.pos) p = utils.pint(self.g.pos)
c = self.g.chunks c = self.g.chunks
navpath = w.path_to_place_faked(p, self.barrel) barrel = self.barrel
tmp = c.get_block_at(*barrel)
c.set_block_at(*barrel, blocks.AIR)
navpath = w.path_to_place(p, barrel)
c.set_block_at(*barrel, tmp)
print('navpath:', navpath) print('navpath:', navpath)
if navpath: if navpath:
self.g.path = navpath[:-1] self.g.path = navpath[:-1]
self.opening = self.g.path[-1] self.opening = self.g.path[-1]
self.checked_barrels.append(self.barrel) self.checked_barrels.append(barrel)
self.area = self.barrel self.area = barrel
self.state = self.going_to_barrel self.state = self.going_to_barrel
self.checked_supplies = [] self.checked_supplies = []
return return
else: else:
print('No path, blacklisting barrel') print('No path, blacklisting barrel')
self.bad_barrels.append(self.barrel) self.bad_barrels.append(barrel)
self.state = self.choose_barrel self.state = self.choose_barrel
def going_to_barrel(self): def going_to_barrel(self):

View File

@ -67,7 +67,11 @@ class SleepWithBedStates:
bed = self.beds[0] bed = self.beds[0]
print('Chose:', bed) print('Chose:', bed)
navpath = w.path_to_place_faked(p, bed) tmp = c.get_block_at(*bed)
c.set_block_at(*bed, blocks.AIR)
navpath = w.path_to_place(p, bed)
c.set_block_at(*bed, tmp)
print('navpath:', navpath) print('navpath:', navpath)
if navpath: if navpath:
@ -167,12 +171,12 @@ class SleepWithBedStates:
print(threats) print(threats)
self.g.game.leave_bed() self.g.game.leave_bed()
self.state = self.cleanup self.state = self.cleanup
elif self.g.correction_count:
print('Forcefully woke up')
self.state = self.collect_bed
elif self.g.time < 100: elif self.g.time < 100:
print('Woke up time') print('Woke up time')
self.state = self.break_bed self.state = self.break_bed
elif self.g.correction_count:
print('Woke up by movement')
self.state = self.break_bed
def break_bed(self): def break_bed(self):
if self.my_bed: if self.my_bed:

View File

@ -141,26 +141,6 @@ class World:
except path.AStarTimeout: except path.AStarTimeout:
return None return None
def path_to_place_faked(self, start, place):
# same as above, but adds a fake block below and air before pathfinding
# so that the pathfinder can actually make it to the block
c = self.g.chunks
above = utils.padd(place, path.BLOCK_ABOVE)
below = utils.padd(place, path.BLOCK_BELOW)
tmp = c.get_block_at(*place)
tmp2 = c.get_block_at(*above)
tmp3 = c.get_block_at(*below)
c.set_block_at(*place, blocks.AIR)
c.set_block_at(*above, blocks.AIR)
c.set_block_at(*below, blocks.STONE)
navpath = self.path_to_place(start, place)
c.set_block_at(*place, tmp)
c.set_block_at(*above, tmp2)
c.set_block_at(*below, tmp3)
return navpath
def find_bed_areas(self, center, distance): def find_bed_areas(self, center, distance):
bed_clearance = 9 # 5x5 area bed_clearance = 9 # 5x5 area
clear_distance = 2 clear_distance = 2

View File

@ -49,6 +49,7 @@ fi
if [ ! -d "minecraft_data" ] if [ ! -d "minecraft_data" ]
then then
echo "Grabbing minecraft data..." echo "Grabbing minecraft data..."
sleep 2
VERSION="1.16.4" VERSION="1.16.4"
@ -63,6 +64,7 @@ fi
if [ ! -d "env" ] if [ ! -d "env" ]
then then
echo "Installing Python requirements..." echo "Installing Python requirements..."
sleep 2
virtualenv -p python3 env virtualenv -p python3 env
source env/bin/activate source env/bin/activate

View File

@ -54,6 +54,7 @@ fi
# download minecraft data # download minecraft data
echo "Grabbing minecraft data..." echo "Grabbing minecraft data..."
sleep 2
VERSION="1.16.4" VERSION="1.16.4"
@ -74,6 +75,7 @@ git stash pop || true
# create virtual environment # create virtual environment
echo "Installing Python requirements..." echo "Installing Python requirements..."
sleep 2
rm -r env || true rm -r env || true
rm -r __pycache__ || true rm -r __pycache__ || true