From 8f9274345410bcc4ffde7976e0e4feb352e6e00d Mon Sep 17 00:00:00 2001 From: alemidev Date: Fri, 14 Jan 2022 16:22:38 +0100 Subject: [PATCH] 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 --- aiocraft/mc/packet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aiocraft/mc/packet.py b/aiocraft/mc/packet.py index 5de2a2d..10aeeed 100644 --- a/aiocraft/mc/packet.py +++ b/aiocraft/mc/packet.py @@ -23,7 +23,8 @@ class Packet: self.definition = self._definitions[proto] self.id = self._ids[proto] 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 def processed(self) -> Event: