add Update Health Packet (client bound)

This commit is contained in:
TheSnoozer 2017-07-31 11:21:46 +02:00 committed by joo
parent 6f52ceac0d
commit 0dc333237b
1 changed files with 17 additions and 0 deletions

View File

@ -761,6 +761,22 @@ class ClientEntityVelocity(Packet):
{'velocity_z': Short}
])
class ClientUpdateHealth(Packet):
@staticmethod
def get_id(context):
return 0x40 if context.protocol_version >= 318 else \
0x3E if context.protocol_version >= 86 else \
0x3F if context.protocol_version >= 77 else \
0x3E if context.protocol_version >= 67 else \
0x06
packet_name = 'update health'
get_definition = staticmethod(lambda context: [
{'health': Float},
{'food': VarInt},
{'food_saturation': Float}
])
def state_playing_clientbound(context):
packets = {
KeepAlivePacketClientbound,
@ -772,6 +788,7 @@ def state_playing_clientbound(context):
DisconnectPacketPlayState,
ClientSpawnPlayer,
ClientEntityVelocity,
ClientUpdateHealth,
}
if context.protocol_version <= 47:
packets |= {