mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
1.19.1
This commit is contained in:
parent
3aa856b413
commit
2211021105
4 changed files with 40 additions and 5 deletions
|
@ -7,7 +7,7 @@ A collection of Rust crates primarily 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.1-rc2`.*
|
||||
*Currently supported Minecraft version: `1.19.1`.*
|
||||
|
||||
I named this Azalea because it sounds like a cool word and this is a cool library. This project was heavily inspired by PrismarineJS.
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use azalea_buf::McBuf;
|
||||
use azalea_buf::{BitSet, McBuf, McBufReadable, McBufVarWritable};
|
||||
use azalea_buf::{McBufVarReadable, McBufWritable};
|
||||
use azalea_chat::component::Component;
|
||||
use azalea_crypto::{MessageSignature, SignedMessageHeader};
|
||||
use packet_macros::GamePacket;
|
||||
use std::io::{Read, Write};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, McBuf, GamePacket)]
|
||||
|
@ -25,7 +27,7 @@ pub enum ChatType {
|
|||
pub struct ChatTypeBound {
|
||||
pub chat_type: ChatType,
|
||||
pub name: Component,
|
||||
pub target_name: Component,
|
||||
pub target_name: Option<Component>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
|
@ -34,6 +36,7 @@ pub struct PlayerChatMessage {
|
|||
pub header_signature: MessageSignature,
|
||||
pub signed_body: SignedMessageBody,
|
||||
pub unsigned_content: Option<Component>,
|
||||
pub filter_mask: FilterMask,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, McBuf)]
|
||||
|
@ -62,3 +65,35 @@ pub struct ChatMessageContent {
|
|||
/// Only sent if the decorated message is different than the plain.
|
||||
pub decorated: Option<Component>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum FilterMask {
|
||||
PassThrough,
|
||||
FullyFiltered,
|
||||
PartiallyFiltered(BitSet),
|
||||
}
|
||||
|
||||
impl McBufReadable for FilterMask {
|
||||
fn read_from(buf: &mut impl Read) -> Result<Self, String> {
|
||||
let filter_mask = u32::var_read_from(buf)?;
|
||||
match filter_mask {
|
||||
0 => Ok(FilterMask::PassThrough),
|
||||
1 => Ok(FilterMask::FullyFiltered),
|
||||
2 => Ok(FilterMask::PartiallyFiltered(BitSet::read_from(buf)?)),
|
||||
_ => Err("Invalid filter mask".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl McBufWritable for FilterMask {
|
||||
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
|
||||
match self {
|
||||
FilterMask::PassThrough => 0u32.var_write_into(buf)?,
|
||||
FilterMask::FullyFiltered => 1u32.var_write_into(buf)?,
|
||||
FilterMask::PartiallyFiltered(bits) => {
|
||||
2u32.var_write_into(buf)?;
|
||||
bits.write_into(buf)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::connect::PacketFlow;
|
|||
use azalea_buf::{McBufWritable, Readable, Writable};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
pub const PROTOCOL_VERSION: u32 = 1073741924;
|
||||
pub const PROTOCOL_VERSION: u32 = 760;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum ConnectionProtocol {
|
||||
|
|
|
@ -6,7 +6,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
println!("Hello, world!");
|
||||
|
||||
// let address = "95.111.249.143:10000";
|
||||
let address = "localhost:56150";
|
||||
let address = "localhost:25565";
|
||||
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
|
||||
// .await
|
||||
// .unwrap();
|
||||
|
|
Loading…
Add table
Reference in a new issue