Consolidate bot runtime on Minecraft 26.3
This commit is contained in:
+22
-16
@@ -10,7 +10,6 @@ from mosfet.protocol.types import Slot
|
||||
from mosfet import print_help
|
||||
from mosfet import utils
|
||||
from mosfet import path
|
||||
from mosfet import bot
|
||||
from mosfet.info import blocks
|
||||
from mosfet.info import items
|
||||
from mosfet.info import mobs
|
||||
@@ -56,6 +55,20 @@ class Commands:
|
||||
if data.startswith('[') and data.endswith(']'):
|
||||
command = 'nosquarebrackets'
|
||||
|
||||
unsupported = {
|
||||
'gather', 'loiter', 'trade', 'gapple', 'cache', 'fill',
|
||||
'drop', 'dump', 'drain', 'break', 'open', 'click', 'use',
|
||||
'interact', 'respawn',
|
||||
}
|
||||
if (command in unsupported or
|
||||
(command == 'farm' and not data.lower().startswith('crop'))):
|
||||
reply = 'not migrated to Minecraft 26.3 yet'
|
||||
print('Reply:', reply)
|
||||
if private:
|
||||
self.g.chat.send('/r ' + reply)
|
||||
else:
|
||||
self.g.chat.send(reply)
|
||||
return
|
||||
|
||||
try:
|
||||
|
||||
@@ -406,15 +419,12 @@ class Commands:
|
||||
self.g.job.state = self.g.job.farm_wart
|
||||
reply = 'ok'
|
||||
elif data.startswith('crop'):
|
||||
self.g.job.state = self.g.job.farm_crop
|
||||
reply = 'ok'
|
||||
|
||||
if reply and self.g.dimension == 'overworld':
|
||||
for i in self.g.inv.values():
|
||||
if i.item_id in items.BED_IDS:
|
||||
break
|
||||
mode = self.g.get('game_mode')
|
||||
if mode is not None and mode != 0:
|
||||
reply = 'crop farming needs Survival mode'
|
||||
else:
|
||||
reply += ', I need a bed'
|
||||
self.g.job.state = self.g.job.farm_crop
|
||||
reply = 'ok'
|
||||
|
||||
## 1loiter - stands still but eats, sleeps, and flees
|
||||
if command == 'loiter':
|
||||
@@ -428,8 +438,8 @@ class Commands:
|
||||
|
||||
## 1stop - stops the current job and resets bot
|
||||
if command == 'stop':
|
||||
self.g.job.stop()
|
||||
self.g.game.close_window()
|
||||
bot.init(self.g)
|
||||
reply = 'ok'
|
||||
|
||||
## 1drop - drops the current stack its holding
|
||||
@@ -515,14 +525,12 @@ class Commands:
|
||||
navpath = self.g.world.path_to_place(pos, goal)
|
||||
|
||||
if navpath:
|
||||
self.g.path = navpath
|
||||
if self.g.job:
|
||||
self.g.job.stop()
|
||||
self.g.path = navpath
|
||||
print(len(navpath))
|
||||
print(navpath)
|
||||
print(round(time.time() - start, 3), 'seconds')
|
||||
if self.g.job:
|
||||
self.g.job.stop()
|
||||
self.g.look_at = None
|
||||
reply = 'ok'
|
||||
else:
|
||||
@@ -543,14 +551,12 @@ class Commands:
|
||||
navpath = self.g.world.path_to_place(pos, goal)
|
||||
|
||||
if navpath:
|
||||
self.g.path = navpath
|
||||
if self.g.job:
|
||||
self.g.job.stop()
|
||||
self.g.path = navpath
|
||||
print(len(navpath))
|
||||
print(navpath)
|
||||
print(round(time.time() - start, 3), 'seconds')
|
||||
if self.g.job:
|
||||
self.g.job.stop()
|
||||
self.g.look_at = None
|
||||
reply = 'ok'
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user