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