def read(self, file_object): self.entity_id = VarInt.read(file_object) if self._context.protocol_version >= 49: self.objectUUID = UUID.read(file_object) type_id = Byte.read(file_object) self.type = SpawnObjectPacket.EntityType.get_type_by_id(type_id) if self._context.protocol_version >= 100: self.x = Double.read(file_object) self.y = Double.read(file_object) self.z = Double.read(file_object) else: self.x = Integer.read(file_object) self.y = Integer.read(file_object) self.z = Integer.read(file_object) self.pitch = UnsignedByte.read(file_object) self.yaw = UnsignedByte.read(file_object) self.data = Integer.read(file_object) if self._context.protocol_version < 49: if self.data > 0: self.velocity_x = Short.read(file_object) self.velocity_y = Short.read(file_object) self.velocity_z = Short.read(file_object) else: self.velocity_x = Short.read(file_object) self.velocity_y = Short.read(file_object) self.velocity_z = Short.read(file_object)
def read(self, file_object): self.entity_id = VarInt.read(file_object) if self.context.protocol_version >= 49: self.object_uuid = UUID.read(file_object) self.type_id = Byte.read(file_object) xyz_type = Double if self.context.protocol_version >= 100 else Integer for attr in 'x', 'y', 'z': setattr(self, attr, xyz_type.read(file_object)) for attr in 'pitch', 'yaw': setattr(self, attr, UnsignedByte.read(file_object)) self.data = Integer.read(file_object) if self.context.protocol_version >= 49 or self.data > 0: for attr in 'velocity_x', 'velocity_y', 'velocity_z': setattr(self, attr, Short.read(file_object))
def read(self, file_object): self.entity_id = VarInt.read(file_object) if self.context.protocol_version >= 49: self.object_uuid = UUID.read(file_object) if self.context.protocol_version >= 458: self.type_id = VarInt.read(file_object) else: self.type_id = Byte.read(file_object) xyz_type = Double if self.context.protocol_version >= 100 else Integer for attr in 'x', 'y', 'z': setattr(self, attr, xyz_type.read(file_object)) for attr in 'pitch', 'yaw': setattr(self, attr, UnsignedByte.read(file_object)) self.data = Integer.read(file_object) if self.context.protocol_version >= 49 or self.data > 0: for attr in 'velocity_x', 'velocity_y', 'velocity_z': setattr(self, attr, Short.read(file_object))
def read(self, file_object): self.entity_id = VarInt.read(file_object) if self.context.protocol_later_eq(49): self.object_uuid = UUID.read(file_object) if self.context.protocol_later_eq(458): self.type_id = VarInt.read(file_object) else: self.type_id = Byte.read(file_object) xyz_type = Double if self.context.protocol_later_eq(100) else Integer for attr in "x", "y", "z": setattr(self, attr, xyz_type.read(file_object)) for attr in "pitch", "yaw": setattr(self, attr, Angle.read(file_object)) self.data = Integer.read(file_object) if self.context.protocol_later_eq(49) or self.data > 0: for attr in "velocity_x", "velocity_y", "velocity_z": setattr(self, attr, Short.read(file_object))
def read(self, file_object): self.uuid = UUID.read(file_object) self._read(file_object)
def read(self, file_object): self.uuid = UUID.read(file_object) self._read(file_object)