mirror of
https://github.com/italicsjenga/valence.git
synced 2025-01-11 07:11:30 +11:00
Re-export common items at the root of valence_protocol (#156)
This commit is contained in:
parent
74e4f10ec5
commit
ab2e1081ed
|
@ -15,7 +15,6 @@ use tokio::net::{TcpListener, TcpStream};
|
||||||
use tokio::sync::Semaphore;
|
use tokio::sync::Semaphore;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
use valence_protocol::codec::{PacketDecoder, PacketEncoder};
|
|
||||||
use valence_protocol::packets::c2s::handshake::Handshake;
|
use valence_protocol::packets::c2s::handshake::Handshake;
|
||||||
use valence_protocol::packets::c2s::login::{EncryptionResponse, LoginStart};
|
use valence_protocol::packets::c2s::login::{EncryptionResponse, LoginStart};
|
||||||
use valence_protocol::packets::c2s::play::C2sPlayPacket;
|
use valence_protocol::packets::c2s::play::C2sPlayPacket;
|
||||||
|
@ -24,7 +23,7 @@ use valence_protocol::packets::s2c::login::{LoginSuccess, S2cLoginPacket};
|
||||||
use valence_protocol::packets::s2c::play::S2cPlayPacket;
|
use valence_protocol::packets::s2c::play::S2cPlayPacket;
|
||||||
use valence_protocol::packets::s2c::status::{PingResponse, StatusResponse};
|
use valence_protocol::packets::s2c::status::{PingResponse, StatusResponse};
|
||||||
use valence_protocol::types::HandshakeNextState;
|
use valence_protocol::types::HandshakeNextState;
|
||||||
use valence_protocol::{Decode, Encode, Packet};
|
use valence_protocol::{Decode, Encode, Packet, PacketDecoder, PacketEncoder};
|
||||||
|
|
||||||
#[derive(Parser, Clone, Debug)]
|
#[derive(Parser, Clone, Debug)]
|
||||||
#[clap(author, version, about)]
|
#[clap(author, version, about)]
|
||||||
|
|
|
@ -14,14 +14,10 @@ use std::iter::FusedIterator;
|
||||||
use paletted_container::PalettedContainer;
|
use paletted_container::PalettedContainer;
|
||||||
use rayon::iter::{IntoParallelRefIterator, IntoParallelRefMutIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelRefIterator, IntoParallelRefMutIterator, ParallelIterator};
|
||||||
use valence_nbt::compound;
|
use valence_nbt::compound;
|
||||||
use valence_protocol::block::BlockState;
|
|
||||||
use valence_protocol::block_pos::BlockPos;
|
|
||||||
use valence_protocol::packets::s2c::play::{
|
use valence_protocol::packets::s2c::play::{
|
||||||
BlockUpdate, ChunkDataAndUpdateLight, UpdateSectionBlocks,
|
BlockUpdate, ChunkDataAndUpdateLight, UpdateSectionBlocks,
|
||||||
};
|
};
|
||||||
use valence_protocol::var_int::VarInt;
|
use valence_protocol::{BlockPos, BlockState, Encode, VarInt, VarLong};
|
||||||
use valence_protocol::var_long::VarLong;
|
|
||||||
use valence_protocol::Encode;
|
|
||||||
|
|
||||||
use crate::biome::BiomeId;
|
use crate::biome::BiomeId;
|
||||||
pub use crate::chunk_pos::ChunkPos;
|
pub use crate::chunk_pos::ChunkPos;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use valence_protocol::block_pos::BlockPos;
|
use valence_protocol::BlockPos;
|
||||||
|
|
||||||
/// The X and Z position of a chunk in a world.
|
/// The X and Z position of a chunk in a world.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
|
|
|
@ -10,10 +10,6 @@ pub use bitfield_struct::bitfield;
|
||||||
pub use event::*;
|
pub use event::*;
|
||||||
use rayon::iter::ParallelIterator;
|
use rayon::iter::ParallelIterator;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use valence_protocol::block_pos::BlockPos;
|
|
||||||
use valence_protocol::byte_angle::ByteAngle;
|
|
||||||
use valence_protocol::ident::Ident;
|
|
||||||
use valence_protocol::item::ItemStack;
|
|
||||||
use valence_protocol::packets::c2s::play::ClientCommand;
|
use valence_protocol::packets::c2s::play::ClientCommand;
|
||||||
use valence_protocol::packets::s2c::play::{
|
use valence_protocol::packets::s2c::play::{
|
||||||
AcknowledgeBlockChange, ClearTitles, CombatDeath, CustomSoundEffect, DisconnectPlay,
|
AcknowledgeBlockChange, ClearTitles, CombatDeath, CustomSoundEffect, DisconnectPlay,
|
||||||
|
@ -26,15 +22,14 @@ use valence_protocol::packets::s2c::play::{
|
||||||
UpdateEntityPositionAndRotation, UpdateEntityRotation, UpdateTime,
|
UpdateEntityPositionAndRotation, UpdateEntityRotation, UpdateTime,
|
||||||
};
|
};
|
||||||
use valence_protocol::packets::C2sPlayPacket;
|
use valence_protocol::packets::C2sPlayPacket;
|
||||||
use valence_protocol::raw_bytes::RawBytes;
|
|
||||||
use valence_protocol::text::Text;
|
|
||||||
use valence_protocol::types::{
|
use valence_protocol::types::{
|
||||||
Action, AttributeProperty, GameMode, GameStateChangeReason, SoundCategory,
|
Action, AttributeProperty, GameMode, GameStateChangeReason, SoundCategory,
|
||||||
SyncPlayerPosLookFlags,
|
SyncPlayerPosLookFlags,
|
||||||
};
|
};
|
||||||
use valence_protocol::username::Username;
|
use valence_protocol::{
|
||||||
use valence_protocol::var_int::VarInt;
|
ident, types, BlockPos, ByteAngle, Encode, Ident, ItemStack, Packet, RawBytes, Text, Username,
|
||||||
use valence_protocol::{ident, types, Encode, Packet};
|
VarInt,
|
||||||
|
};
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
|
|
||||||
use crate::chunk_pos::ChunkPos;
|
use crate::chunk_pos::ChunkPos;
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use valence_protocol::block::BlockFace;
|
|
||||||
use valence_protocol::block_pos::BlockPos;
|
|
||||||
use valence_protocol::entity_meta::Pose;
|
use valence_protocol::entity_meta::Pose;
|
||||||
use valence_protocol::ident::Ident;
|
|
||||||
use valence_protocol::item::ItemStack;
|
|
||||||
use valence_protocol::packets::c2s::play::ResourcePackC2s;
|
use valence_protocol::packets::c2s::play::ResourcePackC2s;
|
||||||
use valence_protocol::types::{
|
use valence_protocol::types::{
|
||||||
ChatMode, ClickContainerMode, DisplayedSkinParts, EntityInteraction, Hand, MainHand,
|
ChatMode, ClickContainerMode, DisplayedSkinParts, EntityInteraction, Hand, MainHand,
|
||||||
};
|
};
|
||||||
use valence_protocol::var_int::VarInt;
|
use valence_protocol::{BlockFace, BlockPos, Ident, ItemStack, VarInt};
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
|
|
||||||
use super::Client;
|
use super::Client;
|
||||||
|
|
|
@ -9,13 +9,11 @@ use bitfield_struct::bitfield;
|
||||||
pub use data::{EntityKind, TrackedData};
|
pub use data::{EntityKind, TrackedData};
|
||||||
use rayon::iter::ParallelIterator;
|
use rayon::iter::ParallelIterator;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use valence_protocol::byte_angle::ByteAngle;
|
|
||||||
use valence_protocol::entity_meta::{Facing, PaintingKind, Pose};
|
use valence_protocol::entity_meta::{Facing, PaintingKind, Pose};
|
||||||
use valence_protocol::packets::s2c::play::{
|
use valence_protocol::packets::s2c::play::{
|
||||||
SetEntityMetadata, SetHeadRotation, SpawnEntity, SpawnExperienceOrb, SpawnPlayer,
|
SetEntityMetadata, SetHeadRotation, SpawnEntity, SpawnExperienceOrb, SpawnPlayer,
|
||||||
};
|
};
|
||||||
use valence_protocol::raw_bytes::RawBytes;
|
use valence_protocol::{ByteAngle, RawBytes, VarInt};
|
||||||
use valence_protocol::var_int::VarInt;
|
|
||||||
use vek::{Aabb, Vec3};
|
use vek::{Aabb, Vec3};
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
|
|
@ -3,11 +3,7 @@
|
||||||
#![allow(clippy::all, missing_docs, trivial_numeric_casts)]
|
#![allow(clippy::all, missing_docs, trivial_numeric_casts)]
|
||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use valence_protocol::block::BlockState;
|
|
||||||
use valence_protocol::block_pos::BlockPos;
|
|
||||||
use valence_protocol::entity_meta::*;
|
use valence_protocol::entity_meta::*;
|
||||||
use valence_protocol::text::Text;
|
use valence_protocol::{BlockPos, BlockState, Encode, Text, VarInt};
|
||||||
use valence_protocol::var_int::VarInt;
|
|
||||||
use valence_protocol::Encode;
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/entity.rs"));
|
include!(concat!(env!("OUT_DIR"), "/entity.rs"));
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use valence_protocol::item::ItemStack;
|
use valence_protocol::{ItemStack, VarInt};
|
||||||
use valence_protocol::var_int::VarInt;
|
|
||||||
|
|
||||||
use crate::slab_versioned::{Key, VersionedSlab};
|
use crate::slab_versioned::{Key, VersionedSlab};
|
||||||
|
|
||||||
|
@ -277,7 +276,7 @@ pub struct InventoryError;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use valence_protocol::item::{ItemKind, ItemStack};
|
use valence_protocol::{ItemKind, ItemStack};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -140,16 +140,16 @@ pub mod prelude {
|
||||||
};
|
};
|
||||||
pub use uuid::Uuid;
|
pub use uuid::Uuid;
|
||||||
pub use valence_nbt::Compound;
|
pub use valence_nbt::Compound;
|
||||||
pub use valence_protocol::block::{BlockKind, BlockState, PropName, PropValue};
|
pub use valence_protocol::block::{PropName, PropValue};
|
||||||
pub use valence_protocol::block_pos::BlockPos;
|
|
||||||
pub use valence_protocol::entity_meta::Pose;
|
pub use valence_protocol::entity_meta::Pose;
|
||||||
pub use valence_protocol::ident::{Ident, IdentError};
|
pub use valence_protocol::ident::IdentError;
|
||||||
pub use valence_protocol::item::{ItemKind, ItemStack};
|
|
||||||
pub use valence_protocol::packets::s2c::play::SetTitleAnimationTimes;
|
pub use valence_protocol::packets::s2c::play::SetTitleAnimationTimes;
|
||||||
pub use valence_protocol::text::{Color, Text, TextFormat};
|
pub use valence_protocol::text::Color;
|
||||||
pub use valence_protocol::types::{GameMode, Hand, SoundCategory};
|
pub use valence_protocol::types::{GameMode, Hand, SoundCategory};
|
||||||
pub use valence_protocol::username::Username;
|
pub use valence_protocol::{
|
||||||
pub use valence_protocol::{ident, MINECRAFT_VERSION, PROTOCOL_VERSION};
|
ident, BlockKind, BlockPos, BlockState, Ident, ItemKind, ItemStack, Text, TextFormat,
|
||||||
|
Username, MINECRAFT_VERSION, PROTOCOL_VERSION,
|
||||||
|
};
|
||||||
pub use vek::{Aabb, Mat2, Mat3, Mat4, Vec2, Vec3, Vec4};
|
pub use vek::{Aabb, Mat2, Mat3, Mat4, Vec2, Vec3, Vec4};
|
||||||
pub use world::{World, WorldId, WorldMeta, Worlds};
|
pub use world::{World, WorldId, WorldMeta, Worlds};
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,15 @@ use tokio::runtime::{Handle, Runtime};
|
||||||
use tokio::sync::Semaphore;
|
use tokio::sync::Semaphore;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use valence_nbt::{compound, Compound, List};
|
use valence_nbt::{compound, Compound, List};
|
||||||
use valence_protocol::codec::{PacketDecoder, PacketEncoder};
|
|
||||||
use valence_protocol::packets::c2s::handshake::HandshakeOwned;
|
use valence_protocol::packets::c2s::handshake::HandshakeOwned;
|
||||||
use valence_protocol::packets::c2s::login::LoginStart;
|
use valence_protocol::packets::c2s::login::LoginStart;
|
||||||
use valence_protocol::packets::c2s::status::{PingRequest, StatusRequest};
|
use valence_protocol::packets::c2s::status::{PingRequest, StatusRequest};
|
||||||
use valence_protocol::packets::s2c::login::{DisconnectLogin, LoginSuccess, SetCompression};
|
use valence_protocol::packets::s2c::login::{DisconnectLogin, LoginSuccess, SetCompression};
|
||||||
use valence_protocol::packets::s2c::status::{PingResponse, StatusResponse};
|
use valence_protocol::packets::s2c::status::{PingResponse, StatusResponse};
|
||||||
use valence_protocol::types::HandshakeNextState;
|
use valence_protocol::types::HandshakeNextState;
|
||||||
use valence_protocol::username::Username;
|
use valence_protocol::{
|
||||||
use valence_protocol::var_int::VarInt;
|
ident, PacketDecoder, PacketEncoder, Username, VarInt, MINECRAFT_VERSION, PROTOCOL_VERSION,
|
||||||
use valence_protocol::{ident, MINECRAFT_VERSION, PROTOCOL_VERSION};
|
};
|
||||||
|
|
||||||
use crate::biome::{validate_biomes, Biome, BiomeId};
|
use crate::biome::{validate_biomes, Biome, BiomeId};
|
||||||
use crate::client::{Client, Clients};
|
use crate::client::{Client, Clients};
|
||||||
|
|
|
@ -15,17 +15,12 @@ use sha1::Sha1;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf};
|
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use valence_protocol::ident::Ident;
|
|
||||||
use valence_protocol::packets::c2s::login::{EncryptionResponse, LoginPluginResponse};
|
use valence_protocol::packets::c2s::login::{EncryptionResponse, LoginPluginResponse};
|
||||||
use valence_protocol::packets::s2c::login::{
|
use valence_protocol::packets::s2c::login::{
|
||||||
DisconnectLogin, EncryptionRequest, LoginPluginRequest,
|
DisconnectLogin, EncryptionRequest, LoginPluginRequest,
|
||||||
};
|
};
|
||||||
use valence_protocol::raw_bytes::RawBytes;
|
|
||||||
use valence_protocol::text::Text;
|
|
||||||
use valence_protocol::types::{MsgSigOrVerifyToken, SignedProperty, SignedPropertyOwned};
|
use valence_protocol::types::{MsgSigOrVerifyToken, SignedProperty, SignedPropertyOwned};
|
||||||
use valence_protocol::username::Username;
|
use valence_protocol::{Decode, Ident, RawBytes, Text, Username, VarInt};
|
||||||
use valence_protocol::var_int::VarInt;
|
|
||||||
use valence_protocol::Decode;
|
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::player_textures::SignedPlayerTextures;
|
use crate::player_textures::SignedPlayerTextures;
|
||||||
|
|
|
@ -7,8 +7,7 @@ use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
use valence_protocol::codec::{PacketDecoder, PacketEncoder};
|
use valence_protocol::{Decode, Encode, Packet, PacketDecoder, PacketEncoder};
|
||||||
use valence_protocol::{Decode, Encode, Packet};
|
|
||||||
|
|
||||||
use crate::server::byte_channel::{byte_channel, ByteReceiver, ByteSender, TryRecvError};
|
use crate::server::byte_channel::{byte_channel, ByteReceiver, ByteSender, TryRecvError};
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,7 @@ use std::iter::FusedIterator;
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
|
||||||
use crate::item::ItemKind;
|
use crate::{Decode, Encode, ItemKind, Result, VarInt};
|
||||||
use crate::var_int::VarInt;
|
|
||||||
use crate::{Decode, Encode, Result};
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/block.rs"));
|
include!(concat!(env!("OUT_DIR"), "/block.rs"));
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ use std::io::Write;
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
|
|
||||||
use crate::block::BlockFace;
|
use crate::{BlockFace, Decode, Encode};
|
||||||
use crate::{Decode, Encode};
|
|
||||||
|
|
||||||
/// Represents an absolute block position in world space.
|
/// Represents an absolute block position in world space.
|
||||||
#[derive(Clone, Copy, Default, PartialEq, Eq, Hash, Debug)]
|
#[derive(Clone, Copy, Default, PartialEq, Eq, Hash, Debug)]
|
||||||
|
@ -28,8 +27,7 @@ impl BlockPos {
|
||||||
/// direction.
|
/// direction.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use valence_protocol::block::BlockFace;
|
/// use valence_protocol::{BlockFace, BlockPos};
|
||||||
/// use valence_protocol::block_pos::BlockPos;
|
|
||||||
///
|
///
|
||||||
/// let pos = BlockPos::new(0, 0, 0);
|
/// let pos = BlockPos::new(0, 0, 0);
|
||||||
/// let adj = pos.get_in_direction(BlockFace::South);
|
/// let adj = pos.get_in_direction(BlockFace::South);
|
||||||
|
|
|
@ -18,6 +18,7 @@ use crate::{Decode, Encode, Result};
|
||||||
///
|
///
|
||||||
/// [`EncodedBuf<T>`]: EncodedBuf
|
/// [`EncodedBuf<T>`]: EncodedBuf
|
||||||
/// [^note]: Assuming `T` does not use internal mutability.
|
/// [^note]: Assuming `T` does not use internal mutability.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Cached<T> {
|
pub struct Cached<T> {
|
||||||
val: T,
|
val: T,
|
||||||
buf: EncodedBuf<T>,
|
buf: EncodedBuf<T>,
|
||||||
|
@ -85,8 +86,7 @@ where
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use valence_protocol::cache::EncodedBuf;
|
/// use valence_protocol::{Encode, EncodedBuf};
|
||||||
/// use valence_protocol::Encode;
|
|
||||||
///
|
///
|
||||||
/// let mut buf1 = Vec::new();
|
/// let mut buf1 = Vec::new();
|
||||||
/// let mut buf2 = Vec::new();
|
/// let mut buf2 = Vec::new();
|
||||||
|
@ -101,6 +101,7 @@ where
|
||||||
///
|
///
|
||||||
/// [`Text`]: crate::text::Text
|
/// [`Text`]: crate::text::Text
|
||||||
/// [`Compound`]: valence_nbt::Compound
|
/// [`Compound`]: valence_nbt::Compound
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct EncodedBuf<T: ?Sized> {
|
pub struct EncodedBuf<T: ?Sized> {
|
||||||
buf: Vec<u8>,
|
buf: Vec<u8>,
|
||||||
res: Result<()>,
|
res: Result<()>,
|
||||||
|
|
|
@ -10,8 +10,7 @@ use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use valence_nbt::Compound;
|
use valence_nbt::Compound;
|
||||||
|
|
||||||
use crate::var_int::VarInt;
|
use crate::{Decode, Encode, Result, VarInt, MAX_PACKET_SIZE};
|
||||||
use crate::{Decode, Encode, Result, MAX_PACKET_SIZE};
|
|
||||||
|
|
||||||
// ==== Primitive ==== //
|
// ==== Primitive ==== //
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,7 @@ use std::io::Write;
|
||||||
use anyhow::{ensure, Context};
|
use anyhow::{ensure, Context};
|
||||||
use valence_nbt::Compound;
|
use valence_nbt::Compound;
|
||||||
|
|
||||||
use crate::block::BlockKind;
|
use crate::{BlockKind, Decode, Encode, Result, VarInt};
|
||||||
use crate::var_int::VarInt;
|
|
||||||
use crate::{Decode, Encode, Result};
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/item.rs"));
|
include!(concat!(env!("OUT_DIR"), "/item.rs"));
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
//! # Examples
|
//! # Examples
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! use valence_protocol::codec::{PacketDecoder, PacketEncoder};
|
|
||||||
//! use valence_protocol::packets::c2s::play::RenameItem;
|
//! use valence_protocol::packets::c2s::play::RenameItem;
|
||||||
|
//! use valence_protocol::{PacketDecoder, PacketEncoder};
|
||||||
//!
|
//!
|
||||||
//! let mut enc = PacketEncoder::new();
|
//! let mut enc = PacketEncoder::new();
|
||||||
//!
|
//!
|
||||||
|
@ -43,9 +43,6 @@
|
||||||
//! # Feature Flags
|
//! # Feature Flags
|
||||||
//!
|
//!
|
||||||
//! TODO
|
//! TODO
|
||||||
//!
|
|
||||||
//! [`PacketEncoder`]: codec::PacketEncoder
|
|
||||||
//! [`PacketDecoder`]: codec::PacketDecoder
|
|
||||||
|
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
#![deny(
|
#![deny(
|
||||||
|
@ -75,31 +72,45 @@ extern crate self as valence_protocol;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
pub use anyhow::{Error, Result};
|
pub use anyhow::{Error, Result};
|
||||||
|
pub use block::{BlockFace, BlockKind, BlockState};
|
||||||
|
pub use block_pos::BlockPos;
|
||||||
|
pub use byte_angle::ByteAngle;
|
||||||
|
pub use cache::{Cached, EncodedBuf};
|
||||||
|
pub use codec::{PacketDecoder, PacketEncoder};
|
||||||
|
pub use ident::Ident;
|
||||||
|
pub use item::{ItemKind, ItemStack};
|
||||||
|
pub use raw_bytes::RawBytes;
|
||||||
|
pub use text::{Text, TextFormat};
|
||||||
|
pub use username::Username;
|
||||||
|
pub use uuid::Uuid;
|
||||||
pub use valence_derive::{Decode, Encode, Packet};
|
pub use valence_derive::{Decode, Encode, Packet};
|
||||||
pub use valence_nbt as nbt;
|
pub use var_int::VarInt;
|
||||||
|
pub use var_long::VarLong;
|
||||||
|
pub use {uuid, valence_nbt as nbt};
|
||||||
|
|
||||||
use crate::byte_counter::ByteCounter;
|
use crate::byte_counter::ByteCounter;
|
||||||
|
|
||||||
/// The Minecraft protocol version this library currently targets.
|
/// The Minecraft protocol version this library currently targets.
|
||||||
pub const PROTOCOL_VERSION: i32 = 760;
|
pub const PROTOCOL_VERSION: i32 = 760;
|
||||||
|
|
||||||
/// The stringized name of the Minecraft version this library currently targets.
|
/// The stringified name of the Minecraft version this library currently
|
||||||
|
/// targets.
|
||||||
pub const MINECRAFT_VERSION: &str = "1.19.2";
|
pub const MINECRAFT_VERSION: &str = "1.19.2";
|
||||||
|
|
||||||
pub mod block;
|
pub mod block;
|
||||||
pub mod block_pos;
|
mod block_pos;
|
||||||
pub mod bounded;
|
mod bounded;
|
||||||
pub mod byte_angle;
|
mod byte_angle;
|
||||||
mod byte_counter;
|
mod byte_counter;
|
||||||
pub mod cache;
|
mod cache;
|
||||||
pub mod codec;
|
mod codec;
|
||||||
pub mod enchant;
|
pub mod enchant;
|
||||||
pub mod entity_meta;
|
pub mod entity_meta;
|
||||||
pub mod ident;
|
pub mod ident;
|
||||||
mod impls;
|
mod impls;
|
||||||
pub mod item;
|
mod item;
|
||||||
pub mod packets;
|
pub mod packets;
|
||||||
pub mod raw_bytes;
|
mod raw_bytes;
|
||||||
pub mod text;
|
pub mod text;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
pub mod username;
|
pub mod username;
|
||||||
|
@ -230,8 +241,6 @@ pub trait Encode {
|
||||||
/// ...]` attribute on the variant in question. Discriminant values are assigned
|
/// ...]` attribute on the variant in question. Discriminant values are assigned
|
||||||
/// to variants using rules similar to regular enum discriminants.
|
/// to variants using rules similar to regular enum discriminants.
|
||||||
///
|
///
|
||||||
/// [`VarInt`]: var_int::VarInt
|
|
||||||
///
|
|
||||||
/// ```
|
/// ```
|
||||||
/// use valence_protocol::Decode;
|
/// use valence_protocol::Decode;
|
||||||
///
|
///
|
||||||
|
@ -277,8 +286,6 @@ pub trait Decode<'a>: Sized {
|
||||||
/// A complete packet is data starting with a [`VarInt`] packet ID. [`Encode`]
|
/// A complete packet is data starting with a [`VarInt`] packet ID. [`Encode`]
|
||||||
/// and [`Decode`] implementations on `Self`, if present, are expected to handle
|
/// and [`Decode`] implementations on `Self`, if present, are expected to handle
|
||||||
/// this leading `VarInt`.
|
/// this leading `VarInt`.
|
||||||
///
|
|
||||||
/// [`VarInt`]: var_int::VarInt
|
|
||||||
pub trait Packet {
|
pub trait Packet {
|
||||||
/// The name of this packet.
|
/// The name of this packet.
|
||||||
///
|
///
|
||||||
|
|
|
@ -8,9 +8,7 @@ use serde::de::Visitor;
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
|
||||||
use crate::byte_counter::ByteCounter;
|
use crate::byte_counter::ByteCounter;
|
||||||
use crate::ident::Ident;
|
use crate::{Decode, Encode, Ident, Result, VarInt};
|
||||||
use crate::var_int::VarInt;
|
|
||||||
use crate::{Decode, Encode, Result};
|
|
||||||
|
|
||||||
/// Represents formatted text in Minecraft's JSON text format.
|
/// Represents formatted text in Minecraft's JSON text format.
|
||||||
///
|
///
|
||||||
|
|
|
@ -4,12 +4,8 @@ use bitfield_struct::bitfield;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use valence_nbt::Compound;
|
use valence_nbt::Compound;
|
||||||
use valence_protocol::text::Text;
|
|
||||||
|
|
||||||
use crate::__private::VarInt;
|
use crate::{BlockPos, Decode, Encode, Ident, Text, VarInt};
|
||||||
use crate::block_pos::BlockPos;
|
|
||||||
use crate::ident::Ident;
|
|
||||||
use crate::{Decode, Encode};
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Encode, Decode)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Encode, Decode)]
|
||||||
pub enum HandshakeNextState {
|
pub enum HandshakeNextState {
|
||||||
|
|
Loading…
Reference in a new issue