Support for v1.16.2

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

No files matched your search

+1
View File
@@ -249,6 +249,7 @@ SUPPORTED_MINECRAFT_VERSIONS = {
'1.16 Release Candidate 1':734, '1.16 Release Candidate 1':734,
'1.16': 735, '1.16': 735,
'1.16.1': 736, '1.16.1': 736,
'1.16.2': 751,
} }
# Those Minecraft versions supported by pyCraft which are "release" versions, # Those Minecraft versions supported by pyCraft which are "release" versions,
@@ -64,7 +64,8 @@ def get_packets(context):
class KeepAlivePacket(AbstractKeepAlivePacket): class KeepAlivePacket(AbstractKeepAlivePacket):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x21 if context.protocol_version >= 550 else \
0x20 if context.protocol_version >= 471 else \ 0x20 if context.protocol_version >= 471 else \
0x21 if context.protocol_version >= 389 else \ 0x21 if context.protocol_version >= 389 else \
@@ -78,7 +79,8 @@ class KeepAlivePacket(AbstractKeepAlivePacket):
class JoinGamePacket(Packet): class JoinGamePacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x26 if context.protocol_version >= 550 else \
0x25 if context.protocol_version >= 389 else \ 0x25 if context.protocol_version >= 389 else \
0x24 if context.protocol_version >= 345 else \ 0x24 if context.protocol_version >= 345 else \
@@ -90,7 +92,9 @@ class JoinGamePacket(Packet):
packet_name = "join game" packet_name = "join game"
get_definition = staticmethod(lambda context: [ get_definition = staticmethod(lambda context: [
{'entity_id': Integer}, {'entity_id': Integer},
{'is_hardcore': Boolean} if context.protocol_version >= 751 else {},
{'game_mode': UnsignedByte}, {'game_mode': UnsignedByte},
{'previous_game_mode': UnsignedByte} if context.protocol_version >= 722 else {},
{'dimension': Integer if context.protocol_version >= 108 else Byte}, {'dimension': Integer if context.protocol_version >= 108 else Byte},
{'hashed_seed': Long} if context.protocol_version >= 552 else {}, {'hashed_seed': Long} if context.protocol_version >= 552 else {},
{'difficulty': UnsignedByte} if context.protocol_version < 464 else {}, {'difficulty': UnsignedByte} if context.protocol_version < 464 else {},
@@ -154,7 +158,8 @@ class ChatMessagePacket(Packet):
class DisconnectPacket(Packet): class DisconnectPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x1B if context.protocol_version >= 550 else \
0x1A if context.protocol_version >= 471 else \ 0x1A if context.protocol_version >= 471 else \
0x1B if context.protocol_version >= 345 else \ 0x1B if context.protocol_version >= 345 else \
@@ -244,7 +249,8 @@ class EntityVelocityPacket(Packet):
class EntityPositionDeltaPacket(Packet): class EntityPositionDeltaPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x29 if context.protocol_version >= 578 else \
0xFF 0xFF
@@ -302,7 +308,8 @@ class UpdateHealthPacket(Packet):
class RespawnPacket(Packet): class RespawnPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x3B if context.protocol_version >= 550 else \
0x3A if context.protocol_version >= 471 else \ 0x3A if context.protocol_version >= 471 else \
0x38 if context.protocol_version >= 461 else \ 0x38 if context.protocol_version >= 461 else \
@@ -337,7 +344,8 @@ class RespawnPacket(Packet):
class PluginMessagePacket(AbstractPluginMessagePacket): class PluginMessagePacket(AbstractPluginMessagePacket):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x19 if context.protocol_version >= 550 else \
0x18 if context.protocol_version >= 471 else \ 0x18 if context.protocol_version >= 471 else \
0x19 if context.protocol_version >= 345 else \ 0x19 if context.protocol_version >= 345 else \
@@ -372,7 +380,8 @@ class PlayerListHeaderAndFooterPacket(Packet):
class EntityLookPacket(Packet): class EntityLookPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x2B if context.protocol_version >= 550 else \
0x2A if context.protocol_version >= 389 else \ 0x2A if context.protocol_version >= 389 else \
0x29 if context.protocol_version >= 345 else \ 0x29 if context.protocol_version >= 345 else \
@@ -47,7 +47,8 @@ class BlockChangePacket(Packet):
class MultiBlockChangePacket(Packet): class MultiBlockChangePacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x10 if context.protocol_version >= 550 else \
0x0F if context.protocol_version >= 343 else \ 0x0F if context.protocol_version >= 343 else \
0x10 if context.protocol_version >= 332 else \ 0x10 if context.protocol_version >= 332 else \
@@ -8,7 +8,8 @@ from minecraft.networking.types import (
class CombatEventPacket(Packet): class CombatEventPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x33 if context.protocol_version >= 550 else \
0x32 if context.protocol_version >= 471 else \ 0x32 if context.protocol_version >= 471 else \
0x30 if context.protocol_version >= 451 else \ 0x30 if context.protocol_version >= 451 else \
@@ -7,7 +7,8 @@ from minecraft.networking.packets import Packet
class ExplosionPacket(Packet): class ExplosionPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x1D if context.protocol_version >= 550 else \
0x1C if context.protocol_version >= 471 else \ 0x1C if context.protocol_version >= 471 else \
0x1E if context.protocol_version >= 389 else \ 0x1E if context.protocol_version >= 389 else \
@@ -8,7 +8,8 @@ from minecraft.networking.packets import Packet
class FacePlayerPacket(Packet): class FacePlayerPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x35 if context.protocol_version >= 550 else \
0x34 if context.protocol_version >= 471 else \ 0x34 if context.protocol_version >= 471 else \
0x32 if context.protocol_version >= 451 else \ 0x32 if context.protocol_version >= 451 else \
@@ -8,7 +8,8 @@ from minecraft.networking.types import (
class MapPacket(Packet): class MapPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x27 if context.protocol_version >= 550 else \
0x26 if context.protocol_version >= 389 else \ 0x26 if context.protocol_version >= 389 else \
0x25 if context.protocol_version >= 345 else \ 0x25 if context.protocol_version >= 345 else \
@@ -9,7 +9,8 @@ from minecraft.networking.types import (
class PlayerListItemPacket(Packet): class PlayerListItemPacket(Packet):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x34 if context.protocol_version >= 550 else \
0x33 if context.protocol_version >= 471 else \ 0x33 if context.protocol_version >= 471 else \
0x31 if context.protocol_version >= 451 else \ 0x31 if context.protocol_version >= 451 else \
@@ -9,7 +9,8 @@ from minecraft.networking.types import (
class PlayerPositionAndLookPacket(Packet, BitFieldEnum): class PlayerPositionAndLookPacket(Packet, BitFieldEnum):
@staticmethod @staticmethod
def get_id(context): 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 \ 0x36 if context.protocol_version >= 550 else \
0x35 if context.protocol_version >= 471 else \ 0x35 if context.protocol_version >= 471 else \
0x33 if context.protocol_version >= 451 else \ 0x33 if context.protocol_version >= 451 else \