Skip to content

Commit

Permalink
Merge pull request #19 from pixeils/master
Browse files Browse the repository at this point in the history
Update to 1.17.1
  • Loading branch information
Fallen-Breath authored Sep 27, 2021
2 parents a31ea18 + ddff866 commit 72c5906
Show file tree
Hide file tree
Showing 14 changed files with 258 additions and 37 deletions.
159 changes: 159 additions & 0 deletions protocol.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,163 @@
{
"756": {
"Clientbound": {
"0": "Spawn Entity",
"1": "Spawn Experience Orb",
"2": "Spawn Living Entity",
"3": "Spawn Painting",
"4": "Spawn Player",
"5": "Sculk Vibration Signal",
"6": "Entity Animation (clientbound)",
"7": "Statistics",
"8": "Acknowledge Player Digging",
"9": "Block Break Animation",
"10": "Block Entity Data",
"11": "Block Action",
"12": "Block Change",
"13": "Boss Bar",
"14": "Server Difficulty",
"15": "Chat Message (clientbound)",
"16": "Clear Titles",
"17": "Tab-Complete (clientbound)",
"18": "Declare Commands",
"19": "Close Window (clientbound)",
"20": "Window Items",
"21": "Window Property",
"22": "Set Slot",
"23": "Set Cooldown",
"24": "Plugin Message (clientbound)",
"25": "Named Sound Effect",
"26": "Disconnect (play)",
"27": "Entity Status",
"28": "Explosion",
"29": "Unload Chunk",
"30": "Change Game State",
"31": "Open Horse Window",
"32": "Initialize World Border",
"33": "Keep Alive (clientbound)",
"34": "Chunk Data",
"35": "Effect",
"36": "Particle",
"37": "Update Light",
"38": "Join Game",
"39": "Map Data",
"40": "Trade List",
"41": "Entity Position",
"42": "Entity Position and Rotation",
"43": "Entity Rotation",
"44": "Vehicle Move (clientbound)",
"45": "Open Book",
"46": "Open Window",
"47": "Open Sign Editor",
"48": "Ping",
"49": "Craft Recipe Response",
"50": "Player Abilities (clientbound)",
"51": "End Combat Event",
"52": "Enter Combat Event",
"53": "Death Combat Event",

"54": "Player Info",
"55": "Face Player",
"56": "Player Position And Look (clientbound)",
"57": "Unlock Recipes",
"58": "Destroy Entities",
"59": "Remove Entity Effect",
"60": "Resource Pack Send",
"61": "Respawn",
"62": "Entity Head Look",
"63": "Multi Block Change",
"64": "Select Advancement Tab",
"65": "Action Bar",
"66": "World Border Center",
"67": "World Border Lerp Size",
"68": "World Border Size",
"69": "World Border Warning Delay",
"70": "World Border Warning Reach",
"71": "Camera",
"72": "Held Item Change (clientbound)",
"73": "Update View Position",
"74": "Update View Distance",
"75": "Spawn Position",
"76": "Display Scoreboard",
"77": "Entity Metadata",
"78": "Attach Entity",
"79": "Entity Velocity",
"80": "Entity Equipment",
"81": "Set Experience",
"82": "Update Health",
"83": "Scoreboard Objective",
"84": "Set Passengers",
"85": "Teams",
"86": "Update Score",
"87": "Set Title SubTitle",
"88": "Time Update",
"89": "Set Title Text",
"90": "Set Title Times",
"91": "Entity Sound Effect",
"92": "Sound Effect",
"93": "Stop Sound",
"94": "Player List Header And Footer",
"95": "NBT Query Response",
"96": "Collect Item",
"97": "Entity Teleport",
"98": "Advancements",
"99": "Entity Properties",
"100": "Entity Effect",
"101": "Declare Recipes",
"102": "Tags"
},
"Serverbound": {
"Teleport Confirm": 0,
"Query Block NBT": 1,
"Set Difficulty": 2,
"Chat Message (serverbound)": 3,
"Client Status": 4,
"Client Settings": 5,
"Tab-Complete (serverbound)": 6,
"Click Window Button": 7,
"Click Window": 8,
"Close Window (serverbound)": 9,
"Plugin Message (serverbound)": 10,
"Edit Book": 11,
"Query Entity NBT": 12,
"Interact Entity": 13,
"Generate Structure": 14,
"Keep Alive (serverbound)": 15,
"Lock Difficulty": 16,
"Player Position": 17,
"Player Position And Rotation (serverbound)": 18,
"Player Rotation": 19,
"Player Movement": 20,
"Vehicle Move (serverbound)": 21,
"Steer Boat": 22,
"Pick Item": 23,
"Craft Recipe Request": 24,
"Player Abilities (serverbound)": 25,
"Player Digging": 26,
"Entity Action": 27,
"Steer Vehicle": 28,
"Pong": 29,
"Set Recipe Book State": 30,
"Set Displayed Recipe": 31,
"Name Item": 32,
"Resource Pack Status": 33,
"Advancement Tab": 34,
"Select Trade": 35,
"Set Beacon Effect": 36,
"Held Item Change (serverbound)": 37,
"Update Command Block": 38,
"Update Command Block Minecart": 39,
"Creative Inventory Action": 40,
"Update Jigsaw Block": 41,
"Update Structure Block": 42,
"Update Sign": 43,
"Animation (serverbound)": 44,
"Spectate": 45,
"Player Block Placement": 46,
"Use Item": 47
}
},

"754": {
"Clientbound": {
"0": "Spawn Entity",
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ PCRC currently supports connecting to vanilla Minecraft server. Supports version
- 1.16.1
- 1.16.2
- 1.16.3

- 1.16.4
- 1.17.1
## Advantage

- Can be hosted server side for 24/7 recording
Expand Down
9 changes: 8 additions & 1 deletion utils/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
MinimumLegalFileSize = 10 * BytePerKB
RecordingFilePath = 'temp_recording/'
RecordingStorageFolder = 'PCRC_recordings/'
ALLOWED_VERSIONS = ['1.12', '1.12.2', '1.14.4', '1.15.2', '1.16.1', '1.16.2', '1.16.3', '1.16.4']
ALLOWED_VERSIONS = ['1.12', '1.12.2', '1.14.4', '1.15.2', '1.16.1', '1.16.2', '1.16.3', '1.16.4', '1.17.1']
Map_VersionToProtocol = pycraft.SUPPORTED_MINECRAFT_VERSIONS
Map_ProtocolToVersion = {}
for item in Map_VersionToProtocol.items():
Expand All @@ -28,6 +28,7 @@
'1.16.2': 35,
'1.16.3': 35,
'1.16.4': 35,
'1.17.1': 41,
}
EntityTypeBat = {
'1.12': 65,
Expand All @@ -38,6 +39,7 @@
'1.16.2': 3,
'1.16.3': 3,
'1.16.4': 3,
'1.17.1': 4,
}
EntityTypePhantom = {
'1.12': -1,
Expand All @@ -48,6 +50,7 @@
'1.16.2': 58,
'1.16.3': 58,
'1.16.4': 58,
'1.17.1': 63,
}

FILE_FORMAT_VERSION_DICT = {
Expand All @@ -59,9 +62,11 @@
'1.16.2': '14',
'1.16.3': '14',
'1.16.4': '14',
'1.17.1': '14',
}



IMPORTANT_PACKETS = [
'Player Info'
]
Expand All @@ -86,7 +91,9 @@
'Camera',
'Player Abilities (clientbound)',
'Title',
'Sculk Vibration Signal',
'unknown'

]

# List of packets that are not neccesary for a normal replay but still get recorded
Expand Down
1 change: 1 addition & 0 deletions utils/pycraft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@
'1.16.4-pre2': 1073741826,
'1.16.4-rc1': 1073741827,
'1.16.4': 754,
'1.17.1': 756,
}

