mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
group imports with rustfmt
This commit is contained in:
parent
b762575db6
commit
6b0fe5bf63
128 changed files with 469 additions and 357 deletions
|
@ -1,18 +1,20 @@
|
||||||
//! Handle Minecraft (Xbox) authentication.
|
//! Handle Minecraft (Xbox) authentication.
|
||||||
|
|
||||||
use crate::cache::{self, CachedAccount, ExpiringValue};
|
|
||||||
use chrono::{DateTime, Utc};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use serde_json::json;
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
time::{Instant, SystemTime, UNIX_EPOCH},
|
time::{Instant, SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use chrono::{DateTime, Utc};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use serde_json::json;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tracing::{error, trace};
|
use tracing::{error, trace};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::cache::{self, CachedAccount, ExpiringValue};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct AuthOpts<'a> {
|
pub struct AuthOpts<'a> {
|
||||||
/// Whether we should check if the user actually owns the game. This will
|
/// Whether we should check if the user actually owns the game. This will
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
//! Cache auth information
|
//! Cache auth information
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tokio::fs::File;
|
use tokio::fs::File;
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(McBuf, Debug, Clone, Default, Eq, PartialEq)]
|
#[derive(McBuf, Debug, Clone, Default, Eq, PartialEq)]
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::fmt::Write;
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use proc_macro2::TokenTree;
|
use proc_macro2::TokenTree;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::fmt::Write;
|
|
||||||
use syn::{
|
use syn::{
|
||||||
braced,
|
braced,
|
||||||
ext::IdentExt,
|
ext::IdentExt,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::{Block, BlockBehavior, BlockState, BlockStates, Property};
|
|
||||||
use azalea_block_macros::make_block_states;
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
use azalea_block_macros::make_block_states;
|
||||||
|
|
||||||
|
use crate::{Block, BlockBehavior, BlockState, BlockStates, Property};
|
||||||
|
|
||||||
make_block_states! {
|
make_block_states! {
|
||||||
Properties => {
|
Properties => {
|
||||||
"snowy" => Snowy(bool),
|
"snowy" => Snowy(bool),
|
||||||
|
|
|
@ -5,17 +5,17 @@ mod behavior;
|
||||||
mod generated;
|
mod generated;
|
||||||
mod range;
|
mod range;
|
||||||
|
|
||||||
pub use generated::{blocks, properties};
|
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
|
||||||
pub use behavior::BlockBehavior;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
pub use range::BlockStates;
|
|
||||||
use std::{
|
use std::{
|
||||||
any::Any,
|
any::Any,
|
||||||
io::{Cursor, Write},
|
io::{Cursor, Write},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||||
|
pub use behavior::BlockBehavior;
|
||||||
|
pub use generated::{blocks, properties};
|
||||||
|
pub use range::BlockStates;
|
||||||
|
|
||||||
pub trait Block: Debug + Any {
|
pub trait Block: Debug + Any {
|
||||||
fn behavior(&self) -> BlockBehavior;
|
fn behavior(&self) -> BlockBehavior;
|
||||||
/// Get the Minecraft ID for this block. For example `stone` or
|
/// Get the Minecraft ID for this block. For example `stone` or
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
|
use super::ArgumentType;
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContext,
|
context::CommandContext,
|
||||||
exceptions::CommandSyntaxException,
|
exceptions::CommandSyntaxException,
|
||||||
|
@ -7,8 +8,6 @@ use crate::{
|
||||||
suggestion::{Suggestions, SuggestionsBuilder},
|
suggestion::{Suggestions, SuggestionsBuilder},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ArgumentType;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Boolean;
|
struct Boolean;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
|
use super::ArgumentType;
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContext,
|
context::CommandContext,
|
||||||
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
||||||
string_reader::StringReader,
|
string_reader::StringReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ArgumentType;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Double {
|
struct Double {
|
||||||
pub minimum: Option<f64>,
|
pub minimum: Option<f64>,
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
|
use super::ArgumentType;
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContext,
|
context::CommandContext,
|
||||||
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
||||||
string_reader::StringReader,
|
string_reader::StringReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ArgumentType;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Float {
|
struct Float {
|
||||||
pub minimum: Option<f32>,
|
pub minimum: Option<f32>,
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
|
use super::ArgumentType;
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContext,
|
context::CommandContext,
|
||||||
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
||||||
string_reader::StringReader,
|
string_reader::StringReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ArgumentType;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Integer {
|
struct Integer {
|
||||||
pub minimum: Option<i32>,
|
pub minimum: Option<i32>,
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
|
use super::ArgumentType;
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContext,
|
context::CommandContext,
|
||||||
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
exceptions::{BuiltInExceptions, CommandSyntaxException},
|
||||||
string_reader::StringReader,
|
string_reader::StringReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ArgumentType;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Long {
|
struct Long {
|
||||||
pub minimum: Option<i64>,
|
pub minimum: Option<i64>,
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
|
use super::ArgumentType;
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContext, exceptions::CommandSyntaxException, string_reader::StringReader,
|
context::CommandContext, exceptions::CommandSyntaxException, string_reader::StringReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ArgumentType;
|
|
||||||
|
|
||||||
pub enum StringArgument {
|
pub enum StringArgument {
|
||||||
/// Match up until the next space.
|
/// Match up until the next space.
|
||||||
SingleWord,
|
SingleWord,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
|
use std::{fmt::Debug, sync::Arc};
|
||||||
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
|
use super::{literal_argument_builder::Literal, required_argument_builder::Argument};
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContext,
|
context::CommandContext,
|
||||||
modifier::RedirectModifier,
|
modifier::RedirectModifier,
|
||||||
tree::{Command, CommandNode},
|
tree::{Command, CommandNode},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{literal_argument_builder::Literal, required_argument_builder::Argument};
|
|
||||||
use std::{fmt::Debug, sync::Arc};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ArgumentBuilderType {
|
pub enum ArgumentBuilderType {
|
||||||
Literal(Literal),
|
Literal(Literal),
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::{any::Any, fmt::Debug, sync::Arc};
|
||||||
|
|
||||||
use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType};
|
use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType};
|
||||||
use crate::{
|
use crate::{
|
||||||
arguments::ArgumentType,
|
arguments::ArgumentType,
|
||||||
|
@ -5,7 +7,6 @@ use crate::{
|
||||||
string_reader::StringReader,
|
string_reader::StringReader,
|
||||||
suggestion::{Suggestions, SuggestionsBuilder},
|
suggestion::{Suggestions, SuggestionsBuilder},
|
||||||
};
|
};
|
||||||
use std::{any::Any, fmt::Debug, sync::Arc};
|
|
||||||
|
|
||||||
/// An argument node type. The `T` type parameter is the type of the argument,
|
/// An argument node type. The `T` type parameter is the type of the argument,
|
||||||
/// which can be anything.
|
/// which can be anything.
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
use std::{
|
||||||
|
cmp::Ordering,
|
||||||
|
collections::{HashMap, HashSet},
|
||||||
|
mem,
|
||||||
|
rc::Rc,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -9,13 +17,6 @@ use crate::{
|
||||||
suggestion::{Suggestions, SuggestionsBuilder},
|
suggestion::{Suggestions, SuggestionsBuilder},
|
||||||
tree::CommandNode,
|
tree::CommandNode,
|
||||||
};
|
};
|
||||||
use std::{
|
|
||||||
cmp::Ordering,
|
|
||||||
collections::{HashMap, HashSet},
|
|
||||||
mem,
|
|
||||||
rc::Rc,
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The root of the command tree. You need to make this to register commands.
|
/// The root of the command tree. You need to make this to register commands.
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
|
||||||
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
use super::{parsed_command_node::ParsedCommandNode, string_range::StringRange, ParsedArgument};
|
use super::{parsed_command_node::ParsedCommandNode, string_range::StringRange, ParsedArgument};
|
||||||
|
@ -5,7 +7,6 @@ use crate::{
|
||||||
modifier::RedirectModifier,
|
modifier::RedirectModifier,
|
||||||
tree::{Command, CommandNode},
|
tree::{Command, CommandNode},
|
||||||
};
|
};
|
||||||
use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
|
|
||||||
|
|
||||||
/// A built `CommandContextBuilder`.
|
/// A built `CommandContextBuilder`.
|
||||||
pub struct CommandContext<S> {
|
pub struct CommandContext<S> {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
|
||||||
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -9,7 +11,6 @@ use crate::{
|
||||||
modifier::RedirectModifier,
|
modifier::RedirectModifier,
|
||||||
tree::{Command, CommandNode},
|
tree::{Command, CommandNode},
|
||||||
};
|
};
|
||||||
use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
|
|
||||||
|
|
||||||
pub struct CommandContextBuilder<'a, S> {
|
pub struct CommandContextBuilder<'a, S> {
|
||||||
pub arguments: HashMap<String, ParsedArgument>,
|
pub arguments: HashMap<String, ParsedArgument>,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use super::string_range::StringRange;
|
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
|
use super::string_range::StringRange;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ParsedArgument {
|
pub struct ParsedArgument {
|
||||||
pub range: StringRange,
|
pub range: StringRange,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
use super::string_range::StringRange;
|
use super::string_range::StringRange;
|
||||||
use crate::tree::CommandNode;
|
use crate::tree::CommandNode;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ParsedCommandNode<S> {
|
pub struct ParsedCommandNode<S> {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use crate::string_reader::StringReader;
|
|
||||||
|
|
||||||
use super::command_syntax_exception::CommandSyntaxException;
|
use super::command_syntax_exception::CommandSyntaxException;
|
||||||
|
use crate::string_reader::StringReader;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
pub enum BuiltInExceptions {
|
pub enum BuiltInExceptions {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
use super::builtin_exceptions::BuiltInExceptions;
|
|
||||||
use std::{
|
use std::{
|
||||||
cmp,
|
cmp,
|
||||||
fmt::{self, Write},
|
fmt::{self, Write},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::builtin_exceptions::BuiltInExceptions;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
pub struct CommandSyntaxException {
|
pub struct CommandSyntaxException {
|
||||||
pub type_: BuiltInExceptions,
|
pub type_: BuiltInExceptions,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::{collections::HashMap, fmt::Debug, rc::Rc};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
context::CommandContextBuilder, exceptions::CommandSyntaxException,
|
context::CommandContextBuilder, exceptions::CommandSyntaxException,
|
||||||
string_reader::StringReader, tree::CommandNode,
|
string_reader::StringReader, tree::CommandNode,
|
||||||
};
|
};
|
||||||
use std::{collections::HashMap, fmt::Debug, rc::Rc};
|
|
||||||
|
|
||||||
pub struct ParseResults<'a, S> {
|
pub struct ParseResults<'a, S> {
|
||||||
pub context: CommandContextBuilder<'a, S>,
|
pub context: CommandContextBuilder<'a, S>,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::exceptions::{BuiltInExceptions, CommandSyntaxException};
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use crate::exceptions::{BuiltInExceptions, CommandSyntaxException};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct StringReader {
|
pub struct StringReader {
|
||||||
string: String,
|
string: String,
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
mod suggestions;
|
mod suggestions;
|
||||||
mod suggestions_builder;
|
mod suggestions_builder;
|
||||||
|
|
||||||
use crate::context::StringRange;
|
|
||||||
#[cfg(feature = "azalea-buf")]
|
|
||||||
use azalea_buf::McBufWritable;
|
|
||||||
#[cfg(feature = "azalea-buf")]
|
|
||||||
use azalea_chat::FormattedText;
|
|
||||||
#[cfg(feature = "azalea-buf")]
|
#[cfg(feature = "azalea-buf")]
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::{
|
use std::{
|
||||||
fmt::{self, Display},
|
fmt::{self, Display},
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "azalea-buf")]
|
||||||
|
use azalea_buf::McBufWritable;
|
||||||
|
#[cfg(feature = "azalea-buf")]
|
||||||
|
use azalea_chat::FormattedText;
|
||||||
pub use suggestions::Suggestions;
|
pub use suggestions::Suggestions;
|
||||||
pub use suggestions_builder::SuggestionsBuilder;
|
pub use suggestions_builder::SuggestionsBuilder;
|
||||||
|
|
||||||
|
use crate::context::StringRange;
|
||||||
|
|
||||||
/// A suggestion given to the user for what they might want to type next.
|
/// A suggestion given to the user for what they might want to type next.
|
||||||
///
|
///
|
||||||
/// The `M` generic is the type of the tooltip, so for example a `String` or
|
/// The `M` generic is the type of the tooltip, so for example a `String` or
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
use super::Suggestion;
|
|
||||||
use crate::context::StringRange;
|
|
||||||
#[cfg(feature = "azalea-buf")]
|
#[cfg(feature = "azalea-buf")]
|
||||||
use crate::suggestion::SuggestionValue;
|
use std::io::{Cursor, Write};
|
||||||
|
use std::{collections::HashSet, hash::Hash};
|
||||||
|
|
||||||
#[cfg(feature = "azalea-buf")]
|
#[cfg(feature = "azalea-buf")]
|
||||||
use azalea_buf::{
|
use azalea_buf::{
|
||||||
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "azalea-buf")]
|
#[cfg(feature = "azalea-buf")]
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
|
|
||||||
|
use super::Suggestion;
|
||||||
|
use crate::context::StringRange;
|
||||||
#[cfg(feature = "azalea-buf")]
|
#[cfg(feature = "azalea-buf")]
|
||||||
use std::io::{Cursor, Write};
|
use crate::suggestion::SuggestionValue;
|
||||||
use std::{collections::HashSet, hash::Hash};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)]
|
||||||
pub struct Suggestions {
|
pub struct Suggestions {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::context::StringRange;
|
|
||||||
|
|
||||||
use super::{Suggestion, SuggestionValue, Suggestions};
|
use super::{Suggestion, SuggestionValue, Suggestions};
|
||||||
|
use crate::context::StringRange;
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
pub struct SuggestionsBuilder {
|
pub struct SuggestionsBuilder {
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
use std::{
|
||||||
|
collections::{BTreeMap, HashMap},
|
||||||
|
fmt::Debug,
|
||||||
|
hash::Hash,
|
||||||
|
ptr,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -11,13 +19,6 @@ use crate::{
|
||||||
string_reader::StringReader,
|
string_reader::StringReader,
|
||||||
suggestion::{Suggestions, SuggestionsBuilder},
|
suggestion::{Suggestions, SuggestionsBuilder},
|
||||||
};
|
};
|
||||||
use std::{
|
|
||||||
collections::{BTreeMap, HashMap},
|
|
||||||
fmt::Debug,
|
|
||||||
hash::Hash,
|
|
||||||
ptr,
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub type Command<S> = Option<Arc<dyn Fn(&CommandContext<S>) -> i32 + Send + Sync>>;
|
pub type Command<S> = Option<Arc<dyn Fn(&CommandContext<S>) -> i32 + Send + Sync>>;
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,10 @@ const MAX_STRING_LENGTH: u16 = 32767;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use std::{collections::HashMap, io::Cursor};
|
use std::{collections::HashMap, io::Cursor};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_write_varint() {
|
fn test_write_varint() {
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
use super::{UnsizedByteArray, MAX_STRING_LENGTH};
|
|
||||||
use byteorder::{ReadBytesExt, BE};
|
|
||||||
use std::{
|
use std::{
|
||||||
backtrace::Backtrace,
|
backtrace::Backtrace,
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
io::{Cursor, Read},
|
io::{Cursor, Read},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use byteorder::{ReadBytesExt, BE};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
|
use super::{UnsizedByteArray, MAX_STRING_LENGTH};
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum BufReadError {
|
pub enum BufReadError {
|
||||||
#[error("Invalid VarInt")]
|
#[error("Invalid VarInt")]
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::{read::BufReadError, McBufReadable, McBufWritable};
|
|
||||||
use std::io::{Cursor, Write};
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::{read::BufReadError, McBufReadable, McBufWritable};
|
||||||
|
|
||||||
pub trait SerializableUuid {
|
pub trait SerializableUuid {
|
||||||
fn to_int_array(&self) -> [u32; 4];
|
fn to_int_array(&self) -> [u32; 4];
|
||||||
fn from_int_array(array: [u32; 4]) -> Self;
|
fn from_int_array(array: [u32; 4]) -> Self;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use super::{UnsizedByteArray, MAX_STRING_LENGTH};
|
|
||||||
use byteorder::{BigEndian, WriteBytesExt};
|
|
||||||
use std::{collections::HashMap, io::Write};
|
use std::{collections::HashMap, io::Write};
|
||||||
|
|
||||||
|
use byteorder::{BigEndian, WriteBytesExt};
|
||||||
|
|
||||||
|
use super::{UnsizedByteArray, MAX_STRING_LENGTH};
|
||||||
|
|
||||||
fn write_utf_with_len(
|
fn write_utf_with_len(
|
||||||
buf: &mut impl Write,
|
buf: &mut impl Write,
|
||||||
string: &str,
|
string: &str,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::{style::Style, FormattedText};
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use crate::{style::Style, FormattedText};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)]
|
||||||
pub struct BaseComponent {
|
pub struct BaseComponent {
|
||||||
// implements mutablecomponent
|
// implements mutablecomponent
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
use crate::{
|
use std::fmt::Display;
|
||||||
base_component::BaseComponent,
|
|
||||||
style::{ChatFormatting, Style},
|
|
||||||
text_component::TextComponent,
|
|
||||||
translatable_component::{StringOrComponent, TranslatableComponent},
|
|
||||||
};
|
|
||||||
#[cfg(feature = "azalea-buf")]
|
#[cfg(feature = "azalea-buf")]
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize};
|
use serde::{de, Deserialize, Deserializer, Serialize};
|
||||||
#[cfg(feature = "simdnbt")]
|
#[cfg(feature = "simdnbt")]
|
||||||
use simdnbt::{Deserialize as _, FromNbtTag as _, Serialize as _};
|
use simdnbt::{Deserialize as _, FromNbtTag as _, Serialize as _};
|
||||||
use std::fmt::Display;
|
|
||||||
use tracing::{debug, trace, warn};
|
use tracing::{debug, trace, warn};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
base_component::BaseComponent,
|
||||||
|
style::{ChatFormatting, Style},
|
||||||
|
text_component::TextComponent,
|
||||||
|
translatable_component::{StringOrComponent, TranslatableComponent},
|
||||||
|
};
|
||||||
|
|
||||||
/// A chat component, basically anything you can see in chat.
|
/// A chat component, basically anything you can see in chat.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Hash)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
|
|
|
@ -605,9 +605,8 @@ impl simdnbt::Deserialize for Style {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::component::DEFAULT_STYLE;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::component::DEFAULT_STYLE;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn text_color_named_colors() {
|
fn text_color_named_colors() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::{base_component::BaseComponent, style::ChatFormatting, FormattedText};
|
|
||||||
use serde::{ser::SerializeMap, Serialize, Serializer, __private::ser::FlatMapSerializer};
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
|
use serde::{ser::SerializeMap, Serialize, Serializer, __private::ser::FlatMapSerializer};
|
||||||
|
|
||||||
|
use crate::{base_component::BaseComponent, style::ChatFormatting, FormattedText};
|
||||||
|
|
||||||
/// A component that contains text that's the same in all locales.
|
/// A component that contains text that's the same in all locales.
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
pub struct TextComponent {
|
pub struct TextComponent {
|
||||||
|
@ -140,9 +142,8 @@ impl Display for TextComponent {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::style::Ansi;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::style::Ansi;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hypixel_motd() {
|
fn test_hypixel_motd() {
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Display, Formatter};
|
||||||
|
|
||||||
|
use serde::{ser::SerializeMap, Serialize, Serializer, __private::ser::FlatMapSerializer};
|
||||||
|
#[cfg(feature = "simdnbt")]
|
||||||
|
use simdnbt::Serialize as _;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
base_component::BaseComponent, style::Style, text_component::TextComponent, FormattedText,
|
base_component::BaseComponent, style::Style, text_component::TextComponent, FormattedText,
|
||||||
};
|
};
|
||||||
use serde::{ser::SerializeMap, Serialize, Serializer, __private::ser::FlatMapSerializer};
|
|
||||||
#[cfg(feature = "simdnbt")]
|
|
||||||
use simdnbt::Serialize as _;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
//! Implementations of chat-related features.
|
//! Implementations of chat-related features.
|
||||||
|
|
||||||
|
use std::{
|
||||||
|
sync::Arc,
|
||||||
|
time::{SystemTime, UNIX_EPOCH},
|
||||||
|
};
|
||||||
|
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
use azalea_protocol::packets::game::{
|
use azalea_protocol::packets::game::{
|
||||||
clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket,
|
clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket,
|
||||||
|
@ -15,10 +20,6 @@ use bevy_ecs::{
|
||||||
prelude::Event,
|
prelude::Event,
|
||||||
schedule::IntoSystemConfigs,
|
schedule::IntoSystemConfigs,
|
||||||
};
|
};
|
||||||
use std::{
|
|
||||||
sync::Arc,
|
|
||||||
time::{SystemTime, UNIX_EPOCH},
|
|
||||||
};
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -1,27 +1,11 @@
|
||||||
use crate::{
|
use std::{
|
||||||
attack::{self, AttackPlugin},
|
collections::HashMap,
|
||||||
chat::ChatPlugin,
|
fmt::Debug,
|
||||||
chunks::{ChunkBatchInfo, ChunkPlugin},
|
io,
|
||||||
configuration::ConfigurationPlugin,
|
net::SocketAddr,
|
||||||
disconnect::{DisconnectEvent, DisconnectPlugin},
|
ops::Deref,
|
||||||
events::{Event, EventPlugin, LocalPlayerEvents},
|
sync::Arc,
|
||||||
interact::{CurrentSequenceNumber, InteractPlugin},
|
time::{Duration, Instant},
|
||||||
inventory::{Inventory, InventoryPlugin},
|
|
||||||
local_player::{
|
|
||||||
death_event, GameProfileComponent, Hunger, InstanceHolder, PermissionLevel,
|
|
||||||
PlayerAbilities, TabList,
|
|
||||||
},
|
|
||||||
mining::{self, MinePlugin},
|
|
||||||
movement::{LastSentLookDirection, PhysicsState, PlayerMovePlugin},
|
|
||||||
packet_handling::{
|
|
||||||
login::{self, LoginSendPacketQueue},
|
|
||||||
PacketHandlerPlugin,
|
|
||||||
},
|
|
||||||
player::retroactively_add_game_profile_component,
|
|
||||||
raw_connection::RawConnection,
|
|
||||||
respawn::RespawnPlugin,
|
|
||||||
task_pool::TaskPoolPlugin,
|
|
||||||
Account, PlayerInfo,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use azalea_auth::{game_profile::GameProfile, sessionserver::ClientSessionServerError};
|
use azalea_auth::{game_profile::GameProfile, sessionserver::ClientSessionServerError};
|
||||||
|
@ -68,15 +52,6 @@ use bevy_ecs::{
|
||||||
use bevy_time::TimePlugin;
|
use bevy_time::TimePlugin;
|
||||||
use derive_more::Deref;
|
use derive_more::Deref;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use std::{
|
|
||||||
collections::HashMap,
|
|
||||||
fmt::Debug,
|
|
||||||
io,
|
|
||||||
net::SocketAddr,
|
|
||||||
ops::Deref,
|
|
||||||
sync::Arc,
|
|
||||||
time::{Duration, Instant},
|
|
||||||
};
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tokio::{
|
use tokio::{
|
||||||
sync::{broadcast, mpsc},
|
sync::{broadcast, mpsc},
|
||||||
|
@ -85,6 +60,32 @@ use tokio::{
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
attack::{self, AttackPlugin},
|
||||||
|
chat::ChatPlugin,
|
||||||
|
chunks::{ChunkBatchInfo, ChunkPlugin},
|
||||||
|
configuration::ConfigurationPlugin,
|
||||||
|
disconnect::{DisconnectEvent, DisconnectPlugin},
|
||||||
|
events::{Event, EventPlugin, LocalPlayerEvents},
|
||||||
|
interact::{CurrentSequenceNumber, InteractPlugin},
|
||||||
|
inventory::{Inventory, InventoryPlugin},
|
||||||
|
local_player::{
|
||||||
|
death_event, GameProfileComponent, Hunger, InstanceHolder, PermissionLevel,
|
||||||
|
PlayerAbilities, TabList,
|
||||||
|
},
|
||||||
|
mining::{self, MinePlugin},
|
||||||
|
movement::{LastSentLookDirection, PhysicsState, PlayerMovePlugin},
|
||||||
|
packet_handling::{
|
||||||
|
login::{self, LoginSendPacketQueue},
|
||||||
|
PacketHandlerPlugin,
|
||||||
|
},
|
||||||
|
player::retroactively_add_game_profile_component,
|
||||||
|
raw_connection::RawConnection,
|
||||||
|
respawn::RespawnPlugin,
|
||||||
|
task_pool::TaskPoolPlugin,
|
||||||
|
Account, PlayerInfo,
|
||||||
|
};
|
||||||
|
|
||||||
/// `Client` has the things that a user interacting with the library will want.
|
/// `Client` has the things that a user interacting with the library will want.
|
||||||
///
|
///
|
||||||
/// To make a new client, use either [`azalea::ClientBuilder`] or
|
/// To make a new client, use either [`azalea::ClientBuilder`] or
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::client::Client;
|
use std::backtrace::Backtrace;
|
||||||
use crate::packet_handling::game::SendPacketEvent;
|
|
||||||
use azalea_core::position::Vec3;
|
use azalea_core::position::Vec3;
|
||||||
use azalea_core::tick::GameTick;
|
use azalea_core::tick::GameTick;
|
||||||
use azalea_entity::{metadata::Sprinting, Attributes, Jumping};
|
use azalea_entity::{metadata::Sprinting, Attributes, Jumping};
|
||||||
|
@ -20,9 +20,11 @@ use bevy_ecs::{
|
||||||
component::Component, entity::Entity, event::EventReader, query::With,
|
component::Component, entity::Entity, event::EventReader, query::With,
|
||||||
schedule::IntoSystemConfigs, system::Query,
|
schedule::IntoSystemConfigs, system::Query,
|
||||||
};
|
};
|
||||||
use std::backtrace::Backtrace;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
use crate::client::Client;
|
||||||
|
use crate::packet_handling::game::SendPacketEvent;
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum MovePlayerError {
|
pub enum MovePlayerError {
|
||||||
#[error("Player is not in world")]
|
#[error("Player is not in world")]
|
||||||
|
|
|
@ -2,8 +2,6 @@ use azalea_entity::{metadata::Health, EntityUpdateSet};
|
||||||
use bevy_app::{App, First, Plugin, PreUpdate, Update};
|
use bevy_app::{App, First, Plugin, PreUpdate, Update};
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
|
|
||||||
use crate::{chat::ChatReceivedEvent, events::death_listener};
|
|
||||||
|
|
||||||
use self::{
|
use self::{
|
||||||
game::{
|
game::{
|
||||||
AddPlayerEvent, DeathEvent, InstanceLoadedEvent, KeepAliveEvent, RemovePlayerEvent,
|
AddPlayerEvent, DeathEvent, InstanceLoadedEvent, KeepAliveEvent, RemovePlayerEvent,
|
||||||
|
@ -11,6 +9,7 @@ use self::{
|
||||||
},
|
},
|
||||||
login::{LoginPacketEvent, SendLoginPacketEvent},
|
login::{LoginPacketEvent, SendLoginPacketEvent},
|
||||||
};
|
};
|
||||||
|
use crate::{chat::ChatReceivedEvent, events::death_listener};
|
||||||
|
|
||||||
pub mod configuration;
|
pub mod configuration;
|
||||||
pub mod game;
|
pub mod game;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
//! Ping Minecraft servers.
|
//! Ping Minecraft servers.
|
||||||
|
|
||||||
|
use std::io;
|
||||||
|
|
||||||
use azalea_protocol::{
|
use azalea_protocol::{
|
||||||
connect::{Connection, ConnectionError, Proxy},
|
connect::{Connection, ConnectionError, Proxy},
|
||||||
packets::{
|
packets::{
|
||||||
|
@ -16,7 +18,6 @@ use azalea_protocol::{
|
||||||
},
|
},
|
||||||
resolver, ServerAddress,
|
resolver, ServerAddress,
|
||||||
};
|
};
|
||||||
use std::io;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::position::Vec3;
|
|
||||||
pub use azalea_buf::McBuf;
|
pub use azalea_buf::McBuf;
|
||||||
|
|
||||||
|
use crate::position::Vec3;
|
||||||
|
|
||||||
pub trait PositionDeltaTrait {
|
pub trait PositionDeltaTrait {
|
||||||
fn x(&self) -> f64;
|
fn x(&self) -> f64;
|
||||||
fn y(&self) -> f64;
|
fn y(&self) -> f64;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufWritable};
|
|
||||||
use std::io::{Cursor, Write};
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
|
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufWritable};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
/// A Minecraft gamemode, like survival or creative.
|
/// A Minecraft gamemode, like survival or creative.
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
//! The most common ones are [`Vec3`] and [`BlockPos`], which are usually used
|
//! The most common ones are [`Vec3`] and [`BlockPos`], which are usually used
|
||||||
//! for entity positions and block positions, respectively.
|
//! for entity positions and block positions, respectively.
|
||||||
|
|
||||||
use crate::resource_location::ResourceLocation;
|
|
||||||
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
|
@ -15,6 +11,12 @@ use std::{
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::resource_location::ResourceLocation;
|
||||||
|
|
||||||
macro_rules! vec3_impl {
|
macro_rules! vec3_impl {
|
||||||
($name:ident, $type:ty) => {
|
($name:ident, $type:ty) => {
|
||||||
impl $name {
|
impl $name {
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
//! the game, including the types of chat messages, dimensions, and
|
//! the game, including the types of chat messages, dimensions, and
|
||||||
//! biomes.
|
//! biomes.
|
||||||
|
|
||||||
|
use std::{collections::HashMap, io::Cursor};
|
||||||
|
|
||||||
use simdnbt::{
|
use simdnbt::{
|
||||||
owned::{NbtCompound, NbtTag},
|
owned::{NbtCompound, NbtTag},
|
||||||
Deserialize, FromNbtTag, Serialize, ToNbtTag,
|
Deserialize, FromNbtTag, Serialize, ToNbtTag,
|
||||||
};
|
};
|
||||||
use std::{collections::HashMap, io::Cursor};
|
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use crate::resource_location::ResourceLocation;
|
use crate::resource_location::ResourceLocation;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
//! A resource, like minecraft:stone
|
//! A resource, like minecraft:stone
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
|
||||||
use simdnbt::{owned::NbtTag, FromNbtTag, ToNbtTag};
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
io::{Cursor, Write},
|
io::{Cursor, Write},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
use simdnbt::{owned::NbtTag, FromNbtTag, ToNbtTag};
|
||||||
|
|
||||||
#[derive(Hash, Clone, PartialEq, Eq)]
|
#[derive(Hash, Clone, PartialEq, Eq)]
|
||||||
pub struct ResourceLocation {
|
pub struct ResourceLocation {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
//! Define some types needed for entity metadata.
|
//! Define some types needed for entity metadata.
|
||||||
|
|
||||||
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{
|
use azalea_buf::{
|
||||||
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
||||||
};
|
};
|
||||||
|
@ -13,7 +15,6 @@ use bevy_ecs::component::Component;
|
||||||
use derive_more::Deref;
|
use derive_more::Deref;
|
||||||
use enum_as_inner::EnumAsInner;
|
use enum_as_inner::EnumAsInner;
|
||||||
use nohash_hasher::IntSet;
|
use nohash_hasher::IntSet;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::particle::Particle;
|
use crate::particle::Particle;
|
||||||
|
|
|
@ -10,7 +10,11 @@ pub mod mining;
|
||||||
pub mod particle;
|
pub mod particle;
|
||||||
mod plugin;
|
mod plugin;
|
||||||
|
|
||||||
use self::attributes::AttributeInstance;
|
use std::{
|
||||||
|
fmt::Debug,
|
||||||
|
hash::{Hash, Hasher},
|
||||||
|
};
|
||||||
|
|
||||||
pub use attributes::Attributes;
|
pub use attributes::Attributes;
|
||||||
use azalea_block::BlockState;
|
use azalea_block::BlockState;
|
||||||
use azalea_core::{
|
use azalea_core::{
|
||||||
|
@ -25,12 +29,9 @@ pub use data::*;
|
||||||
use derive_more::{Deref, DerefMut};
|
use derive_more::{Deref, DerefMut};
|
||||||
pub use dimensions::EntityDimensions;
|
pub use dimensions::EntityDimensions;
|
||||||
use plugin::indexing::EntityChunkPos;
|
use plugin::indexing::EntityChunkPos;
|
||||||
use std::{
|
|
||||||
fmt::Debug,
|
|
||||||
hash::{Hash, Hasher},
|
|
||||||
};
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use self::attributes::AttributeInstance;
|
||||||
pub use crate::plugin::*;
|
pub use crate::plugin::*;
|
||||||
|
|
||||||
pub fn move_relative(
|
pub fn move_relative(
|
||||||
|
|
|
@ -3,12 +3,6 @@
|
||||||
// This file is generated from codegen/lib/code/entity.py.
|
// This file is generated from codegen/lib/code/entity.py.
|
||||||
// Don't change it manually!
|
// Don't change it manually!
|
||||||
|
|
||||||
use crate::particle::Particle;
|
|
||||||
|
|
||||||
use super::{
|
|
||||||
ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion,
|
|
||||||
Rotations, SnifferState, VillagerData,
|
|
||||||
};
|
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
use azalea_core::{
|
use azalea_core::{
|
||||||
direction::Direction,
|
direction::Direction,
|
||||||
|
@ -20,6 +14,12 @@ use derive_more::{Deref, DerefMut};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use super::{
|
||||||
|
ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion,
|
||||||
|
Rotations, SnifferState, VillagerData,
|
||||||
|
};
|
||||||
|
use crate::particle::Particle;
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum UpdateMetadataError {
|
pub enum UpdateMetadataError {
|
||||||
#[error("Wrong type ({0:?})")]
|
#[error("Wrong type ({0:?})")]
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
//! Stuff related to entity indexes and keeping track of entities in the world.
|
//! Stuff related to entity indexes and keeping track of entities in the world.
|
||||||
|
|
||||||
|
use std::{collections::HashMap, fmt::Debug};
|
||||||
|
|
||||||
use azalea_core::position::ChunkPos;
|
use azalea_core::position::ChunkPos;
|
||||||
use azalea_world::{Instance, InstanceContainer, InstanceName, MinecraftEntityId};
|
use azalea_world::{Instance, InstanceContainer, InstanceName, MinecraftEntityId};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
|
@ -10,13 +12,11 @@ use bevy_ecs::{
|
||||||
};
|
};
|
||||||
use derive_more::{Deref, DerefMut};
|
use derive_more::{Deref, DerefMut};
|
||||||
use nohash_hasher::IntMap;
|
use nohash_hasher::IntMap;
|
||||||
use std::{collections::HashMap, fmt::Debug};
|
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{EntityUuid, Position};
|
|
||||||
|
|
||||||
use super::LoadedBy;
|
use super::LoadedBy;
|
||||||
|
use crate::{EntityUuid, Position};
|
||||||
|
|
||||||
#[derive(Resource, Default)]
|
#[derive(Resource, Default)]
|
||||||
pub struct EntityUuidIndex {
|
pub struct EntityUuidIndex {
|
||||||
|
|
|
@ -9,6 +9,8 @@ use azalea_world::{InstanceContainer, InstanceName, MinecraftEntityId};
|
||||||
use bevy_app::{App, Plugin, PreUpdate, Update};
|
use bevy_app::{App, Plugin, PreUpdate, Update};
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
use derive_more::{Deref, DerefMut};
|
use derive_more::{Deref, DerefMut};
|
||||||
|
use indexing::EntityUuidIndex;
|
||||||
|
pub use relative_updates::RelativeEntityUpdate;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -16,9 +18,6 @@ use crate::{
|
||||||
Physics, Position,
|
Physics, Position,
|
||||||
};
|
};
|
||||||
|
|
||||||
use indexing::EntityUuidIndex;
|
|
||||||
pub use relative_updates::RelativeEntityUpdate;
|
|
||||||
|
|
||||||
/// A Bevy [`SystemSet`] for various types of entity updates.
|
/// A Bevy [`SystemSet`] for various types of entity updates.
|
||||||
#[derive(SystemSet, Debug, Hash, Eq, PartialEq, Clone)]
|
#[derive(SystemSet, Debug, Hash, Eq, PartialEq, Clone)]
|
||||||
pub enum EntityUpdateSet {
|
pub enum EntityUpdateSet {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use crate::{parse_macro::DeclareMenus, utils::to_pascal_case};
|
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::Ident;
|
use syn::Ident;
|
||||||
|
|
||||||
|
use crate::{parse_macro::DeclareMenus, utils::to_pascal_case};
|
||||||
|
|
||||||
pub fn generate(input: &DeclareMenus) -> TokenStream {
|
pub fn generate(input: &DeclareMenus) -> TokenStream {
|
||||||
// pub enum MenuLocation {
|
// pub enum MenuLocation {
|
||||||
// Player(PlayerMenuLocation),
|
// Player(PlayerMenuLocation),
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
//! Generate the `enum menu` and nothing else. Implementations are in
|
//! Generate the `enum menu` and nothing else. Implementations are in
|
||||||
//! impl_menu.rs
|
//! impl_menu.rs
|
||||||
|
|
||||||
use crate::parse_macro::{DeclareMenus, Field, Menu};
|
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
|
||||||
|
use crate::parse_macro::{DeclareMenus, Field, Menu};
|
||||||
|
|
||||||
pub fn generate(input: &DeclareMenus) -> TokenStream {
|
pub fn generate(input: &DeclareMenus) -> TokenStream {
|
||||||
let mut variants = quote! {};
|
let mut variants = quote! {};
|
||||||
let mut player_fields = None;
|
let mut player_fields = None;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
|
use syn::Ident;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
parse_macro::{DeclareMenus, Menu},
|
parse_macro::{DeclareMenus, Menu},
|
||||||
utils::{to_pascal_case, to_snake_case},
|
utils::{to_pascal_case, to_snake_case},
|
||||||
};
|
};
|
||||||
use proc_macro2::TokenStream;
|
|
||||||
use quote::quote;
|
|
||||||
use syn::Ident;
|
|
||||||
|
|
||||||
pub fn generate(input: &DeclareMenus) -> TokenStream {
|
pub fn generate(input: &DeclareMenus) -> TokenStream {
|
||||||
let mut slot_mut_match_variants = quote! {};
|
let mut slot_mut_match_variants = quote! {};
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
|
||||||
use azalea_registry::DataComponentKind;
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fmt,
|
fmt,
|
||||||
io::{Cursor, Write},
|
io::{Cursor, Write},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||||
|
use azalea_registry::DataComponentKind;
|
||||||
|
|
||||||
use crate::components::{self};
|
use crate::components::{self};
|
||||||
|
|
||||||
/// Either an item in an inventory or nothing.
|
/// Either an item in an inventory or nothing.
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
pub static STORAGE: Lazy<HashMap<String, String>> =
|
pub static STORAGE: Lazy<HashMap<String, String>> =
|
||||||
Lazy::new(|| serde_json::from_str(include_str!("en_us.json")).unwrap());
|
Lazy::new(|| serde_json::from_str(include_str!("en_us.json")).unwrap());
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
#![allow(clippy::explicit_auto_deref)]
|
#![allow(clippy::explicit_auto_deref)]
|
||||||
#![allow(clippy::redundant_closure)]
|
#![allow(clippy::redundant_closure)]
|
||||||
|
|
||||||
use super::VoxelShape;
|
|
||||||
use crate::collision::{self, Shapes};
|
|
||||||
use azalea_block::*;
|
use azalea_block::*;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
use super::VoxelShape;
|
||||||
|
use crate::collision::{self, Shapes};
|
||||||
|
|
||||||
pub trait BlockWithShape {
|
pub trait BlockWithShape {
|
||||||
fn shape(&self) -> &'static VoxelShape;
|
fn shape(&self) -> &'static VoxelShape;
|
||||||
/// Tells you whether the block has an empty shape.
|
/// Tells you whether the block has an empty shape.
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use std::cmp::{self, Ordering};
|
use std::cmp::{self, Ordering};
|
||||||
|
|
||||||
use super::CubePointRange;
|
|
||||||
use azalea_core::math::{gcd, lcm, EPSILON};
|
use azalea_core::math::{gcd, lcm, EPSILON};
|
||||||
|
|
||||||
|
use super::CubePointRange;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum IndexMerger {
|
pub enum IndexMerger {
|
||||||
Identical {
|
Identical {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
use super::mergers::IndexMerger;
|
use std::{cmp, num::NonZeroU32, sync::LazyLock};
|
||||||
use crate::collision::{BitSetDiscreteVoxelShape, DiscreteVoxelShape, AABB};
|
|
||||||
use azalea_core::{
|
use azalea_core::{
|
||||||
block_hit_result::BlockHitResult,
|
block_hit_result::BlockHitResult,
|
||||||
direction::{Axis, AxisCycle, Direction},
|
direction::{Axis, AxisCycle, Direction},
|
||||||
math::{binary_search, EPSILON},
|
math::{binary_search, EPSILON},
|
||||||
position::{BlockPos, Vec3},
|
position::{BlockPos, Vec3},
|
||||||
};
|
};
|
||||||
use std::{cmp, num::NonZeroU32, sync::LazyLock};
|
|
||||||
|
use super::mergers::IndexMerger;
|
||||||
|
use crate::collision::{BitSetDiscreteVoxelShape, DiscreteVoxelShape, AABB};
|
||||||
|
|
||||||
pub struct Shapes;
|
pub struct Shapes;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::{Shapes, BLOCK_SHAPE};
|
use std::sync::Arc;
|
||||||
use crate::collision::{BlockWithShape, VoxelShape, AABB};
|
|
||||||
use azalea_block::BlockState;
|
use azalea_block::BlockState;
|
||||||
use azalea_core::{
|
use azalea_core::{
|
||||||
cursor3d::{Cursor3d, CursorIterationType},
|
cursor3d::{Cursor3d, CursorIterationType},
|
||||||
|
@ -8,7 +8,9 @@ use azalea_core::{
|
||||||
};
|
};
|
||||||
use azalea_world::{Chunk, Instance};
|
use azalea_world::{Chunk, Instance};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use std::sync::Arc;
|
|
||||||
|
use super::{Shapes, BLOCK_SHAPE};
|
||||||
|
use crate::collision::{BlockWithShape, VoxelShape, AABB};
|
||||||
|
|
||||||
pub fn get_block_collisions(world: &Instance, aabb: AABB) -> Vec<VoxelShape> {
|
pub fn get_block_collisions(world: &Instance, aabb: AABB) -> Vec<VoxelShape> {
|
||||||
let mut state = BlockCollisionsState::new(world, aabb);
|
let mut state = BlockCollisionsState::new(world, aabb);
|
||||||
|
|
|
@ -422,12 +422,13 @@ fn jump_boost_power() -> f64 {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use super::*;
|
|
||||||
use azalea_core::{position::ChunkPos, resource_location::ResourceLocation};
|
use azalea_core::{position::ChunkPos, resource_location::ResourceLocation};
|
||||||
use azalea_entity::{EntityBundle, EntityPlugin};
|
use azalea_entity::{EntityBundle, EntityPlugin};
|
||||||
use azalea_world::{Chunk, MinecraftEntityId, PartialInstance};
|
use azalea_world::{Chunk, MinecraftEntityId, PartialInstance};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
/// You need an app to spawn entities in the world and do updates.
|
/// You need an app to spawn entities in the world and do updates.
|
||||||
fn make_test_app() -> App {
|
fn make_test_app() -> App {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
//! A "simple" server that gets login information and proxies connections.
|
//! A "simple" server that gets login information and proxies connections.
|
||||||
//! After login all connections are encrypted and Azalea cannot read them.
|
//! After login all connections are encrypted and Azalea cannot read them.
|
||||||
|
|
||||||
|
use std::error::Error;
|
||||||
|
|
||||||
use azalea_protocol::{
|
use azalea_protocol::{
|
||||||
connect::Connection,
|
connect::Connection,
|
||||||
packets::{
|
packets::{
|
||||||
|
@ -22,7 +24,6 @@ use azalea_protocol::{
|
||||||
};
|
};
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use std::error::Error;
|
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{self, AsyncWriteExt},
|
io::{self, AsyncWriteExt},
|
||||||
net::{TcpListener, TcpStream},
|
net::{TcpListener, TcpStream},
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
//! Connect to remote servers/clients.
|
//! Connect to remote servers/clients.
|
||||||
|
|
||||||
|
use std::fmt::Debug;
|
||||||
|
use std::io::Cursor;
|
||||||
|
use std::marker::PhantomData;
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
|
use azalea_auth::game_profile::GameProfile;
|
||||||
|
use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError};
|
||||||
|
use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
|
||||||
|
use bytes::BytesMut;
|
||||||
|
use thiserror::Error;
|
||||||
|
use tokio::io::{AsyncWriteExt, BufStream};
|
||||||
|
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError};
|
||||||
|
use tokio::net::TcpStream;
|
||||||
|
use tracing::{error, info};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::packets::configuration::{
|
use crate::packets::configuration::{
|
||||||
ClientboundConfigurationPacket, ServerboundConfigurationPacket,
|
ClientboundConfigurationPacket, ServerboundConfigurationPacket,
|
||||||
};
|
};
|
||||||
|
@ -11,20 +27,6 @@ use crate::packets::status::{ClientboundStatusPacket, ServerboundStatusPacket};
|
||||||
use crate::packets::ProtocolPacket;
|
use crate::packets::ProtocolPacket;
|
||||||
use crate::read::{deserialize_packet, read_raw_packet, try_read_raw_packet, ReadPacketError};
|
use crate::read::{deserialize_packet, read_raw_packet, try_read_raw_packet, ReadPacketError};
|
||||||
use crate::write::{serialize_packet, write_raw_packet};
|
use crate::write::{serialize_packet, write_raw_packet};
|
||||||
use azalea_auth::game_profile::GameProfile;
|
|
||||||
use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError};
|
|
||||||
use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
|
|
||||||
use bytes::BytesMut;
|
|
||||||
use std::fmt::Debug;
|
|
||||||
use std::io::Cursor;
|
|
||||||
use std::marker::PhantomData;
|
|
||||||
use std::net::SocketAddr;
|
|
||||||
use thiserror::Error;
|
|
||||||
use tokio::io::{AsyncWriteExt, BufStream};
|
|
||||||
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError};
|
|
||||||
use tokio::net::TcpStream;
|
|
||||||
use tracing::{error, info};
|
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
pub struct RawReadConnection {
|
pub struct RawReadConnection {
|
||||||
pub read_stream: OwnedReadHalf,
|
pub read_stream: OwnedReadHalf,
|
||||||
|
|
|
@ -103,6 +103,9 @@ impl serde::Serialize for ServerAddress {
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
|
use bytes::BytesMut;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
packets::{
|
packets::{
|
||||||
game::serverbound_chat_packet::{LastSeenMessagesUpdate, ServerboundChatPacket},
|
game::serverbound_chat_packet::{LastSeenMessagesUpdate, ServerboundChatPacket},
|
||||||
|
@ -111,8 +114,6 @@ mod tests {
|
||||||
read::{compression_decoder, read_packet},
|
read::{compression_decoder, read_packet},
|
||||||
write::{compression_encoder, serialize_packet, write_packet},
|
write::{compression_encoder, serialize_packet, write_packet},
|
||||||
};
|
};
|
||||||
use bytes::BytesMut;
|
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_hello_packet() {
|
async fn test_hello_packet() {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
use std::io::Cursor;
|
||||||
|
use std::ops::Deref;
|
||||||
|
use std::{collections::HashMap, io::Write};
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable};
|
use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable};
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use azalea_protocol_macros::ClientboundConfigurationPacket;
|
use azalea_protocol_macros::ClientboundConfigurationPacket;
|
||||||
use std::io::Cursor;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::{collections::HashMap, io::Write};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
|
||||||
pub struct ClientboundUpdateTagsPacket {
|
pub struct ClientboundUpdateTagsPacket {
|
||||||
|
|
|
@ -146,9 +146,10 @@ impl McBufWritable for ModelCustomization {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_client_information_packet() {
|
fn test_client_information_packet() {
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundAwardStatsPacket {
|
pub struct ClientboundAwardStatsPacket {
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
use std::io::Cursor;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
use azalea_buf::{
|
use azalea_buf::{
|
||||||
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
||||||
};
|
};
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
use azalea_core::bitset::FixedBitSet;
|
use azalea_core::bitset::FixedBitSet;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::Cursor;
|
|
||||||
use std::io::Write;
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
|
|
|
@ -11,10 +11,12 @@ pub struct ClientboundCommandSuggestionsPacket {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use azalea_brigadier::{context::StringRange, suggestion::Suggestion};
|
use azalea_brigadier::{context::StringRange, suggestion::Suggestion};
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
use std::io::Cursor;
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_suggestions() {
|
fn test_suggestions() {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{
|
use azalea_buf::{
|
||||||
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
||||||
};
|
};
|
||||||
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
|
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use super::clientbound_player_chat_packet::PackedMessageSignature;
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
|
|
||||||
|
use super::clientbound_player_chat_packet::PackedMessageSignature;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundDeleteChatPacket {
|
pub struct ClientboundDeleteChatPacket {
|
||||||
pub signature: PackedMessageSignature,
|
pub signature: PackedMessageSignature,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use super::clientbound_player_chat_packet::ChatTypeBound;
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_chat::{
|
use azalea_chat::{
|
||||||
translatable_component::{StringOrComponent, TranslatableComponent},
|
translatable_component::{StringOrComponent, TranslatableComponent},
|
||||||
|
@ -6,6 +5,8 @@ use azalea_chat::{
|
||||||
};
|
};
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
|
|
||||||
|
use super::clientbound_player_chat_packet::ChatTypeBound;
|
||||||
|
|
||||||
// A disguised chat packet is basically the same as a normal
|
// A disguised chat packet is basically the same as a normal
|
||||||
// [`ClientboundPlayerChatPacket`], except that it doesn't have any of the chat
|
// [`ClientboundPlayerChatPacket`], except that it doesn't have any of the chat
|
||||||
// signing things. Vanilla servers use this when messages are sent from the
|
// signing things. Vanilla servers use this when messages are sent from the
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::packets::common::CommonPlayerSpawnInfo;
|
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
|
|
||||||
|
use crate::packets::common::CommonPlayerSpawnInfo;
|
||||||
|
|
||||||
/// The first packet sent by the server to the client after login.
|
/// The first packet sent by the server to the client after login.
|
||||||
///
|
///
|
||||||
/// This packet contains information about the state of the player, the
|
/// This packet contains information about the state of the player, the
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use super::serverbound_interact_packet::InteractionHand;
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
|
|
||||||
|
use super::serverbound_interact_packet::InteractionHand;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundOpenBookPacket {
|
pub struct ClientboundOpenBookPacket {
|
||||||
pub hand: InteractionHand,
|
pub hand: InteractionHand,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBuf};
|
use azalea_buf::{BufReadError, McBuf};
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
use azalea_core::bitset::FixedBitSet;
|
use azalea_core::bitset::FixedBitSet;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundPlayerAbilitiesPacket {
|
pub struct ClientboundPlayerAbilitiesPacket {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{
|
use azalea_buf::{
|
||||||
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
||||||
};
|
};
|
||||||
|
@ -8,7 +10,6 @@ use azalea_chat::{
|
||||||
use azalea_core::bitset::BitSet;
|
use azalea_core::bitset::BitSet;
|
||||||
use azalea_crypto::MessageSignature;
|
use azalea_crypto::MessageSignature;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)]
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
use std::{
|
||||||
|
collections::HashMap,
|
||||||
|
io::{Cursor, Write},
|
||||||
|
};
|
||||||
|
|
||||||
use azalea_auth::game_profile::{GameProfile, ProfilePropertyValue};
|
use azalea_auth::game_profile::{GameProfile, ProfilePropertyValue};
|
||||||
use azalea_buf::{
|
use azalea_buf::{
|
||||||
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
|
||||||
|
@ -5,10 +10,6 @@ use azalea_buf::{
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
use azalea_core::{bitset::FixedBitSet, game_type::GameMode};
|
use azalea_core::{bitset::FixedBitSet, game_type::GameMode};
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::{
|
|
||||||
collections::HashMap,
|
|
||||||
io::{Cursor, Write},
|
|
||||||
};
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::serverbound_chat_session_update_packet::RemoteChatSessionData;
|
use super::serverbound_chat_session_update_packet::RemoteChatSessionData;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::io::Cursor;
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBuf};
|
use azalea_buf::{BufReadError, McBuf};
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
use azalea_inventory::ItemSlot;
|
use azalea_inventory::ItemSlot;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::Cursor;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundSetEquipmentPacket {
|
pub struct ClientboundSetEquipmentPacket {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
|
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
|
||||||
use azalea_chat::{style::ChatFormatting, FormattedText};
|
use azalea_chat::{style::ChatFormatting, FormattedText};
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundSetPlayerTeamPacket {
|
pub struct ClientboundSetPlayerTeamPacket {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
||||||
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
|
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
|
||||||
use super::clientbound_sound_packet::SoundSource;
|
use super::clientbound_sound_packet::SoundSource;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::io::Cursor;
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use azalea_inventory::ItemSlot;
|
use azalea_inventory::ItemSlot;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::io::Cursor;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundUpdateAdvancementsPacket {
|
pub struct ClientboundUpdateAdvancementsPacket {
|
||||||
|
@ -117,9 +118,10 @@ pub struct AdvancementHolder {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
let packet = ClientboundUpdateAdvancementsPacket {
|
let packet = ClientboundUpdateAdvancementsPacket {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
use std::io::Cursor;
|
||||||
|
use std::ops::Deref;
|
||||||
|
use std::{collections::HashMap, io::Write};
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable};
|
use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable};
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use azalea_protocol_macros::ClientboundGamePacket;
|
use azalea_protocol_macros::ClientboundGamePacket;
|
||||||
use std::io::Cursor;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::{collections::HashMap, io::Write};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
|
||||||
pub struct ClientboundUpdateTagsPacket {
|
pub struct ClientboundUpdateTagsPacket {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use super::serverbound_chat_packet::LastSeenMessagesUpdate;
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_crypto::MessageSignature;
|
use azalea_crypto::MessageSignature;
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
|
|
||||||
|
use super::serverbound_chat_packet::LastSeenMessagesUpdate;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundChatCommandSignedPacket {
|
pub struct ServerboundChatCommandSignedPacket {
|
||||||
pub command: String,
|
pub command: String,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_inventory::{operations::ClickType, ItemSlot};
|
use azalea_inventory::{operations::ClickType, ItemSlot};
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundContainerClickPacket {
|
pub struct ServerboundContainerClickPacket {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::packets::BufReadError;
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||||
use azalea_core::position::Vec3;
|
use azalea_core::position::Vec3;
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
use crate::packets::BufReadError;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundInteractPacket {
|
pub struct ServerboundInteractPacket {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::packets::BufReadError;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
use azalea_core::bitset::FixedBitSet;
|
use azalea_core::bitset::FixedBitSet;
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::io::Cursor;
|
|
||||||
|
use crate::packets::BufReadError;
|
||||||
|
|
||||||
#[derive(Clone, Debug, ServerboundGamePacket)]
|
#[derive(Clone, Debug, ServerboundGamePacket)]
|
||||||
pub struct ServerboundPlayerAbilitiesPacket {
|
pub struct ServerboundPlayerAbilitiesPacket {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::packets::BufReadError;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use azalea_buf::{McBuf, McBufReadable, McBufWritable};
|
use azalea_buf::{McBuf, McBufReadable, McBufWritable};
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::io::Cursor;
|
|
||||||
|
use crate::packets::BufReadError;
|
||||||
|
|
||||||
#[derive(Clone, Debug, ServerboundGamePacket)]
|
#[derive(Clone, Debug, ServerboundGamePacket)]
|
||||||
pub struct ServerboundSeenAdvancementsPacket {
|
pub struct ServerboundSeenAdvancementsPacket {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::packets::McBufWritable;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBuf, McBufReadable};
|
use azalea_buf::{BufReadError, McBuf, McBufReadable};
|
||||||
use azalea_core::{bitset::FixedBitSet, position::BlockPos};
|
use azalea_core::{bitset::FixedBitSet, position::BlockPos};
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::io::Cursor;
|
|
||||||
|
use crate::packets::McBufWritable;
|
||||||
|
|
||||||
#[derive(Clone, Debug, ServerboundGamePacket)]
|
#[derive(Clone, Debug, ServerboundGamePacket)]
|
||||||
pub struct ServerboundSetCommandBlockPacket {
|
pub struct ServerboundSetCommandBlockPacket {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
use crate::packets::BufReadError;
|
use std::io::Cursor;
|
||||||
use crate::packets::McBufWritable;
|
use std::io::Write;
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_buf::McBufReadable;
|
use azalea_buf::McBufReadable;
|
||||||
use azalea_core::position::BlockPos;
|
use azalea_core::position::BlockPos;
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::io::Cursor;
|
|
||||||
use std::io::Write;
|
use crate::packets::BufReadError;
|
||||||
|
use crate::packets::McBufWritable;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundSetJigsawBlockPacket {
|
pub struct ServerboundSetJigsawBlockPacket {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use crate::packets::BufReadError;
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
use azalea_core::{bitset::FixedBitSet, position::BlockPos};
|
use azalea_core::{bitset::FixedBitSet, position::BlockPos};
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
use crate::packets::BufReadError;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundSetStructureBlockPacket {
|
pub struct ServerboundSetStructureBlockPacket {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::packets::game::serverbound_interact_packet::InteractionHand;
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
|
|
||||||
|
use crate::packets::game::serverbound_interact_packet::InteractionHand;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundSwingPacket {
|
pub struct ServerboundSwingPacket {
|
||||||
pub hand: InteractionHand,
|
pub hand: InteractionHand,
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::packets::game::serverbound_interact_packet::InteractionHand;
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
|
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
|
||||||
use azalea_core::{
|
use azalea_core::{
|
||||||
direction::Direction,
|
direction::Direction,
|
||||||
position::{BlockPos, Vec3},
|
position::{BlockPos, Vec3},
|
||||||
};
|
};
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
use crate::packets::game::serverbound_interact_packet::InteractionHand;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundUseItemOnPacket {
|
pub struct ServerboundUseItemOnPacket {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::packets::game::serverbound_interact_packet::InteractionHand;
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_protocol_macros::ServerboundGamePacket;
|
use azalea_protocol_macros::ServerboundGamePacket;
|
||||||
|
|
||||||
|
use crate::packets::game::serverbound_interact_packet::InteractionHand;
|
||||||
|
|
||||||
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
|
||||||
pub struct ServerboundUseItemPacket {
|
pub struct ServerboundUseItemPacket {
|
||||||
pub hand: InteractionHand,
|
pub hand: InteractionHand,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::packets::ClientIntention;
|
use std::hash::Hash;
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_protocol_macros::ServerboundHandshakePacket;
|
use azalea_protocol_macros::ServerboundHandshakePacket;
|
||||||
use std::hash::Hash;
|
|
||||||
|
use crate::packets::ClientIntention;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, McBuf, ServerboundHandshakePacket)]
|
#[derive(Hash, Clone, Debug, McBuf, ServerboundHandshakePacket)]
|
||||||
pub struct ClientIntentionPacket {
|
pub struct ClientIntentionPacket {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
use std::hash::Hash;
|
||||||
|
|
||||||
use azalea_buf::{McBuf, UnsizedByteArray};
|
use azalea_buf::{McBuf, UnsizedByteArray};
|
||||||
use azalea_core::resource_location::ResourceLocation;
|
use azalea_core::resource_location::ResourceLocation;
|
||||||
use azalea_protocol_macros::ClientboundLoginPacket;
|
use azalea_protocol_macros::ClientboundLoginPacket;
|
||||||
use std::hash::Hash;
|
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, McBuf, ClientboundLoginPacket)]
|
#[derive(Hash, Clone, Debug, McBuf, ClientboundLoginPacket)]
|
||||||
pub struct ClientboundCustomQueryPacket {
|
pub struct ClientboundCustomQueryPacket {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
use std::hash::Hash;
|
||||||
|
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use azalea_protocol_macros::ClientboundLoginPacket;
|
use azalea_protocol_macros::ClientboundLoginPacket;
|
||||||
use std::hash::Hash;
|
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, ClientboundLoginPacket, McBuf)]
|
#[derive(Hash, Clone, Debug, ClientboundLoginPacket, McBuf)]
|
||||||
pub struct ClientboundLoginCompressionPacket {
|
pub struct ClientboundLoginCompressionPacket {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
use std::hash::Hash;
|
||||||
|
|
||||||
use azalea_buf::{McBuf, UnsizedByteArray};
|
use azalea_buf::{McBuf, UnsizedByteArray};
|
||||||
use azalea_protocol_macros::ServerboundLoginPacket;
|
use azalea_protocol_macros::ServerboundLoginPacket;
|
||||||
use std::hash::Hash;
|
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, McBuf, ServerboundLoginPacket)]
|
#[derive(Hash, Clone, Debug, McBuf, ServerboundLoginPacket)]
|
||||||
pub struct ServerboundCustomQueryAnswerPacket {
|
pub struct ServerboundCustomQueryAnswerPacket {
|
||||||
|
|
|
@ -12,9 +12,10 @@ pub struct ServerboundHelloPacket {
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use super::*;
|
|
||||||
use azalea_buf::{McBufReadable, McBufWritable};
|
use azalea_buf::{McBufReadable, McBufWritable};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_read_write() {
|
fn test_read_write() {
|
||||||
let packet = ServerboundHelloPacket {
|
let packet = ServerboundHelloPacket {
|
||||||
|
|
|
@ -5,10 +5,12 @@ pub mod handshaking;
|
||||||
pub mod login;
|
pub mod login;
|
||||||
pub mod status;
|
pub mod status;
|
||||||
|
|
||||||
use crate::read::ReadPacketError;
|
|
||||||
use azalea_buf::{BufReadError, McBufVarReadable, McBufVarWritable, McBufWritable};
|
|
||||||
use std::io::{Cursor, Write};
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
|
use azalea_buf::{BufReadError, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||||
|
|
||||||
|
use crate::read::ReadPacketError;
|
||||||
|
|
||||||
// TODO: rename the packet files to just like clientbound_add_entity instead of
|
// TODO: rename the packet files to just like clientbound_add_entity instead of
|
||||||
// clientbound_add_entity_packet
|
// clientbound_add_entity_packet
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use std::io::{Cursor, Write};
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
use azalea_protocol_macros::ClientboundStatusPacket;
|
use azalea_protocol_macros::ClientboundStatusPacket;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::value::Serializer;
|
use serde_json::value::Serializer;
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct Version {
|
pub struct Version {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue