From 6aea7b36c16452dd1335292438af14fd81c5bb72 Mon Sep 17 00:00:00 2001 From: joo Date: Sat, 5 Sep 2015 08:32:27 +0100 Subject: [PATCH] Implement network-encoded UUID type. --- minecraft/networking/types.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/minecraft/networking/types.py b/minecraft/networking/types.py index 8ce00db..3294179 100644 --- a/minecraft/networking/types.py +++ b/minecraft/networking/types.py @@ -3,6 +3,7 @@ Each type has a method which is used to read and write it. These definitions and methods are used by the packet definitions """ import struct +import uuid class Type(object): @@ -201,3 +202,8 @@ class String(Type): value = value.encode('utf-8') VarInt.send(len(value), socket) socket.send(value) + +class UUID(Type): + @staticmethod + def read(file_object): + return str(uuid.UUID(bytes=file_object.read(16)))