Reset the bot on death
This commit is contained in:
parent
433e35e79b
commit
221d497204
|
@ -377,8 +377,8 @@ class Game:
|
|||
self.g.name = packet.Username
|
||||
|
||||
def handle_join_game(self, packet):
|
||||
print('Received join game packet')
|
||||
print('Connected.')
|
||||
print(packet)
|
||||
self.g.info = packet
|
||||
self.g.eid = packet.entity_id
|
||||
self.g.dimension = packet.world_name.replace('minecraft:', '')
|
||||
|
@ -947,8 +947,8 @@ class Game:
|
|||
elif g.window:
|
||||
g.window.contents[packet.slot] = packet.slot_data
|
||||
|
||||
if packet.window_id >= 0 and not packet.slot_data.present:
|
||||
print('unlocking item lock')
|
||||
if g.item_lock and packet.window_id >= 0 and not packet.slot_data.present:
|
||||
print('Unlocking item lock')
|
||||
g.item_lock = False
|
||||
|
||||
def break_block(self, location):
|
||||
|
@ -1301,6 +1301,12 @@ class Game:
|
|||
self.g.health = packet.health
|
||||
self.g.food = packet.food
|
||||
|
||||
if packet.health == 0:
|
||||
print('Died, stopping')
|
||||
print('Use 1respawn to respawn the bot')
|
||||
self.close_window()
|
||||
bot.init(self.g)
|
||||
|
||||
def use_item(self, hand):
|
||||
packet = serverbound.play.UseItemPacket()
|
||||
packet.hand = hand
|
||||
|
|
Loading…
Reference in New Issue
Block a user