Support for v1.16.2

This commit is contained in:
Sillyfrog 2020-08-13 22:19:04 +10:00
parent 3dcefae645
commit 8a098b399b
9 changed files with 31 additions and 14 deletions

View File

@ -249,6 +249,7 @@ SUPPORTED_MINECRAFT_VERSIONS = {
'1.16 Release Candidate 1':734,
'1.16': 735,
'1.16.1': 736,
'1.16.2': 751,
}
# Those Minecraft versions supported by pyCraft which are "release" versions,

View File

@ -64,7 +64,8 @@ def get_packets(context):
class KeepAlivePacket(AbstractKeepAlivePacket):
@staticmethod
def get_id(context):
return 0x20 if context.protocol_version >= 722 else \
return 0x1F if context.protocol_version >= 751 else \
0x20 if context.protocol_version >= 722 else \
0x21 if context.protocol_version >= 550 else \
0x20 if context.protocol_version >= 471 else \
0x21 if context.protocol_version >= 389 else \
@ -78,7 +79,8 @@ class KeepAlivePacket(AbstractKeepAlivePacket):
class JoinGamePacket(Packet):
@staticmethod
def get_id(context):
return 0x25 if context.protocol_version >= 722 else \
return 0x24 if context.protocol_version >= 751 else \
0x25 if context.protocol_version >= 722 else \
0x26 if context.protocol_version >= 550 else \
0x25 if context.protocol_version >= 389 else \
0x24 if context.protocol_version >= 345 else \
@ -90,7 +92,9 @@ class JoinGamePacket(Packet):
packet_name = "join game"
get_definition = staticmethod(lambda context: [
{'entity_id': Integer},
{'is_hardcore': Boolean} if context.protocol_version >= 751 else {},
{'game_mode': UnsignedByte},
{'previous_game_mode': UnsignedByte} if context.protocol_version >= 722 else {},
{'dimension': Integer if context.protocol_version >= 108 else Byte},
{'hashed_seed': Long} if context.protocol_version >= 552 else {},
{'difficulty': UnsignedByte} if context.protocol_version < 464 else {},
@ -154,7 +158,8 @@ class ChatMessagePacket(Packet):
class DisconnectPacket(Packet):
@staticmethod
def get_id(context):
return 0x1A if context.protocol_version >= 722 else \
return 0x19 if context.protocol_version >= 751 else \
0x1A if context.protocol_version >= 722 else \
0x1B if context.protocol_version >= 550 else \
0x1A if context.protocol_version >= 471 else \
0x1B if context.protocol_version >= 345 else \
@ -244,7 +249,8 @@ class EntityVelocityPacket(Packet):
class EntityPositionDeltaPacket(Packet):
@staticmethod
def get_id(context):
return 0x28 if context.protocol_version >= 722 else \
return 0x27 if context.protocol_version >= 751 else \
0x28 if context.protocol_version >= 722 else \
0x29 if context.protocol_version >= 578 else \
0xFF
@ -302,7 +308,8 @@ class UpdateHealthPacket(Packet):
class RespawnPacket(Packet):
@staticmethod
def get_id(context):
return 0x3A if context.protocol_version >= 722 else \
return 0x39 if context.protocol_version >= 751 else \
0x3A if context.protocol_version >= 722 else \
0x3B if context.protocol_version >= 550 else \
0x3A if context.protocol_version >= 471 else \
0x38 if context.protocol_version >= 461 else \
@ -337,7 +344,8 @@ class RespawnPacket(Packet):
class PluginMessagePacket(AbstractPluginMessagePacket):
@staticmethod
def get_id(context):
return 0x18 if context.protocol_version >= 722 else \
return 0x17 if context.protocol_version >= 751 else \
0x18 if context.protocol_version >= 722 else \
0x19 if context.protocol_version >= 550 else \
0x18 if context.protocol_version >= 471 else \
0x19 if context.protocol_version >= 345 else \
@ -372,7 +380,8 @@ class PlayerListHeaderAndFooterPacket(Packet):
class EntityLookPacket(Packet):
@staticmethod
def get_id(context):
return 0x2A if context.protocol_version >= 722 else \
return 0x29 if context.protocol_version >= 751 else \
0x2A if context.protocol_version >= 722 else \
0x2B if context.protocol_version >= 550 else \
0x2A if context.protocol_version >= 389 else \
0x29 if context.protocol_version >= 345 else \

View File

@ -47,7 +47,8 @@ class BlockChangePacket(Packet):
class MultiBlockChangePacket(Packet):
@staticmethod
def get_id(context):
return 0x0F if context.protocol_version >= 722 else \
return 0x3B if context.protocol_version >= 751 else \
0x0F if context.protocol_version >= 722 else \
0x10 if context.protocol_version >= 550 else \
0x0F if context.protocol_version >= 343 else \
0x10 if context.protocol_version >= 332 else \

View File

@ -8,7 +8,8 @@ from minecraft.networking.types import (
class CombatEventPacket(Packet):
@staticmethod
def get_id(context):
return 0x32 if context.protocol_version >= 722 else \
return 0x31 if context.protocol_version >= 751 else \
0x32 if context.protocol_version >= 722 else \
0x33 if context.protocol_version >= 550 else \
0x32 if context.protocol_version >= 471 else \
0x30 if context.protocol_version >= 451 else \

View File

@ -7,7 +7,8 @@ from minecraft.networking.packets import Packet
class ExplosionPacket(Packet):
@staticmethod
def get_id(context):
return 0x1C if context.protocol_version >= 722 else \
return 0x1B if context.protocol_version >= 751 else \
0x1C if context.protocol_version >= 722 else \
0x1D if context.protocol_version >= 550 else \
0x1C if context.protocol_version >= 471 else \
0x1E if context.protocol_version >= 389 else \

View File

@ -8,7 +8,8 @@ from minecraft.networking.packets import Packet
class FacePlayerPacket(Packet):
@staticmethod
def get_id(context):
return 0x34 if context.protocol_version >= 722 else \
return 0x33 if context.protocol_version >= 751 else \
0x34 if context.protocol_version >= 722 else \
0x35 if context.protocol_version >= 550 else \
0x34 if context.protocol_version >= 471 else \
0x32 if context.protocol_version >= 451 else \

View File

@ -8,7 +8,8 @@ from minecraft.networking.types import (
class MapPacket(Packet):
@staticmethod
def get_id(context):
return 0x26 if context.protocol_version >= 722 else \
return 0x25 if context.protocol_version >= 751 else \
0x26 if context.protocol_version >= 722 else \
0x27 if context.protocol_version >= 550 else \
0x26 if context.protocol_version >= 389 else \
0x25 if context.protocol_version >= 345 else \

View File

@ -9,7 +9,8 @@ from minecraft.networking.types import (
class PlayerListItemPacket(Packet):
@staticmethod
def get_id(context):
return 0x33 if context.protocol_version >= 722 else \
return 0x32 if context.protocol_version >= 751 else \
0x33 if context.protocol_version >= 722 else \
0x34 if context.protocol_version >= 550 else \
0x33 if context.protocol_version >= 471 else \
0x31 if context.protocol_version >= 451 else \

View File

@ -9,7 +9,8 @@ from minecraft.networking.types import (
class PlayerPositionAndLookPacket(Packet, BitFieldEnum):
@staticmethod
def get_id(context):
return 0x35 if context.protocol_version >= 722 else \
return 0x34 if context.protocol_version >= 751 else \
0x35 if context.protocol_version >= 722 else \
0x36 if context.protocol_version >= 550 else \
0x35 if context.protocol_version >= 471 else \
0x33 if context.protocol_version >= 451 else \