# Those Minecraft versions supported by pyCraft which are "release" versions,
Expand Down
56 changes: 40 additions & 16 deletions utils/pycraft/networking/packets/clientbound/play/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def get_packets(context):
RespawnPacket,
PluginMessagePacket,
PlayerListHeaderAndFooterPacket,
EntityLookPacket
EntityLookPacket,
ResourcePackSendPacket
}
if context.protocol_version <= 47:
packets |= {
Expand All @@ -64,7 +65,8 @@ def get_packets(context):
class KeepAlivePacket(AbstractKeepAlivePacket):
@staticmethod
def get_id(context):
return 0x1F if context.protocol_version >= 741 else \
return 0x21 if context.protocol_version >= 756 else \
0x1F if context.protocol_version >= 741 else \
0x20 if context.protocol_version >= 721 else \
0x21 if context.protocol_version >= 550 else \
0x20 if context.protocol_version >= 471 else \
Expand All @@ -79,7 +81,8 @@ def get_id(context):
class ServerDifficultyPacket(Packet):
@staticmethod
def get_id(context):
return 0x0D if context.protocol_version >= 721 else \
return 0x0E if context.protocol_version >= 756 else \
0x0D if context.protocol_version >= 721 else \
0x0E if context.protocol_version >= 550 else \
0x0D if context.protocol_version >= 332 else \
0x0E if context.protocol_version >= 318 else \
Expand All @@ -99,7 +102,8 @@ def get_id(context):
class ChatMessagePacket(Packet):
@staticmethod
def get_id(context):
return 0x0E if context.protocol_version >= 721 else \
return 0x0F if context.protocol_version >= 756 else \
0x0E if context.protocol_version >= 721 else \
0x0F if context.protocol_version >= 550 else \
0x0E if context.protocol_version >= 343 else \
0x0F if context.protocol_version >= 332 else \
Expand All @@ -123,7 +127,8 @@ class Position(Enum):
class DisconnectPacket(Packet):
@staticmethod
def get_id(context):
return 0x19 if context.protocol_version >= 741 else \
return 0x1A if context.protocol_version >= 756 else \
0x19 if context.protocol_version >= 741 else \
0x1A if context.protocol_version >= 721 else \
0x1B if context.protocol_version >= 550 else \
0x1A if context.protocol_version >= 471 else \
Expand All @@ -141,10 +146,10 @@ def get_id(context):

class SetCompressionPacket(Packet):
# Note: removed between protocol versions 47 and 107.
id = 0x46
packet_name = "set compression"
definition = [
{'threshold': VarInt}]
@staticmethod
def get_id(context):
return 0x03 if context.protocol_version(756) else \
0x46


class SpawnPlayerPacket(Packet):
Expand Down Expand Up @@ -186,7 +191,8 @@ def get_id(context):
class EntityVelocityPacket(Packet):
@staticmethod
def get_id(context):
return 0x46 if context.protocol_version >= 721 else \
return 0x4F if context.protocol_version >= 756 else \
0x46 if context.protocol_version >= 721 else \
0x47 if context.protocol_version >= 707 else \
0x46 if context.protocol_version >= 550 else \
0x45 if context.protocol_version >= 471 else \
Expand Down Expand Up @@ -214,7 +220,8 @@ def get_id(context):
class EntityPositionDeltaPacket(Packet):
@staticmethod
def get_id(context):
return 0x27 if context.protocol_version >= 741 else \
return 0x29 if context.protocol_version >= 756 else \
0x27 if context.protocol_version >= 741 else \
0x28 if context.protocol_version >= 721 else \
0x29 if context.protocol_version >= 550 else \
0x28 if context.protocol_version >= 389 else \
Expand Down Expand Up @@ -253,7 +260,8 @@ def get_definition(context):
class TimeUpdatePacket(Packet):
@staticmethod
def get_id(context):
return 0x4E if context.protocol_version >= 721 else \
return 0x58 if context.protocol_version >= 756 else \
0x4E if context.protocol_version >= 721 else \
0x4F if context.protocol_version >= 550 else \
0x4E if context.protocol_version >= 471 else \
0x4A if context.protocol_version >= 461 else \
Expand All @@ -277,7 +285,8 @@ def get_id(context):
class UpdateHealthPacket(Packet):
@staticmethod
def get_id(context):
return 0x49 if context.protocol_version >= 721 else \
return 0x52 if context.protocol_version >= 756 else \
0x49 if context.protocol_version >= 721 else \
0x4A if context.protocol_version >= 707 else \
0x49 if context.protocol_version >= 550 else \
0x48 if context.protocol_version >= 471 else \
Expand All @@ -304,7 +313,8 @@ def get_id(context):
class PluginMessagePacket(AbstractPluginMessagePacket):
@staticmethod
def get_id(context):
return 0x17 if context.protocol_version >= 741 else \
return 0x18 if context.protocol_version >= 756 else \
0x17 if context.protocol_version >= 741 else \
0x18 if context.protocol_version >= 721 else \
0x19 if context.protocol_version >= 550 else \
0x18 if context.protocol_version >= 471 else \
Expand All @@ -318,7 +328,8 @@ def get_id(context):
class PlayerListHeaderAndFooterPacket(Packet):
@staticmethod
def get_id(context):
return 0x53 if context.protocol_version >= 721 else \
return 0x5E if context.protocol_version >= 756 else \
0x53 if context.protocol_version >= 721 else \
0x54 if context.protocol_version >= 550 else \
0x53 if context.protocol_version >= 471 else \
0x5F if context.protocol_version >= 461 else \
Expand All @@ -340,7 +351,8 @@ def get_id(context):
class EntityLookPacket(Packet):
@staticmethod
def get_id(context):
return 0x29 if context.protocol_version >= 741 else \
return 0x2B if context.protocol_version >= 756 else \
0x29 if context.protocol_version >= 741 else \
0x2A if context.protocol_version >= 721 else \
0x2B if context.protocol_version >= 550 else \
0x2A if context.protocol_version >= 389 else \
Expand All @@ -357,3 +369,15 @@ def get_id(context):
{'pitch': Angle},
{'on_ground': Boolean}
]

class ResourcePackSendPacket(Packet):
@staticmethod
def get_id(context):
return 0x3C if context.protocol_version >= 756 else \
0x38

packet_name = "resource pack send"
definition = [
{"url": String},
{"hash": String}
]
Loading

0 comments on commit 72c5906

Please sign in to comment.