c9fbd1a24e
<!-- Please make sure that your PR is aligned with the guidelines in CONTRIBUTING.md to the best of your ability. --> <!-- Good PRs have tests! Make sure you have sufficient test coverage. --> ## Description <!-- Describe the changes you've made. You may include any justification you want here. --> An implementation of basic weather systems. The weather component attached to a world instance would be handled for all clients, except those that have their own weather component; these clients would be handled separately. ## Test Plan <!-- Explain how you tested your changes, and include any code that you used to test this. --> <!-- If there is an example that is sufficient to use in place of a playground, replace the playground section with a note that indicates this. --> <details> <summary>Playground</summary> ```rust fn handle_command_events( instances: Query<Entity, With<Instance>>, mut exec_cmds: EventReader<CommandExecution>, mut commands: Commands, ) { for cmd in exec_cmds.iter() { let msg = cmd.command.to_string(); let ent = instances.single(); match msg.as_str() { "ar" => { commands.entity(ent).insert(Rain(WEATHER_LEVEL.end)); } "rr" => { commands.entity(ent).remove::<Rain>(); } "at" => { commands.entity(ent).insert(Thunder(WEATHER_LEVEL.end)); } "rt" => { commands.entity(ent).remove::<Thunder>(); } _ => (), }; } } ``` </details> <!-- You need to include steps regardless of whether or not you are using a playground. --> Steps: 1. Run `cargo test --package valence --lib -- weather::test` #### Related Part of #210 Past approach #106 <!-- Link to any issues that have context for this or that this PR fixes. --> |
||
---|---|---|
.github | ||
assets | ||
crates | ||
extracted | ||
extractor | ||
.gitignore | ||
Cargo.toml | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE.txt | ||
README.md | ||
rustfmt.toml |
A Rust framework for building Minecraft: Java Edition servers.
Built on top of Bevy ECS, Valence is an effort to create a Minecraft compatible server completely from scratch in Rust. You can think of Valence as a game engine for Minecraft servers. It doesn't do much by default, but by writing game logic yourself and leveraging Bevy's powerful plugin system, you can make almost anything.
Opinionated features like dynamic scripting, dedicated executables, and vanilla game mechanics are all expected to be built as optional plugins. This level of modularity is desirable for those looking to build highly custom experiences in Minecraft such as minigame servers.
Goals
Valence aims to be the following:
- Complete. Abstractions for the full breadth of the Minecraft protocol.
- Flexible. Can easily extend Valence from within user code. Direct access to the Minecraft protocol is provided.
- Modular. Pick and choose the components you need.
- Intuitive. An API that is easy to use and difficult to misuse. Extensive documentation and examples are important.
- Efficient. Optimal use of system resources with multiple CPU cores in mind. Valence uses very little memory and can support thousands of players at the same time without lag (assuming you have the bandwidth).
- Up to date. Targets the most recent stable version of Minecraft. Support for multiple versions at once is not planned. However, you can use a proxy with ViaBackwards to achieve backwards compatibility with older clients.
Current Status
⚠️ Valence is still early in development with many features unimplemented or incomplete. Expect to encounter bugs, limitations, and breaking changes. Here are some noteworthy achievements:
valence_nbt
: A speedy new library for Minecraft's Named Binary Tag (NBT) format.valence_protocol
: A library for working with Minecraft's protocol. Does not depend on Valence and can be used in other projects.- Authentication, encryption, and compression
- Block states
- Chunks
- Entities and metadata
- Bounding volume hierarchy for fast spatial entity queries
- Player list and player skins
- Dimensions, biomes, and worlds
- JSON Text API
- A Fabric mod for extracting data from the game into JSON files. These files are processed by a build script to generate Rust code for the project. The JSON files can be used in other projects as well.
- Inventories
- Items
- Particles
- Anvil file format (read only)
- Proxy support (Velocity, Bungeecord and Waterfall)
Here is a short video (outdated) showing the examples and some of Valence's capabilities.
Getting Started
Running the Examples
After cloning the repository, run
cargo r -r --example
to view the list of examples. I recommend giving parkour
, conway
, terrain
, and cow_sphere
a try.
Next, open your Minecraft client and connect to the address localhost
.
If all goes well you should be playing on the server.
Adding Valence as a Dependency
Valence is published to crates.io. Run cargo add valence
to add it to your
project. Documentation is available here.
However, the crates.io version is likely outdated. To use the most recent development version, add Valence as a git dependency
[dependencies]
valence = { git = "https://github.com/valence-rs/valence" }
View the latest documentation by running cargo d --open
in your project.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md. You can also join the Discord to discuss the project and ask questions.
License
Code is licensed under MIT while the Valence logo is under CC BY-NC-ND 4.0
Funding
If you would like to contribute financially, consider sponsoring me (rj00a) on GitHub or Patreon.
I would love to continue working on Valence and your support would help me do that. Thanks!