add ClientSpawnPlayer packet
This commit is contained in:
1 parent
42ede3f83d
commit
9caff502ca
1 file changed
+19
-1
@@ -3,7 +3,7 @@ from zlib import compress
|
|||||||
|
|
||||||
from .types import (
|
from .types import (
|
||||||
VarInt, Integer, Float, Double, UnsignedShort, Long, Byte, UnsignedByte,
|
VarInt, Integer, Float, Double, UnsignedShort, Long, Byte, UnsignedByte,
|
||||||
String, VarIntPrefixedByteArray, Boolean, UUID
|
String, VarIntPrefixedByteArray, Boolean, UUID, Short
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -726,6 +726,23 @@ class MapPacket(Packet):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.__repr__()
|
return self.__repr__()
|
||||||
|
|
||||||
|
class ClientSpawnPlayer(Packet):
|
||||||
|
@staticmethod
|
||||||
|
def get_id(context):
|
||||||
|
return 0x05 if context.protocol_version >= 67 else \
|
||||||
|
0x0C
|
||||||
|
|
||||||
|
packet_name = 'spawn player'
|
||||||
|
get_definition = staticmethod(lambda context: [
|
||||||
|
{'entity_id': VarInt},
|
||||||
|
{'player_UUID': UUID},
|
||||||
|
{'x': Double} if context.protocol_version >= 100 else {'x': Integer},
|
||||||
|
{'y': Double} if context.protocol_version >= 100 else {'y': Integer},
|
||||||
|
{'z': Double} if context.protocol_version >= 100 else {'z': Integer},
|
||||||
|
{'yaw': Float},
|
||||||
|
{'pitch': Float},
|
||||||
|
{'current_item': Short} if context.protocol_version <= 49 else {}
|
||||||
|
])
|
||||||
|
|
||||||
def state_playing_clientbound(context):
|
def state_playing_clientbound(context):
|
||||||
packets = {
|
packets = {
|
||||||
@@ -736,6 +753,7 @@ def state_playing_clientbound(context):
|
|||||||
MapPacket,
|
MapPacket,
|
||||||
PlayerListItemPacket,
|
PlayerListItemPacket,
|
||||||
DisconnectPacketPlayState,
|
DisconnectPacketPlayState,
|
||||||
|
ClientSpawnPlayer,
|
||||||
}
|
}
|
||||||
if context.protocol_version <= 47:
|
if context.protocol_version <= 47:
|
||||||
packets |= {
|
packets |= {
|
||||||
|
|||||||
Reference in new issue
Block a user