don't try to serialize optional fields
This commit is contained in:
parent
d1d1eb5ca1
commit
5cc4c8d844
1 changed files with 2 additions and 1 deletions
|
@ -38,6 +38,7 @@ class Packet:
|
|||
buf = io.BytesIO()
|
||||
VarInt.write(self.id, buf)
|
||||
for name, t in self.definition:
|
||||
if getattr(self, name, None) is not None: # minecraft proto has no null type: this is an optional field left unset
|
||||
t.write(getattr(self, name, None), buf)
|
||||
buf.seek(0)
|
||||
return buf
|
||||
|
|
Loading…
Reference in a new issue