Add living entity packets
This commit is contained in:
+10
-7
@@ -40,10 +40,9 @@ class Nbt(Type):
|
||||
@staticmethod
|
||||
def read(file_object):
|
||||
type_id = Byte.read(file_object)
|
||||
if type_id == TAG_End:
|
||||
return None
|
||||
if type_id != TAG_Compound:
|
||||
raise Exception("Invalid NBT header")
|
||||
#raise Exception("Invalid NBT header")
|
||||
return None
|
||||
name = ShortPrefixedByteArray.read(file_object).decode('utf-8')
|
||||
a = Nbt.decode_tag(file_object, TAG_Compound)
|
||||
a['_name'] = name
|
||||
@@ -119,10 +118,14 @@ class Slot(Type):
|
||||
@staticmethod
|
||||
def read(file_object):
|
||||
present = Boolean.read(file_object)
|
||||
item_id = VarInt.read(file_object) if present else None
|
||||
item_count = Byte.read(file_object) if present else None
|
||||
print('slot read', present, item_id, item_count)
|
||||
nbt = Nbt.read(file_object) if present else None
|
||||
if present:
|
||||
item_id = VarInt.read(file_object)
|
||||
item_count = Byte.read(file_object)
|
||||
nbt = Nbt.read(file_object)
|
||||
else:
|
||||
item_id = None
|
||||
item_count = None
|
||||
nbt = None
|
||||
return Slot(present, item_id, item_count, nbt)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user