cb9230ec34
This PR redesigns Valence's architecture around the Bevy Entity Component System framework (`bevy_ecs` and `bevy_app`). Along the way, a large number of changes and improvements have been made. - Valence is now a Bevy plugin. This allows Valence to integrate with the wider Bevy ecosystem. - The `Config` trait has been replaced with the plugin struct which is much easier to configure. Async callbacks are grouped into their own trait. - `World` has been renamed to `Instance` to avoid confusion with `bevy_ecs::world::World`. - Entities, clients, player list, and inventories are all just ECS components/resources. There is no need for us to have our own generational arena/slotmap/etc for each one. - Client events use Bevy's event system. Users can read events with the `EventReader` system parameter. This also means that events are dispatched at an earlier stage of the program where access to the full server is available. There is a special "event loop" stage which is used primarily to avoid the loss of ordering information between events. - Chunks have been completely overhauled to be simpler and faster. The distinction between loaded and unloaded chunks has been mostly eliminated. The per-section bitset that tracked changes has been removed, which should further reduce memory usage. More operations on chunks are available such as removal and cloning. - The full client's game profile is accessible rather than just the textures. - Replaced `vek` with `glam` for parity with Bevy. - Basic inventory support has been added. - Various small changes to `valence_protocol`. - New Examples - The terrain and anvil examples are now fully asynchronous and will not block the main tick loop while chunks are loading. # TODOs - [x] Implement and dispatch client events. - ~~[ ] Finish implementing the new entity/chunk update algorithm.~~ New approach ended up being slower. And also broken. - [x] [Update rust-mc-bot to 1.19.3](https://github.com/Eoghanmc22/rust-mc-bot/pull/3). - [x] Use rust-mc-bot to test for and fix any performance regressions. Revert to old entity/chunk update algorithm if the new one turns out to be slower for some reason. - [x] Make inventories an ECS component. - [x] Make player lists an ECS ~~component~~ resource. - [x] Expose all properties of the client's game profile. - [x] Update the examples. - [x] Update `valence_anvil`. - ~~[ ] Update `valence_spatial_index` to use `glam` instead of `vek`.~~ Maybe later - [x] Make entity events use a bitset. - [x] Update docs. Closes #69 Closes #179 Closes #53 --------- Co-authored-by: Carson McManus <dyc3@users.noreply.github.com> Co-authored-by: AviiNL <me@avii.nl> Co-authored-by: Danik Vitek <x3665107@gmail.com> Co-authored-by: Snowiiii <71594357+Snowiiii@users.noreply.github.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |
What's This?
The packet inspector is a very simple Minecraft proxy for viewing the contents of packets as they are sent/received. It uses Valence's protocol facilities to print packet contents. This was made for three purposes:
- Check that packets between Valence and client are matching your expectations.
- Check that packets between vanilla server and client are parsed correctly by Valence.
- Understand how the protocol works between the vanilla server and client.
Usage
First, start a server
cargo r -r --example conway
In a separate terminal, start the packet inspector.
cargo r -r -p packet_inspector -- 127.0.0.1:25566 127.0.0.1:25565
The client must connect to localhost:25566
. You should see the packets in stdout
.
The -i
and -e
flags accept a regex to filter packets according to their name. The -i
regex includes matching
packets while the -e
regex excludes matching packets.
For instance, if you only want to print the packets Foo
, Bar
, and Baz
, you can use a regex such
as ^(Foo|Bar|Baz)$
with the -i
flag.
cargo r -r -p packet_inspector -- 127.0.0.1:25566 127.0.0.1:25565 -i '^(Foo|Bar|Baz)$'
Packets are printed to stdout
while errors are printed to stderr
. If you only want to see errors in your terminal,
direct stdout
elsewhere.
cargo r -r -p packet_inspector -- 127.0.0.1:25566 127.0.0.1:25565 > log.txt
Quick start with Vanilla Server via Docker
Start the server
docker run -e EULA=TRUE -e ONLINE_MODE=false -d -p 25565:25565 --name mc itzg/minecraft-server
View server logs
docker logs -f mc
Server Rcon
docker exec -i mc rcon-cli
In a separate terminal, start the packet inspector.
cargo r -r -p packet_inspector -- 127.0.0.1:25566 127.0.0.1:25565
Open Minecraft and connect to localhost:25566
.
Clean up
docker stop mc
docker rm mc