Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for crates.io #2

Merged
merged 3 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.idea/
.vscode/

/target
target
14 changes: 3 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,8 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace]
members = ["macros", "protocol"]

[workspace.dependencies]
mclib-macros = { path = "macros" }
mclib-protocol = { path = "protocol" }
[dependencies]
mclib-macros = { path = "macros", version = "0.0.1" }

darling = { version = "0.20.3" }
flate2 = { version = "1.0.28" }
syn = { version = "2.0.39" }
uuid = { version = "1.5.0", features = ["v4", "fast-rng", "macro-diagnostics"] }

[dependencies]
mclib-macros = { workspace = true }
mclib-protocol = { workspace = true }
99 changes: 99 additions & 0 deletions macros/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[package]
name = "mclib-macros"
version = "0.1.0"
version = "0.0.1"
license = "Apache-2.0"
description = "Proc-macro for mclib"
edition = "2021"

[lib]
proc-macro = true

[dependencies]
darling = { workspace = true }
syn = { workspace = true }
darling = { version = "0.20.3" }
syn = { version = "2.0.39" }
12 changes: 0 additions & 12 deletions protocol/Cargo.toml

This file was deleted.

5 changes: 0 additions & 5 deletions protocol/src/lib.rs

This file was deleted.

3 changes: 0 additions & 3 deletions protocol/src/packets.rs

This file was deleted.

9 changes: 0 additions & 9 deletions protocol/src/packets/client.rs

This file was deleted.

8 changes: 0 additions & 8 deletions protocol/src/packets/server.rs

This file was deleted.

19 changes: 0 additions & 19 deletions protocol/src/types.rs

This file was deleted.

11 changes: 7 additions & 4 deletions protocol/src/chunk_format.rs → src/chunk_format.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use crate::chunk_format::section::ChunkSection;
use crate::types::base::MCType;
use crate::utils::TcpUtils;
use std::io::Read;

pub mod data_array;
pub mod palleted_container;
pub mod section;
pub(crate) mod data_array;
pub(crate) mod palleted_container;
pub(crate) mod section;

pub use data_array::DataArray;
pub use palleted_container::PalletedContainer;
pub use section::ChunkSection;

#[derive(Debug, Clone)]
pub struct ChunkData(pub Vec<ChunkSection>);
Expand Down
File renamed without changes.
File renamed without changes.
94 changes: 8 additions & 86 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,91 +71,13 @@
//! ```
//! For more information about NBT tags [their pages](nbt)

pub mod chunk_format;
pub mod nbt;
pub mod packets;
pub mod types;
pub mod utils;

pub use crate::packets::base::MCPacket;
pub use crate::types::base::MCType;
pub use mclib_macros::MCPacket;
pub use mclib_macros::MCType;
pub use mclib_protocol::packets::base::MCPacket;
pub use mclib_protocol::types::base::MCType;

