mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-11-22 02:08:56 +01:00
Remove debugging print statement and make send static
This commit is contained in:
parent
0fc8c3bbfe
commit
3c594a1386
@ -316,4 +316,4 @@ class EntityLookPacket(Packet):
|
|||||||
{'yaw': Angle},
|
{'yaw': Angle},
|
||||||
{'pitch': Angle},
|
{'pitch': Angle},
|
||||||
{'on_ground': Boolean}
|
{'on_ground': Boolean}
|
||||||
]
|
]
|
||||||
|
@ -124,6 +124,7 @@ class Angle(Type):
|
|||||||
# Linearly transform angle in steps of 1/256 into steps of 1/360
|
# Linearly transform angle in steps of 1/256 into steps of 1/360
|
||||||
return 360 * UnsignedByte.read(file_object) / 255
|
return 360 * UnsignedByte.read(file_object) / 255
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def send(value, socket):
|
def send(value, socket):
|
||||||
# Normalize angle between 0 and 255 and convert to int.
|
# Normalize angle between 0 and 255 and convert to int.
|
||||||
UnsignedByte.send(int(255 * (value / 360)), socket)
|
UnsignedByte.send(int(255 * (value / 360)), socket)
|
||||||
@ -323,4 +324,3 @@ class Position(Type, Vector):
|
|||||||
if context.protocol_version >= 443 else
|
if context.protocol_version >= 443 else
|
||||||
(x & 0x3FFFFFF) << 38 | (y & 0xFFF) << 26 | (z & 0x3FFFFFF))
|
(x & 0x3FFFFFF) << 38 | (y & 0xFFF) << 26 | (z & 0x3FFFFFF))
|
||||||
UnsignedLong.send(value, socket)
|
UnsignedLong.send(value, socket)
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ class SerializationTest(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
test_data, deserialized, delta=1.0/32.0)
|
test_data, deserialized, delta=1.0/32.0)
|
||||||
elif data_type is Angle:
|
elif data_type is Angle:
|
||||||
print(test_data - deserialized)
|
|
||||||
self.assertAlmostEqual(test_data, deserialized, delta=360/255)
|
self.assertAlmostEqual(test_data, deserialized, delta=360/255)
|
||||||
elif data_type is Float or data_type is Double:
|
elif data_type is Float or data_type is Double:
|
||||||
self.assertAlmostEquals(test_data, deserialized, 3)
|
self.assertAlmostEquals(test_data, deserialized, 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user