Add living entity packets

This commit is contained in:
2020-09-23 15:36:18 -06:00
parent 43f4eb3517
commit 0e616dc7c1
4 changed files with 94 additions and 10 deletions
+55
View File
@@ -307,3 +307,58 @@ class EntityMetadataPacket(Packet):
entry = Entry.read(file_object)
if not entry: break
self.metadata.append(entry)
class SpawnLivingEntityPacket(Packet):
# Sent by the server when a living entity is spawned
# https://wiki.vg/Protocol#Spawn_Entity
id = 0x02
packet_name = 'spawn living entity'
definition = [
{'entity_id': VarInt},
{'entity_uuid': UUID},
{'type': VarInt},
{'x': Double},
{'y': Double},
{'z': Double},
{'yaw': Angle},
{'pitch': Angle},
{'head_pitch': Angle},
{'x_velocity': Short},
{'y_velocity': Short},
{'z_velocity': Short},
]
class EntityPositionPacket(Packet):
# Sent by the server when an entity moves less then 8 blocks
# https://wiki.vg/Protocol#Spawn_Entity
id = 0x27
packet_name = 'entity position'
definition = [
{'entity_id': VarInt},
{'delta_x': Short},
{'delta_y': Short},
{'delta_z': Short},
{'on_ground': Boolean},
]
class EntityPositionRotationPacket(Packet):
# Sent by the server when an entity rotates and moves
# https://wiki.vg/Protocol#Entity_Position_and_Rotation
id = 0x28
packet_name = 'entity position and rotation'
definition = [
{'entity_id': VarInt},
{'delta_x': Short},
{'delta_y': Short},
{'delta_z': Short},
{'yaw': Angle},
{'pitch': Angle},
{'on_ground': Boolean},
]