pub mod packets {
//! Minecraft protocol packets
pub mod server {
//! Packets that bound to server (from client to server)
pub use mclib_protocol::packets::server::finish_configuration::FinishConfigurationServerbound;
pub use mclib_protocol::packets::server::handshake::{Handshake, HandshakeNextState};
pub use mclib_protocol::packets::server::keepalive::ServerboundKeelAlivePlay;
pub use mclib_protocol::packets::server::login_acknowledged::LoginAcknowledged;
pub use mclib_protocol::packets::server::login_start::LoginStart;
pub use mclib_protocol::packets::server::ping::PingRequest;
pub use mclib_protocol::packets::server::set_player_position::SetPlayerPosition;
pub use mclib_protocol::packets::server::status_request::StatusRequest;
}
pub mod client {
//! Packets that bound to client (from server to client)
pub use mclib_protocol::packets::client::chunk_data_and_update_light::ChunkDataAndUpdateLight;
pub use mclib_protocol::packets::client::finish_configuration::FinishConfigurationClientbound;
pub use mclib_protocol::packets::client::keepalive::ClientboundKeelAlivePlay;
pub use mclib_protocol::packets::client::login_success::{
LoginSuccess, LoginSuccessProperty,
};
pub use mclib_protocol::packets::client::play::{DeathInfo, Play};
pub use mclib_protocol::packets::client::registry_data::RegistryData;
pub use mclib_protocol::packets::client::set_default_spawn_position::SetDefaultSpawnPosition;
pub use mclib_protocol::packets::client::status_response::StatusResponse;
pub use mclib_protocol::packets::client::synchronize_player_position::SynchronizePlayerPosition;
}
}
pub mod types {
//! Minecraft data types
pub use mclib_protocol::types::bitset::MCBitSet;
pub use mclib_protocol::types::boolean::MCBoolean;
pub use mclib_protocol::types::byte::MCByte;
pub use mclib_protocol::types::byte_array::MCByteArray;
pub use mclib_protocol::types::double::MCDouble;
pub use mclib_protocol::types::float::MCFloat;
pub use mclib_protocol::types::int::MCInt;
pub use mclib_protocol::types::long::MCLong;
pub use mclib_protocol::types::nbt::MCNBT;
pub use mclib_protocol::types::position::MCPosition;
pub use mclib_protocol::types::short::MCShort;
pub use mclib_protocol::types::string::MCString;
pub use mclib_protocol::types::ubyte::MCUByte;
pub use mclib_protocol::types::ushort::MCUShort;
pub use mclib_protocol::types::uuid::MCUuid;
pub use mclib_protocol::types::varint::MCVarInt;
}
pub mod nbt {
//! Named Binary Tag (NBT) protocol
//!
//! [More information](https://wiki.vg/NBT)
pub use mclib_protocol::nbt::tags::base::{IntoNBTTag, NBTTag};
/// TAG_Byte
pub use mclib_protocol::nbt::tags::byte::TagByte;
/// TAG_Byte_Array
pub use mclib_protocol::nbt::tags::byte_array::TagByteArray;
/// TAG_Compound (any non root)
pub use mclib_protocol::nbt::tags::compound::TagCompound;
/// TAG_Double
pub use mclib_protocol::nbt::tags::double::TagDouble;
/// TAG_Float
pub use mclib_protocol::nbt::tags::float::TagFloat;
/// TAG_Int
pub use mclib_protocol::nbt::tags::int::TagInt;
/// TAG_List
pub use mclib_protocol::nbt::tags::list::TagList;
/// TAG_Long
pub use mclib_protocol::nbt::tags::long::TagLong;
/// TAG_Long_Array
pub use mclib_protocol::nbt::tags::long_array::TagLongArray;
/// TAG_Short
pub use mclib_protocol::nbt::tags::short::TagShort;
/// TAG_String
pub use mclib_protocol::nbt::tags::string::TagString;
/// Parent NBT tag (Root TAG_Compound)
pub use mclib_protocol::nbt::NBT;
}
pub mod chunk_format {
pub use mclib_protocol::chunk_format::{
data_array::DataArray, palleted_container::PalletedContainer, section::ChunkSection,
ChunkData,
};
}
33 changes: 31 additions & 2 deletions protocol/src/nbt.rs → src/nbt.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
use crate::nbt::tags::base::{unpack_by_ty_id, NBTTag};
//! Named Binary Tag (NBT) protocol
//!
//! [More information](https://wiki.vg/NBT)

use crate::nbt::tags::base::unpack_by_ty_id;
use crate::utils::TcpUtils;
use std::io::Read;

pub mod tags;
pub(crate) mod tags;

pub use tags::base::{IntoNBTTag, NBTTag};
/// TAG_Byte
pub use tags::byte::TagByte;
/// TAG_Byte_Array
pub use tags::byte_array::TagByteArray;
/// TAG_Compound (any non root)
pub use tags::compound::TagCompound;
/// TAG_Double
pub use tags::double::TagDouble;
/// TAG_Float
pub use tags::float::TagFloat;
/// TAG_Int
pub use tags::int::TagInt;
/// TAG_List
pub use tags::list::TagList;
/// TAG_Long
pub use tags::long::TagLong;
/// TAG_Long_Array
pub use tags::long_array::TagLongArray;
/// TAG_Short
pub use tags::short::TagShort;
/// TAG_String
pub use tags::string::TagString;

/// Parent NBT tag (Root TAG_Compound)
#[derive(Debug)]
pub struct NBT(pub Option<String>, pub Box<dyn NBTTag>);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading