Set sand origin when command is given

This commit is contained in:
2021-04-24 22:34:25 +00:00
parent a5642409d2
commit 4026b410f4
5 changed files with 14 additions and 6 deletions

View File

@@ -27,6 +27,9 @@ class GatherSandStates:
return None
def init(self):
if not self.g.sand_origin or not self.g.chunks.check_loaded(self.g.sand_origin):
self.g.sand_origin = utils.pint(self.g.pos)
self.state = self.select_shovel
def select_shovel(self):
@@ -36,10 +39,11 @@ class GatherSandStates:
def find_new_slice(self):
print('Finding new slice...')
w = self.g.world
origin = self.g.sand_origin
print('using origin', self.origin)
print('using origin', self.g.sand_origin)
start = time.time()
self.prev_layer, s = w.find_sand_slice(self.origin, 200, 10, self.bad_slices, self.prev_layer)
self.prev_layer, s = w.find_sand_slice(self.g.sand_origin, 200, 10, self.bad_slices, self.prev_layer)
print('Found slice:', s, 'in', time.time() - start, 'seconds')
if s:
@@ -117,8 +121,6 @@ class GatherSandStates:
self.g = global_state
self.state = self.idle
self.origin = utils.pint(self.g.pos)
self.origin = (2019, 64, 238)
self.slice = None
self.bad_slices = []
self.prev_layer = 0

View File

@@ -38,7 +38,7 @@ class SleepWithBedStates:
w = self.g.world
p = utils.pint(self.g.pos)
result = w.find_blocks_indexed(p, blocks.BED_IDS)
result = w.find_blocks_indexed(p, blocks.BED_IDS, 80)
self.beds = []
for bed in result: