Add a job to find enchanted golden apples

This commit is contained in:
2020-09-25 00:03:22 -06:00
parent b723143299
commit 25ce916b43
10 changed files with 163 additions and 11 deletions
+5 -3
View File
@@ -133,7 +133,7 @@ class Slot(Type):
Boolean.send(value.present, socket)
VarInt.send(value.item_id, socket)
Byte.send(value.item_count, socket)
TrailingByteArray.send(value.nbt, socket)
Byte.send(0x00, socket)
class Entry(Type):
@@ -157,16 +157,18 @@ class Entry(Type):
def __str__(self):
return str(self.__dict__)
def __repr__(self):
return 'Entry(index={}, type={}, value={}'.format(
return 'Entry(index={}, type={}, value={})'.format(
self.index, self.type, self.value)
@staticmethod
def read(file_object):
def read(file_object, context):
index = UnsignedByte.read(file_object)
if index == 0xff: return None
type = VarInt.read(file_object)
try:
value = Entry.types[type].read(file_object)
except TypeError:
value = Entry.types[type].read_with_context(file_object, context)
except KeyError:
return None
return Entry(index, type, value)