valence/Cargo.toml
Tachibana Yui 61f2279831
Implement world border (#364)
## Description

Basic implementation of world border
World border is not enabled by default. It can be enabled by inserting
`WorldBorderBundle` bundle. Currently, this PR only implements world
borders per instance, I'm considering expanding this per client.
However, the same functionality can be achieved by Visibility Layers
#362

<details>
<summary>Playground:</summary>

```rust
fn border_controls(
    mut events: EventReader<ChatMessageEvent>,
    mut instances: Query<(Entity, &WorldBorderDiameter, &mut WorldBorderCenter), With<Instance>>,
    mut event_writer: EventWriter<SetWorldBorderSizeEvent>,
) {
    for x in events.iter() {
        let parts: Vec<&str> = x.message.split(' ').collect();
        match parts[0] {
            "add" => {
                let Ok(value) = parts[1].parse::<f64>() else {
                    return;
                };

                let Ok(speed) = parts[2].parse::<i64>() else {
                    return;
                };

                let Ok((entity, diameter, _)) = instances.get_single_mut() else {
                    return;
                };

                event_writer.send(SetWorldBorderSizeEvent {
                    instance: entity,
                    new_diameter: diameter.diameter() + value,
                    speed,
                })
            }
            "center" => {
                let Ok(x) = parts[1].parse::<f64>() else {
                    return;
                };

                let Ok(z) = parts[2].parse::<f64>() else {
                    return;
                };

                instances.single_mut().2 .0 = DVec2 { x, y: z };
            }
            _ => (),
        }
    }
}
``` 
</details>

example: `cargo run --package valence --example world_border`
tests: `cargo test --package valence --lib -- tests::world_border`


**Related**
part of #210
2023-06-14 22:15:47 -07:00

102 lines
2.8 KiB
TOML

[workspace]
members = ["crates/*", "tools/*"]
exclude = ["rust-mc-bot", "tools/stresser", "tools/packet_inspector"]
resolver = "2"
[workspace.package]
version = "0.2.0-dev+mc.1.20.1"
edition = "2021"
repository = "https://github.com/valence-rs/valence"
documentation = "https://docs.rs/valence/"
license = "MIT"
[workspace.dependencies]
aes = "0.8.2"
anyhow = "1.0.70"
approx = "0.5.1"
arrayvec = "0.7.2"
async-trait = "0.1.60"
atty = "0.2.14"
base64 = "0.21.0"
bevy_app = { version = "0.10.1", default-features = false }
bevy_ecs = { version = "0.10.1", default-features = false, features = ["trace"] }
bevy_hierarchy = { version = "0.10.1", default-features = false }
bevy_mod_debugdump = "0.7.0"
bitfield-struct = "0.3.1"
byteorder = "1.4.3"
bytes = "1.2.1"
cesu8 = "1.1.0"
cfb8 = "0.8.1"
clap = { version = "4.0.30", features = ["derive"] }
criterion = "0.4.0"
directories = "5.0.0"
eframe = { version = "0.21.0", default-features = false }
egui = "0.21.0"
enum-map = "2.4.2"
flate2 = "1.0.24"
flume = "0.10.14"
fs_extra = "1.2.0"
glam = "0.23.0"
heck = "0.4.0"
hmac = "0.12.1"
indexmap = "1.9.3"
noise = "0.8.2"
num = "0.4.0"
num-bigint = "0.4.3"
num-integer = "0.1.45"
owo-colors = "3.5.0"
parking_lot = "0.12.1"
paste = "1.0.11"
pretty_assertions = "1.3.0"
proc-macro2 = "1.0.56"
quote = "1.0.26"
rand = "0.8.5"
rayon = "1.7.0"
regex = "1.6.0"
reqwest = { version = "0.11.12", default-features = false }
rfd = "0.11.3"
rsa = "0.7.2"
rsa-der = "0.3.0"
rustc-hash = "1.1.0"
serde = "1.0.160"
serde_json = "1.0.96"
sha1 = "0.10.5"
sha2 = "0.10.6"
syn = "2.0.15"
syntect = { version = "5.0.0", default-features = false }
tempfile = "3.3.0"
thiserror = "1.0.40"
time = "0.3.17"
tokio = { version = "1.27.0", features = ["full"] }
toml = "0.7.2"
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
url = { version = "2.2.2", features = ["serde"] }
uuid = "1.3.1"
valence_advancement.path = "crates/valence_advancement"
valence_anvil.path = "crates/valence_anvil"
valence_biome.path = "crates/valence_biome"
valence_block.path = "crates/valence_block"
valence_build_utils.path = "crates/valence_build_utils"
valence_client.path = "crates/valence_client"
valence_core_macros.path = "crates/valence_core_macros"
valence_core.path = "crates/valence_core"
valence_dimension.path = "crates/valence_dimension"
valence_entity.path = "crates/valence_entity"
valence_instance.path = "crates/valence_instance"
valence_inventory.path = "crates/valence_inventory"
valence_nbt = { path = "crates/valence_nbt", features = ["uuid"] }
valence_network.path = "crates/valence_network"
valence_player_list.path = "crates/valence_player_list"
valence_registry.path = "crates/valence_registry"
valence_world_border.path = "crates/valence_world_border"
valence.path = "crates/valence"
zip = "0.6.3"
[profile.dev.package."*"]
opt-level = 3
[profile.dev]
opt-level = 1