Remove debugging print statement and make send static

This commit is contained in:
Zachy 2019-05-15 13:59:23 +01:00
parent 0fc8c3bbfe
commit 3c594a1386
3 changed files with 2 additions and 3 deletions

View File

@ -316,4 +316,4 @@ class EntityLookPacket(Packet):
{'yaw': Angle},
{'pitch': Angle},
{'on_ground': Boolean}
]
]

View File

@ -124,6 +124,7 @@ class Angle(Type):
# Linearly transform angle in steps of 1/256 into steps of 1/360
return 360 * UnsignedByte.read(file_object) / 255
@staticmethod
def send(value, socket):
# Normalize angle between 0 and 255 and convert to int.
UnsignedByte.send(int(255 * (value / 360)), socket)
@ -323,4 +324,3 @@ class Position(Type, Vector):
if context.protocol_version >= 443 else
(x & 0x3FFFFFF) << 38 | (y & 0xFFF) << 26 | (z & 0x3FFFFFF))
UnsignedLong.send(value, socket)

View File

@ -60,7 +60,6 @@ class SerializationTest(unittest.TestCase):
self.assertAlmostEqual(
test_data, deserialized, delta=1.0/32.0)
elif data_type is Angle:
print(test_data - deserialized)
self.assertAlmostEqual(test_data, deserialized, delta=360/255)
elif data_type is Float or data_type is Double:
self.assertAlmostEquals(test_data, deserialized, 3)