Port sand gathering to 26.3
This commit is contained in:
1 parent
f28269f71c
commit
3e8b95c895
9 files changed
+424
-158
No files matched your search
+19
-8
@@ -29,6 +29,18 @@ class Commands:
|
||||
else:
|
||||
self.g.chat.send(reply)
|
||||
|
||||
def _prepare_sand_origin(self):
|
||||
position = utils.pint(self.g.pos)
|
||||
origins = self.g.world.find_sand_origins(position, self.g.name)
|
||||
self.g.sand_origin_from_sign = bool(origins)
|
||||
if origins:
|
||||
self.g.sand_origin = origins[0]['position']
|
||||
print('Using sand origin sign at', self.g.sand_origin)
|
||||
elif (not self.g.sand_origin or
|
||||
self.g.chunks.get_block_at(*self.g.sand_origin) is None):
|
||||
self.g.sand_origin = position
|
||||
print('Using current position as sand origin', position)
|
||||
|
||||
def handle_chat(self, message):
|
||||
source, sender, text = message[:3]
|
||||
reply_target = message[3] if len(message) > 3 else sender
|
||||
@@ -70,11 +82,12 @@ class Commands:
|
||||
'trade', 'gapple', 'fill',
|
||||
'break', 'open', 'click', 'use', 'interact',
|
||||
}
|
||||
if ((command == 'gather' and data.lower().strip() != 'wood') or
|
||||
if ((command == 'gather' and
|
||||
data.lower().strip() not in ('wood', 'sand')) or
|
||||
command in unsupported or
|
||||
(command == 'farm' and
|
||||
not farm_target.startswith('crop') and
|
||||
farm_target not in ('wood', 'logs', 'wart'))):
|
||||
farm_target not in ('wood', 'logs', 'wart', 'sand'))):
|
||||
reply = 'not migrated to Minecraft 26.3 yet'
|
||||
print('Reply:', reply)
|
||||
self._send_reply(reply, private, reply_target)
|
||||
@@ -462,9 +475,8 @@ class Commands:
|
||||
if data == 'wood':
|
||||
self.g.job.state = self.g.job.gather_wood
|
||||
reply = 'ok'
|
||||
elif data == 'sand':
|
||||
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)
|
||||
elif data.lower().strip() == 'sand':
|
||||
self._prepare_sand_origin()
|
||||
self.g.job.state = self.g.job.gather_sand
|
||||
reply = 'ok'
|
||||
|
||||
@@ -484,9 +496,8 @@ class Commands:
|
||||
if farm_target in ('wood', 'logs'):
|
||||
self.g.job.state = self.g.job.farm_wood
|
||||
reply = 'ok'
|
||||
elif data == 'sand':
|
||||
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)
|
||||
elif farm_target == 'sand':
|
||||
self._prepare_sand_origin()
|
||||
self.g.job.state = self.g.job.farm_sand
|
||||
reply = 'ok'
|
||||
elif farm_target == 'wart':
|
||||
|
||||
Reference in new issue
Block a user