Commit graph

38 commits

Author SHA1 Message Date
Arnaud Lier e2fcf7b384
chore: remove unused imports in extractor (#373)
## Description

Just removed useless imports in `extractor`.
2023-06-17 09:41:38 -04:00
Carson McManus 09fbd9b7e7
Update to Minecraft 1.20.1 (#358)
## Description

Updates valence to Minecraft 1.20.1, which is protocol compatible with
1.20.

closes #357

---------

Co-authored-by: Ryan Johnson <ryanj00a@gmail.com>
Co-authored-by: AviiNL <me@avii.nl>
2023-06-13 14:38:55 -07:00
Carson McManus 975014e76b
tag registry (#350)
- add Tags extractor
- add tags.json to extracted
- send `SynchronizeTagsS2c` packet on join
- fix encode

## Description

Adds a `TagsRegistry` resource that contains all the information needed
to build and send `SynchronizeTagsS2c` on join.

closes #349
2023-06-01 23:21:25 -07:00
Bafbi a68792e605
Registry codec extractor (#316)
## Description

- #311 .
- Update the script to cp all the file of the output dir .

## Change to the gradle project

- Adding the fabric API .
- The serveur now need to start starting .

## Test plan

Do the same as before and compare the 1.9.4 output file and my generated
one .

---------

Co-authored-by: Ryan Johnson <ryanj00a@gmail.com>
2023-04-10 01:39:03 -07:00
Ryan Johnson 9c9f672a22
Update to 1.19.4 (#302)
## Description

Closes #291

- Update extractors to support Minecraft 1.19.4
- Update code generators.
- Changed generated entity component names to avoid name collisions.
- Update `glam` version.
- Added `Encode` and `Decode` for `glam` types in `valence_protocol`.
- Fixed inconsistent packet names and assign packet IDs automatically.
- Remove `ident` and rename `ident_str` to `ident`.
- Rework registry codec configuration. Biomes and dimensions exist as
entities.`BiomeRegistry` and `DimensionTypeRegistry` resources have been
added. The vanilla registry codec is loaded at startup.

### Issues
- Creating new instances has become more tedious than it should be. This
will be addressed later.

## Test Plan

Steps:
1. Boot up a vanilla server with online mode disabled.
2. Run the `packet_inspector`.
3. Connect to the vanilla server through the packet inspector to ensure
all packets are updated correctly.
4. Close the vanilla server and try some valence examples.
2023-03-31 14:58:47 -07:00
Ryan Johnson 4cf6e1a207
Entity Rework (#294)
## Description

Closes #269
Closes #199 

- Removes `McEntity` and replaces it with bundles of components, one for
each entity type.
- Tracked data types are now separate components rather than stuffing
everything into a `TrackedData` enum.
- Tracked data is now cached in binary form within each entity,
eliminating some work when entities enter the view of clients.
- Complete redesign of entity code generator.
- More docs for some components.
- Field bits are moved out of the entity extractor and into the valence
entity module.
- Moved hitbox code to separate module.
- Refactor instance update systems to improve parallelism.

### TODOs
- [x] Update examples.
- [x] Update `default_event_handler`.
- [x] Fix bugs.

## Test Plan

Steps:
1. Check out the entity module docs with `cargo d --open`.
2. Run examples.
2023-03-21 23:29:38 -07:00
Jade Ellis 9931c8a80b
Provide API for getting the wall variant of blocks (#255)
<!-- 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

This adds an API for getting the wall / attachable variant of a block. 
Unlike #117 it does not add convenience methods for orientation, and it
does not modify the example to use this code.

## 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. -->

The extractor is not tested. 
The API has some tests in the test module.

#### Related

<!-- Link to any issues that have context for this or that this PR
fixes. -->

#115 - it does not fix this, as it doesn't modify the example, but it
could lead to it.

---------

Co-authored-by: EmperialDev <saroke.dev@gmail.com>
2023-02-23 21:21:27 -08:00
Mrln 1ceafe0ce0
Add block entities (#32)
This PR aims to add block entities.
Fixes #5

---------

Co-authored-by: Ryan Johnson <ryanj00a@gmail.com>
2023-02-18 10:16:01 -08:00
Gingeh 50018a52bf
Add sounds (#244)
This is my first time contributing here so I was pretty unfamiliar with
the codebase and may have done some things incorrectly.

## Description
 - Added a sound extractor to extract sound event ids and identifiers
 - Added a `Sound` enum (with a build script) to represent sound effects
 - Added a `play_sound` method to `Instance` and `Client`
 - Re-implemented sound effects in the parkour example

## Test Plan
I tested this using the sounds I added to the parkour example.

#### Related
Hopefully fixes #206
2023-02-15 02:36:21 -08:00
Ryan Johnson cb9230ec34
ECS Rewrite (#184)
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>
2023-02-11 09:51:53 -08:00
Ryan 623e88908d Disable biome extractor
Need to figure out what became of the biome registry in 1.19.3
2022-12-29 23:31:06 -08:00
Ryan Johnson 5d3364d452
Update to 1.19.3 (#171)
Closes #165
2022-12-28 00:42:54 -08:00
Terminator 6de5de57a5
Anvil file support (blocks and biomes) (#145)
Adds the `valence_anvil` crate for loading anvil worlds. It can only read blocks and biomes currently. Support for saving data is to be added later.

Co-authored-by: Ryan <ryanj00a@gmail.com>
2022-12-26 06:55:52 -08:00
Sandro Marques 6437381339
Translation key extractor and code generator (#160)
Generates a new `translation_key.rs` with all bundled translations.
Closes #158.
2022-11-27 05:12:08 -08:00
Ryan Johnson ad153159dd
Add replaceable boolean to block states (#116) 2022-10-16 03:50:57 -07:00
Ryan 886d036b97 Use valence.rs domain in extractor package 2022-10-06 13:49:30 -07:00
EmperialDev 1f996f7549
Add Items (#92)
Adding all the items, just like the blocks are. This will adress 1. and 2. bullet from issue #53
This will also make it easier to convert between block <-> item.
2022-10-05 09:28:08 -07:00
Ryan b330f97642 Remove top level object from enchantments 2022-10-04 23:16:48 -07:00
Terminator 838a75d2f9
Add basic enchantment extraction (#93)
* Add basic enchantment extraction

* Change source format to individual fields rather than a list

Co-authored-by: Terminator <terminator@nonexistent.com>
2022-09-29 12:34:44 -07:00
Carson McManus 46b62f29a8
add readme for extractor (#90) 2022-09-27 16:22:28 -07:00
Carson McManus dfce70ef5c
check gradlew for the extractor into git (#88)
This is how it's intended to be used. See https://stackoverflow.com/questions/20348451/why-should-the-gradle-wrapper-be-committed-to-vcs
2022-09-27 13:06:34 -07:00
Ryan 79399c153e Update to 1.19.2 2022-08-30 18:41:17 -07:00
Ryan 02fe0bae3b Sort entity extractor output for better diffing 2022-08-12 10:28:16 -07:00
Ryan 9c67978e06 Add collision shapes to block states 2022-08-06 16:46:07 -07:00
Ryan c8fe351dd3 Extract packets 2022-07-29 02:38:53 -07:00
Ryan ffad0b4021 Use the extracted data in the block generator 2022-07-28 08:15:23 -07:00
Ryan 2ceceed0d9 Deduplicate collision shapes 2022-07-28 06:38:13 -07:00
Ryan 2e22946ffc Rewrite the entity generator 2022-07-27 07:10:35 -07:00
Ryan f97c67d42a Extract entity animation codes 2022-07-26 23:50:19 -07:00
Ryan 37f5789202 Extract more data from entities 2022-07-26 02:18:32 -07:00
Ryan d95c51b492 Fix missing translation keys in entity extractor 2022-07-25 19:33:09 -07:00
Ryan 500a905314 Add bit fields to entity extractor output 2022-07-24 22:08:57 -07:00
Ryan c932b6cd71 Isolate each extractor 2022-07-21 04:06:19 -07:00
Ryan e0b371d23c Make trackedDataToJson more robust 2022-07-21 02:47:42 -07:00
Ryan 682f73bda8 Extract entity status codes 2022-07-20 23:35:19 -07:00
Ryan 37b285209f Extract default values for entity fields 2022-07-20 22:51:01 -07:00
Ryan b9fca3503c Add entity extractor 2022-07-20 01:12:13 -07:00
Ryan f9be05ee4a Add extractor fabric mod 2022-07-19 05:15:05 -07:00