only include non-None fields when making packets
There is no 'null' type in MC proto, so a None means that said attr was not set
This commit is contained in:
parent
0216be7c4d
commit
8f92743454
1 changed files with 2 additions and 1 deletions
|
@ -23,7 +23,8 @@ class Packet:
|
||||||
self.definition = self._definitions[proto]
|
self.definition = self._definitions[proto]
|
||||||
self.id = self._ids[proto]
|
self.id = self._ids[proto]
|
||||||
for name, t in self.definition:
|
for name, t in self.definition:
|
||||||
setattr(self, name, t.pytype(kwargs[name]) if name in kwargs else None)
|
if name in kwargs and kwargs[name] is not None:
|
||||||
|
setattr(self, name, t.pytype(kwargs[name]))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def processed(self) -> Event:
|
def processed(self) -> Event:
|
||||||
|
|
Loading…
Reference in a new issue