mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
22w24a & update packets when they're modified
This commit is contained in:
parent
70cc7dfbed
commit
9c0b6f6631
4 changed files with 19 additions and 11 deletions
|
@ -7,7 +7,7 @@ A Rust crate for creating Minecraft bots.
|
|||
</p>
|
||||
|
||||
<!-- The line below is automatically read and updated by the migrate script, so don't change it manually. -->
|
||||
*Currently supported Minecraft version: `1.19`.*
|
||||
*Currently supported Minecraft version: `22w24a`.*
|
||||
|
||||
I named this Azalea because it sounds like a cool word and this is a cool library. This project was heavily inspired by PrismarineJS.
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use crate::{
|
|||
use num_derive::FromPrimitive;
|
||||
use num_traits::FromPrimitive;
|
||||
|
||||
pub const PROTOCOL_VERSION: u32 = 759;
|
||||
pub const PROTOCOL_VERSION: u32 = 1073741916;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, FromPrimitive)]
|
||||
pub enum ConnectionProtocol {
|
||||
|
|
|
@ -23,7 +23,7 @@ def get_version_manifest():
|
|||
print(
|
||||
f'\033[92mDownloading version manifest...\033[m')
|
||||
version_manifest_data = requests.get(
|
||||
'https://launchermeta.mojang.com/mc/game/version_manifest.json').json()
|
||||
'https://piston-meta.mojang.com/mc/game/version_manifest.json').json()
|
||||
with open(f'downloads/version_manifest.json', 'w') as f:
|
||||
json.dump(version_manifest_data, f)
|
||||
else:
|
||||
|
|
|
@ -19,18 +19,24 @@ new_packet_list = list(new_burger_data[0]['packets']['packet'].values())
|
|||
|
||||
|
||||
old_packets: dict[PacketIdentifier, str] = {}
|
||||
old_packets_data: dict[PacketIdentifier, dict] = {}
|
||||
new_packets: dict[PacketIdentifier, str] = {}
|
||||
new_packets_data: dict[PacketIdentifier, dict] = {}
|
||||
|
||||
for packet in old_packet_list:
|
||||
assert packet['class'].endswith('.class')
|
||||
packet_name = old_mappings.get_class(packet['class'][:-6])
|
||||
old_packets[PacketIdentifier(
|
||||
packet['id'], packet['direction'].lower(), fix_state(packet['state']))] = packet_name
|
||||
packet_ident = PacketIdentifier(
|
||||
packet['id'], packet['direction'].lower(), fix_state(packet['state']))
|
||||
old_packets[packet_ident] = packet_name
|
||||
old_packets_data[packet_ident] = packet
|
||||
for packet in new_packet_list:
|
||||
assert packet['class'].endswith('.class')
|
||||
packet_name = new_mappings.get_class(packet['class'][:-6])
|
||||
new_packets[PacketIdentifier(
|
||||
packet['id'], packet['direction'].lower(), fix_state(packet['state']))] = packet_name
|
||||
packet_ident = PacketIdentifier(
|
||||
packet['id'], packet['direction'].lower(), fix_state(packet['state']))
|
||||
new_packets[packet_ident] = packet_name
|
||||
new_packets_data[packet_ident] = packet
|
||||
|
||||
# find removed packets
|
||||
removed_packets: list[PacketIdentifier] = []
|
||||
|
@ -63,13 +69,15 @@ for (direction, state), packets in group_packets(list(changed_packets.keys())).i
|
|||
|
||||
print()
|
||||
|
||||
# find added packets
|
||||
added_packets: list[PacketIdentifier] = []
|
||||
# find added/changed packets
|
||||
added_or_changed_packets: list[PacketIdentifier] = []
|
||||
for packet, packet_name in new_packets.items():
|
||||
if packet_name not in old_packets.values():
|
||||
added_packets.append(packet)
|
||||
added_or_changed_packets.append(packet)
|
||||
print('Added packet:', packet, packet_name)
|
||||
for packet in added_packets:
|
||||
if new_packets_data[packet].get('instructions') != old_packets_data[packet].get('instructions'):
|
||||
print('hmm')
|
||||
for packet in added_or_changed_packets:
|
||||
lib.code.packet.generate_packet(
|
||||
new_burger_data[0]['packets']['packet'], new_mappings, packet.packet_id, packet.direction, packet.state)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue