Reorganize Packages (#180)

Moves all the packages to the `crates/` directory.
This commit is contained in:
Ryan Johnson 2022-12-29 16:51:05 -08:00 committed by GitHub
parent 295678e92d
commit 2597e92b8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
106 changed files with 162 additions and 119 deletions

4
.gitignore vendored
View file

@ -8,9 +8,9 @@ Cargo.lock
/extractor/out
/extractor/classes
/extractor/run
/benchmarks/rust-mc-bot
/crates/*/rust-mc-bot
.asset_cache/
/velocity
flamegraph.svg
perf.data
perf.data.old
/valence_anvil/.asset_cache/

View file

@ -1,82 +1,6 @@
[package]
name = "valence"
version = "0.2.0+mc1.19.3"
edition = "2021"
description = "A framework for building Minecraft servers in Rust."
repository = "https://github.com/rj00a/valence"
readme = "README.md"
license = "MIT"
keywords = ["minecraft", "gamedev", "server"]
categories = ["game-engines"]
build = "build/main.rs"
authors = ["Ryan Johnson <ryanj00a@gmail.com>"]
[dependencies]
anyhow = "1.0.65"
arrayvec = "0.7.2"
async-trait = "0.1.57"
base64 = "0.13.0"
bitfield-struct = "0.1.8"
bytes = "1.2.1"
flume = "0.10.14"
futures = "0.3.24"
hmac = "0.12.1"
num = "0.4.0"
paste = "1.0.9"
rand = "0.8.5"
rayon = "1.5.3"
rsa = "0.6.1"
rsa-der = "0.3.0"
rustc-hash = "1.1.0"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
sha1 = "0.10.5"
sha2 = "0.10.6"
thiserror = "1.0.35"
tracing = "0.1.37"
url = { version = "2.2.2", features = ["serde"] }
uuid = { version = "1.1.2", features = ["serde"] }
valence_nbt = { version = "0.5.0", path = "valence_nbt" }
valence_protocol = { version = "0.1.0", path = "valence_protocol", features = ["encryption", "compression"] }
vek = "0.15.8"
[dependencies.tokio]
version = "1.21.2"
features = ["macros", "rt-multi-thread", "net", "io-util", "sync", "time"]
[dependencies.reqwest]
version = "0.11.12"
default-features = false
# Avoid OpenSSL dependency on Linux.
features = ["rustls-tls", "json"]
[dev-dependencies]
approx = "0.5.1"
tracing-subscriber = "0.3.16"
noise = "0.8.2"
valence_spatial_index = { path = "valence_spatial_index", version = "0.1.0" }
[build-dependencies]
anyhow = "1.0.65"
heck = "0.4.0"
proc-macro2 = "1.0.43"
quote = "1.0.21"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
rayon = "1.5.3"
num = "0.4.0"
[workspace]
members = [
"valence_derive",
"valence_nbt",
"valence_anvil",
"valence_protocol",
"valence_spatial_index",
"packet_inspector",
"benchmarks/bench_players"
]
exclude = ["benchmarks/rust-mc-bot"]
members = ["crates/*"]
exclude = ["crates/*/rust-mc-bot"]
[profile.dev.package."*"]
opt-level = 3

View file

@ -5,5 +5,4 @@ edition = "2021"
[dependencies]
tracing-subscriber = "0.3.16"
valence = { path = "../.." }
valence = { path = "../valence" }

67
crates/valence/Cargo.toml Normal file
View file

@ -0,0 +1,67 @@
[package]
name = "valence"
version = "0.2.0+mc1.19.3"
edition = "2021"
description = "A framework for building Minecraft servers in Rust."
repository = "https://github.com/rj00a/valence"
readme = "README.md"
license = "MIT"
keywords = ["minecraft", "gamedev", "server"]
categories = ["game-engines"]
build = "build/main.rs"
authors = ["Ryan Johnson <ryanj00a@gmail.com>"]
[dependencies]
anyhow = "1.0.65"
arrayvec = "0.7.2"
async-trait = "0.1.57"
base64 = "0.13.0"
bitfield-struct = "0.1.8"
bytes = "1.2.1"
flume = "0.10.14"
futures = "0.3.24"
hmac = "0.12.1"
num = "0.4.0"
paste = "1.0.9"
rand = "0.8.5"
rayon = "1.5.3"
rsa = "0.6.1"
rsa-der = "0.3.0"
rustc-hash = "1.1.0"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
sha1 = "0.10.5"
sha2 = "0.10.6"
thiserror = "1.0.35"
tracing = "0.1.37"
url = { version = "2.2.2", features = ["serde"] }
uuid = { version = "1.1.2", features = ["serde"] }
valence_nbt = { version = "0.5.0", path = "../valence_nbt" }
valence_protocol = { version = "0.1.0", path = "../valence_protocol", features = ["encryption", "compression"] }
vek = "0.15.8"
[dependencies.tokio]
version = "1.21.2"
features = ["macros", "rt-multi-thread", "net", "io-util", "sync", "time"]
[dependencies.reqwest]
version = "0.11.12"
default-features = false
# Avoid OpenSSL dependency on Linux.
features = ["rustls-tls", "json"]
[dev-dependencies]
approx = "0.5.1"
tracing-subscriber = "0.3.16"
noise = "0.8.2"
valence_spatial_index = { path = "../valence_spatial_index", version = "0.1.0" }
[build-dependencies]
anyhow = "1.0.65"
heck = "0.4.0"
proc-macro2 = "1.0.43"
quote = "1.0.21"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
rayon = "1.5.3"
num = "0.4.0"

View file

@ -240,24 +240,26 @@ impl Value {
type Entities = BTreeMap<String, Entity>;
pub fn build() -> anyhow::Result<TokenStream> {
let entities = serde_json::from_str::<Entities>(include_str!("../extracted/entities.json"))?
.into_iter()
.map(|(k, mut v)| {
let strip = |s: String| {
if let Some(stripped) = s.strip_suffix("Entity") {
if !stripped.is_empty() {
return stripped.to_owned();
let entities =
serde_json::from_str::<Entities>(include_str!("../../../extracted/entities.json"))?
.into_iter()
.map(|(k, mut v)| {
let strip = |s: String| {
if let Some(stripped) = s.strip_suffix("Entity") {
if !stripped.is_empty() {
return stripped.to_owned();
}
}
}
s
};
v.parent = v.parent.map(strip);
(strip(k), v)
})
.collect::<Entities>();
s
};
v.parent = v.parent.map(strip);
(strip(k), v)
})
.collect::<Entities>();
let entity_types =
serde_json::from_str::<EntityData>(include_str!("../extracted/entity_data.json"))?.types;
serde_json::from_str::<EntityData>(include_str!("../../../extracted/entity_data.json"))?
.types;
let concrete_entities = entities
.clone()

View file

@ -15,7 +15,7 @@ struct EntityData {
pub fn build() -> anyhow::Result<TokenStream> {
let entity_data: EntityData =
serde_json::from_str(include_str!("../extracted/entity_data.json"))?;
serde_json::from_str(include_str!("../../../extracted/entity_data.json"))?;
let mut statuses: Vec<_> = entity_data.statuses.into_iter().collect();
statuses.sort_by_key(|(_, id)| *id);

View file

@ -82,7 +82,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -60,7 +60,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -60,7 +60,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -80,7 +80,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -69,7 +69,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: SAMPLE.into(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -96,7 +96,11 @@ impl Config for Game {
online_players: self.player_count.load(Ordering::SeqCst) as i32,
max_players: MAX_PLAYERS as i32,
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
player_sample: Default::default(),
}
}

View file

@ -67,7 +67,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -67,7 +67,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -72,7 +72,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -54,7 +54,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -57,7 +57,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -63,7 +63,11 @@ impl Config for Game {
max_players: MAX_PLAYERS as i32,
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
}
}

View file

@ -46,7 +46,11 @@ impl Config for Game {
online_players: -1,
max_players: -1,
description: "Hello Valence! ".into_text() + "Text Example".color(Color::AQUA),
favicon_png: Some(include_bytes!("../assets/logo-64x64.png").as_slice().into()),
favicon_png: Some(
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),
player_sample: Default::default(),
}
}

View file

@ -15,7 +15,7 @@ byteorder = "1.4.3"
flate2 = "1.0.25"
thiserror = "1.0.37"
num-integer = "0.1.45" # TODO: remove when div_ceil is stabilized.
valence = { version = "0.2.0", path = "..", optional = true }
valence = { version = "0.2.0", path = "../valence", optional = true }
valence_nbt = { version = "0.5.0", path = "../valence_nbt" }
[dev-dependencies]
@ -23,7 +23,7 @@ anyhow = "1.0.68"
criterion = "0.4.0"
fs_extra = "1.2.0"
tempfile = "3.3.0"
valence = { version = "0.2.0", path = ".." }
valence = { version = "0.2.0", path = "../valence" }
valence_anvil = { version = "0.1.0", path = ".", features = ["valence"] }
zip = "0.6.3"

View file

@ -75,7 +75,7 @@ impl Config for Game {
player_sample: Default::default(),
description: "Hello Valence!".color(Color::AQUA),
favicon_png: Some(
include_bytes!("../../assets/logo-64x64.png")
include_bytes!("../../../assets/logo-64x64.png")
.as_slice()
.into(),
),

View file

@ -10,4 +10,3 @@ proc-macro = true
syn = { version = "1.0.103", features = ["full"] }
quote = "1.0.21"
proc-macro2 = "1.0.47"

View file

@ -62,7 +62,7 @@ struct Shape {
pub fn build() -> anyhow::Result<TokenStream> {
let TopLevel { blocks, shapes } =
serde_json::from_str(include_str!("../../extracted/blocks.json"))?;
serde_json::from_str(include_str!("../../../extracted/blocks.json"))?;
let max_state_id = blocks.iter().map(|b| b.max_state_id()).max().unwrap();

View file

@ -29,7 +29,7 @@ pub struct EnchantmentSources {
pub fn build() -> anyhow::Result<TokenStream> {
let enchants: Vec<Enchantment> =
serde_json::from_str(include_str!("../../extracted/enchants.json"))?;
serde_json::from_str(include_str!("../../../extracted/enchants.json"))?;
let enchantmentkind_definitions = enchants
.iter()

View file

@ -29,7 +29,7 @@ struct FoodComponent {
}
pub fn build() -> anyhow::Result<TokenStream> {
let items = serde_json::from_str::<Vec<Item>>(include_str!("../../extracted/items.json"))?;
let items = serde_json::from_str::<Vec<Item>>(include_str!("../../../extracted/items.json"))?;
let item_kind_count = items.len();

View file

@ -19,7 +19,7 @@ fn escape(text: &str) -> String {
pub fn build() -> anyhow::Result<TokenStream> {
let translations = serde_json::from_str::<Vec<Translation>>(include_str!(
"../../extracted/translation_keys.json"
"../../../extracted/translation_keys.json"
))?;
let translation_key_consts = translations

Some files were not shown because too many files have changed in this diff Show more