valence_world_border

Crates.iovalence_world_border
lib.rsvalence_world_border
version0.2.0-alpha.1+mc.1.20.1
sourcesrc
created_at2023-08-11 14:29:46.91209
updated_at2023-08-11 14:29:46.91209
descriptionWorld border support for Valence
homepage
repositoryhttps://github.com/valence-rs/valence
max_upload_size
id941967
size10,694
Ryan Johnson (rj00a)

documentation

https://docs.rs/valence/

README

valence_world_border

Contains the plugin for working with Minecraft's world border.

To enable world border functionality for a layer, insert the [WorldBorderBundle] component on the layer entity. Note that the layer entity must have the [ChunkLayer] component for this to work.

Example

use bevy_ecs::prelude::*;
use valence_world_border::*;

fn example_system(mut world_borders: Query<(&mut WorldBorderCenter, &mut WorldBorderLerp)>) {
    for (mut center, mut lerp) in &mut world_borders {
        // Change the center position of the world border.
        center.x = 123.0;
        center.z = 456.0;

        // Change the diameter of the world border.
        // If you want to change the diameter without interpolating, stop after this.
        lerp.target_diameter = 100.0;

        // Have the world border linearly interpolate its diameter from 50 to 100 over 200 ticks.
        // `current_diameter` and `remaining_ticks` will change automatically, but you can modify their values at any time.
        lerp.current_diameter = 50.0;
        lerp.remaining_ticks = 200;
    }
}
Commit count: 558

cargo fmt