Fix more bugs
This commit is contained in:
parent
4b97aaf739
commit
d0bfed75dd
2
game.py
2
game.py
|
@ -759,7 +759,7 @@ class Game:
|
||||||
try:
|
try:
|
||||||
item = self.g.window.contents[slot]
|
item = self.g.window.contents[slot]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
item = Slot(present=False, item_id=None, item_count=None, nbt=None)
|
item = Slot(present=False)
|
||||||
print(item)
|
print(item)
|
||||||
self.click_window(slot, button, mode, item)
|
self.click_window(slot, button, mode, item)
|
||||||
else:
|
else:
|
||||||
|
|
16
jobs.py
16
jobs.py
|
@ -893,7 +893,6 @@ class CacheItemsStates:
|
||||||
self.g.look_at = self.area
|
self.g.look_at = self.area
|
||||||
self.state = self.open_chest
|
self.state = self.open_chest
|
||||||
|
|
||||||
|
|
||||||
def select_chest(self):
|
def select_chest(self):
|
||||||
if self.g.game.select_item([items.CHEST_ID]):
|
if self.g.game.select_item([items.CHEST_ID]):
|
||||||
self.state = self.find_cache_spot
|
self.state = self.find_cache_spot
|
||||||
|
@ -1562,6 +1561,10 @@ class FillBlocksStates:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.last_block = check
|
self.last_block = check
|
||||||
|
else: # for
|
||||||
|
self.state = self.cleanup
|
||||||
|
print('Aborting, no air left')
|
||||||
|
return
|
||||||
|
|
||||||
def select_item(self):
|
def select_item(self):
|
||||||
f = self.g.filling
|
f = self.g.filling
|
||||||
|
@ -1901,12 +1904,13 @@ class JobStates:
|
||||||
self.sleep_with_bed_states.silent = True
|
self.sleep_with_bed_states.silent = True
|
||||||
|
|
||||||
f = self.g.filling
|
f = self.g.filling
|
||||||
name = blocks.BLOCKS[f.block]
|
if f:
|
||||||
item = items.ITEMS['minecraft:'+name]['protocol_id']
|
name = blocks.BLOCKS[f.block]
|
||||||
|
item = items.ITEMS['minecraft:'+name]['protocol_id']
|
||||||
|
|
||||||
self.grab_supplies_states.supplies = {
|
self.grab_supplies_states.supplies = {
|
||||||
tuple([item]): 0,
|
tuple([item]): 0,
|
||||||
}
|
}
|
||||||
return machines
|
return machines
|
||||||
|
|
||||||
def loiter(self):
|
def loiter(self):
|
||||||
|
|
|
@ -103,7 +103,7 @@ class Nbt(Type):
|
||||||
|
|
||||||
|
|
||||||
class Slot(Type):
|
class Slot(Type):
|
||||||
def __init__(self, present, item_id, item_count, nbt):
|
def __init__(self, present, item_id=None, item_count=None, nbt=None):
|
||||||
self.present = present
|
self.present = present
|
||||||
self.item_id = item_id
|
self.item_id = item_id
|
||||||
self.item_count = item_count
|
self.item_count = item_count
|
||||||
|
@ -112,8 +112,11 @@ class Slot(Type):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.__dict__)
|
return str(self.__dict__)
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'Slot(present={}, item_id={}, item_count={}, nbt={}'.format(
|
if self.present:
|
||||||
self.present, self.item_id, self.item_count, self.nbt)
|
return 'Slot(present={}, item_id={}, item_count={}, nbt={}'.format(
|
||||||
|
self.present, self.item_id, self.item_count, self.nbt)
|
||||||
|
else:
|
||||||
|
return 'Slot(present={})'.format(self.present)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(file_object):
|
def read(file_object):
|
||||||
|
@ -131,9 +134,10 @@ class Slot(Type):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def send(value, socket):
|
def send(value, socket):
|
||||||
Boolean.send(value.present, socket)
|
Boolean.send(value.present, socket)
|
||||||
VarInt.send(value.item_id, socket)
|
if value.present:
|
||||||
Byte.send(value.item_count, socket)
|
VarInt.send(value.item_id, socket)
|
||||||
Byte.send(0x00, socket)
|
Byte.send(value.item_count, socket)
|
||||||
|
Byte.send(0x00, socket)
|
||||||
|
|
||||||
|
|
||||||
class Entry(Type):
|
class Entry(Type):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user