commits
# Objective
Try to fix the Publish Website workflow again
# Solution
Update `deploy-pages` to `v4`
# Objective
Specify the Rust toolchain version in the CI workflows so that unrelated
issues don't pop up in PRs.
# Solution
Replace all instances of `toolchain: "nightly"` with `toolchain:
"1.89.0"`
# Objective
Fix the build error in the Publish Website workflow.
The error message:
`Missing download info for actions/upload-artifact@v3`
# Solution
Update the `upload-pages-artifact` version from `v2` to `v3`
# Objective
Make the stresser compile properly again.
Current you get this error when you attempt to compile:
```
error[E0599]: no method named `set_compression` found for struct `PacketDecoder` in the current scope
--> tools/stresser/src/stresser.rs:89:25
|
89 | dec.set_compression(CompressionThreshold(threshold));
| ^^^^^^^^^^^^^^^ method not found in `PacketDecoder`
error[E0599]: no method named `set_compression` found for struct `PacketEncoder` in the current scope
--> tools/stresser/src/stresser.rs:90:25
|
90 | enc.set_compression(CompressionThreshold(threshold));
| ^^^^^^^^^^^^^^^ method not found in `PacketEncoder`
```
# Solution
Enable the `compression` feature in `valence_protocol` in the stresser
`Cargo.toml` file.
# Objective
Fixes the CI issues in #686
# Solution
Create an explicit reference to the slice instead of relying on the
implicit autoref
# Objective
To broadcast players' item interactions to other players as part of
`EquipmentPlugin`
# Solution
When a player has the `EquipmentInteractionBroadcast` component:
- Set the "use_item" LivingFlag to true whenever an `InteractItemEvent`
is received
- Set the flag false when a `PlayerActionC2s` packet with a
`PlayerAction::ReleaseUseItem` action is received
Fix empty scopes in command macros and make scopes effect alternate enum
paths.
# Objective
Fix the clippy errors in the CI
# Solution
- Run `cargo +stable clippy --workspace --no-deps --all-features
--all-targets --fix -- -D warnings` multiple times
- Add `#[allow(clippy::large_stack_arrays)]`
https://github.com/valence-rs/valence/blob/8f3f84d557dacddd7faddb2ad724185ecee2e482/crates/valence_generated/build/block.rs#L695
- Replace every triple slash comment in `valence_generated` and
`valence_entity` with `#[doc]`
- Replace eliding `'a` lifetimes in `stresser.rs` with a single `'_`
fixes a desync where a player with readonly inventory perfoms a block
interaction (such as placing a block).
# Objective
- make valence work with entity equipment (armor, main/off hand items)
# Solution
adds the crate `valence_equipment` that exposes the Equipment Plugin.
every `LivingEntity` will have a `Equipment` Component.
The Equipment plugin will NOT be compatible with the inventory by
default (thats intended, as that makes it possible to use the equipment
feature without the inventory feature + I do think there are probably
use cases where you want to make players appear as having armor,
although they dont have it in their inventory)
This PR would add Events when entities are (un)loaded by a player (used
for sending equipment once the player loads an entity). I do believe
this might also be a useful feature outside of the equipment feature.
used #254 as reference + stole example idea
fixes #662
Opening as a draft for now (might refactor the updating/event emitting
system).
Let me know what you think of the Entity Load/Unload events.
# Objective
- fixes #666
# Solution
- also check for changes in the player's `Inventory` when viewing an
open inventory
Client NBT can be different from whats on the server (e.g when you have
armor on you and you move it, the client will add the Damage value). For
``ClickMode::ShiftClicking``/``ClickMode::Click`` this is already
handled
https://github.com/valence-rs/valence/blob/76fb18f185913a9279862a3084787b2afeb514f2/crates/valence_inventory/src/validate.rs#L198.
Now its also handled for `ClickMode::Hotbar`
Adds a example for using an inventory with the ``readonly`` flag as a
item menu (using a ``ItemMenu`` component, that can be attached to a
player)
related #307
video clip:
https://github.com/user-attachments/assets/441e165a-139a-43ec-9970-3055c7f7f79a
# Objective
Fixes some re-syncs because the validation did not accept the now
specific cases (all of the affected modifications where cases where the
user did not modify the inventory)
Cases like:
- user clicks without an item on the cursor outside the inventory
- user clicks on the margin area without an item held
- user clicks on an empty slot when not holding anything
- user uses hotbar keybinds on an empty slot to an empty hotbar slot
This causes unneccery re-syncs to the client and also unneccery logs
indicating some illegal client packets, while these packets are totaly
fine
# Solution
adjusted packet validation logic to allow these cases, but also check
for "conservation of mass" when these special magic slot ids shows up
modified the handling code to basically ignore these changes, (I guess
there is room for improvement here, as some event would probably be nice
to publish in these cases?)
# Objective
This pr attempts to solve some components that got triggered
unnecessarily
can be observed with a simple system like this:
```rust
fn log_inventories(invs: Query<(Entity, &Inventory), Changed<Inventory>>) {
for inv in invs.iter() {
println!("inventory updated");
}
}
```
the above system will print each tick when an inventory is open, this
will result in systems like the one above will trigger unnecessarily
# Solution
To solve this I found the places where we currently "reset" some state
in the inventory module each tick and replaced the modifications with
alternatives that only trigger a modification if the value needed to be
reset (was not in the reset state)
# Objective
When trying to use the packet inspector I noticed that it could not be
ran on nix, the `nix develop` simply does not include the required
libraries.
# Solution
I added dependencies listed for bevy window applications to work:
https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md#nix
and cleaned up the flake a bit while I was at it.
# Objective
- ability to make inventories read only (player should be able to click
things in the inventory and still emit a click event, this can be useful
for creating inventory menus.
- closes #427
- related #307 #355
# Solution
- adds a public ``readonly: bool`` field to the ``Inventory`` component,
that will make any interactions with this item impossible (includes:
moving, shift moving, hotbar moving, dropping) if a player inventory is
readonly, then the player will also not be able to drop items (even when
not in the inventory), so the drop event will not be emitted (this could
be changed if requested)
- when implementing this i discovered a bug where a player is not able
to put a item from a open inventory in the offhand (by hitting F) that
will cause a desync. On the client the item will be in the offhand, but
if you try to interact with that it dissapears. (unrelated to this PR
and will not be fixed in this PR)
---------
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
# Objective
Attempts to solve the issue shown in discord
https://discord.com/channels/998132822239870997/1292890441011957830
where doing has no effect in a "open inventory"
Looks like an oversight in the system to update the open inventories, no
attempt to send any packet to the user was made when the `CursorItem`
component was updated by any system
Playground to reproduce the issue solved by this pr.
```rust
use valence::interact_block::InteractBlockEvent;
use valence::inventory::ClickSlotEvent;
use valence::log::LogPlugin;
use valence::prelude::*;
#[allow(unused_imports)]
use crate::extras::*;
const SPAWN_Y: i32 = 64;
const CHEST_POS: [i32; 3] = [0, SPAWN_Y + 1, 3];
pub(crate) fn build_app(app: &mut App) {
app.insert_resource(NetworkSettings {
connection_mode: ConnectionMode::Offline,
..Default::default()
})
.add_plugins(DefaultPlugins.build().disable::<LogPlugin>())
.add_systems(Startup, setup)
.add_systems(
EventLoopUpdate,
(toggle_gamemode_on_sneak, open_chest, select_menu_item),
)
.add_systems(Update, (init_clients, despawn_disconnected_clients))
.run();
}
fn setup(
mut commands: Commands,
server: Res<Server>,
biomes: Res<BiomeRegistry>,
dimensions: Res<DimensionTypeRegistry>,
) {
let mut layer = LayerBundle::new(ident!("overworld"), &dimensions, &biomes, &server);
for z in -5..5 {
for x in -5..5 {
layer.chunk.insert_chunk([x, z], UnloadedChunk::new());
}
}
for z in -25..25 {
for x in -25..25 {
layer
.chunk
.set_block([x, SPAWN_Y, z], BlockState::GRASS_BLOCK);
}
}
layer.chunk.set_block(CHEST_POS, BlockState::CHEST);
commands.spawn(layer);
let mut inventory = Inventory::new(InventoryKind::Generic9x3);
inventory.set_slot(1, ItemStack::new(ItemKind::Apple, 64, None));
inventory.set_slot(2, ItemStack::new(ItemKind::Diamond, 40, None));
inventory.set_slot(3, ItemStack::new(ItemKind::Diamond, 30, None));
commands.spawn(inventory);
}
fn init_clients(
mut clients: Query<
(
&mut EntityLayerId,
&mut VisibleChunkLayer,
&mut VisibleEntityLayers,
&mut Position,
),
Added<Client>,
>,
layers: Query<Entity, (With<ChunkLayer>, With<EntityLayer>)>,
) {
for (mut layer_id, mut visible_chunk_layer, mut visible_entity_layers, mut pos) in &mut clients
{
let layer = layers.single();
layer_id.0 = layer;
visible_chunk_layer.0 = layer;
visible_entity_layers.0.insert(layer);
pos.set([0.0, f64::from(SPAWN_Y) + 1.0, 0.0]);
}
}
fn open_chest(
mut commands: Commands,
inventories: Query<Entity, (With<Inventory>, Without<Client>)>,
mut events: EventReader<InteractBlockEvent>,
) {
for event in events.read() {
if event.position != CHEST_POS.into() {
continue;
}
let open_inventory = OpenInventory::new(inventories.single());
commands.entity(event.client).insert(open_inventory);
}
}
fn select_menu_item(
mut clients: Query<(Entity, &mut CursorItem)>,
mut events: EventReader<ClickSlotEvent>,
) {
for event in events.read() {
let Ok((_player, mut cursor_item)) = clients.get_mut(event.client) else {
continue;
};
// this does not work properly
cursor_item.set_if_neq(CursorItem(ItemStack::EMPTY));
}
}
// Add more systems here!
```
# Solution
Copied the approach to sync the `CursorItem` state from the
`update_player_inventories` system to the `update_open_inventories`
where it was previously left out (my assumption is that it was left out
by mistake).
# Objective
I noticed that when trying to diagnose an issue that we don't compile
with the current nix lock, (rust being to old)
```
error: package `tokio-macros v2.4.0` cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.65.0-nightly
```
# Solution
ran `nix flake update`, and now it brings in a recent enough rust
nightly for everything to compile
By a vote on the discord server 17 to 0 to remove this note. This is due
to lack of interest in this rewrite and lack of control over Evenio and
the tracking issue itself.
Update the version of the extractor to 1.21.1
https://github.blog/changelog/2024-02-13-deprecation-notice-v1-and-v2-of-the-artifact-actions/:
> With the introduction of v4, we will be deprecating v1 and v2 of
actions/upload-artifact, actions/download-artifact, and related npm
packages on June 30, 2024. We strongly encourage customers to update
their workflows to begin using v4 of the artifact actions.
EDIT: I have also updated deps to fix issues with CI
# Objective
Fix the incorrect code in the guidebook setup chapter.
# Solution
Change `visible_entity_layers.insert(layer);` to
`visible_entity_layers.0.insert(layer);`
# Objective
- Fixes #628
# Solution
- In `init_client()`, I inserted the `CombatState` component into the
player
bafbi and I are working on updating the extractor. Some of the formats
for the extractor have changed and this will be addressed in a future
pr.
---------
Co-authored-by: Bafbi <bafbi3@gmail.com>
For some silly reason when I updated to bevy 0.14 I copy pasted some
code and forgot to change it. This fixes that.
# Objective
- Added support for aarch64 platform for NixOS
# Solution
- Just add the `aarch64-linux` field in `flake.nix`
This PR adds a Nix development environment that will allow Nix users to
easily build and work on valence without having to write their own.
If using flakes you can get into the development shell using `nix
develop`, otherwise you can use `nix-shell`
- The already visited map was using edge-type not the id of the parent
and the node its pointing too this leads to a situation where if two
nodes redirect to the same node only one path will be sent to the client
while the other is ignored (this could even be non deterministic)
- The macro supports structs and enums now updated docs to reflect
- Added space in docs for readability
- added some debug and trace logging for commands (Is it a good idea to
have the command dispatched message on info?)
# Objective
Fix the CI
# Solution
- fix generated code and ignore specific style hints.
- some other misc fixes
Bumps [com.google.code.gson:gson](https://github.com/google/gson) from
2.10.1 to 2.11.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/google/gson/commit/828a97be0f8d58108b140b77df8dc76b657f4a87"><code>828a97b</code></a>
[maven-release-plugin] prepare release gson-parent-2.11.0</li>
<li><a
href="https://github.com/google/gson/commit/93bc0f23a13f9e9df3bf71894d479dbd5d952ba6"><code>93bc0f2</code></a>
Skip signing graal-native-test module. (<a
href="https://redirect.github.com/google/gson/issues/2675">#2675</a>)</li>
<li><a
href="https://github.com/google/gson/commit/b153ca18bfef611edff4dbea85de79e153ea4809"><code>b153ca1</code></a>
[maven-release-plugin] rollback the release of gson-parent-2.11.0</li>
<li><a
href="https://github.com/google/gson/commit/0e3d2aab622fb50addb98b10b0a661cadda0f989"><code>0e3d2aa</code></a>
[maven-release-plugin] prepare for next development iteration</li>
<li><a
href="https://github.com/google/gson/commit/545b802d639917c50928ec96bcab49b0c70dbb7a"><code>545b802</code></a>
[maven-release-plugin] prepare release gson-parent-2.11.0</li>
<li><a
href="https://github.com/google/gson/commit/8bfdbb4e14172b013c3d1f56c3a36812075e2886"><code>8bfdbb4</code></a>
Guarantee that <code>JsonElement.toString()</code> produces JSON (<a
href="https://redirect.github.com/google/gson/issues/2659">#2659</a>)</li>
<li><a
href="https://github.com/google/gson/commit/9008b093ac40f226643df17c767357aa1947984a"><code>9008b09</code></a>
Extend Troubleshooting Guide with some ProGuard / R8 information (<a
href="https://redirect.github.com/google/gson/issues/2656">#2656</a>)</li>
<li><a
href="https://github.com/google/gson/commit/05652c3b7dea68a9ffc781b2cdf89076fce56b12"><code>05652c3</code></a>
Document that other JVM languages are not fully supported (<a
href="https://redirect.github.com/google/gson/issues/2666">#2666</a>)</li>
<li><a
href="https://github.com/google/gson/commit/454a49127f9416f45221eecf311eefdca50e4cdc"><code>454a491</code></a>
Improved Long-Double Number Policy (<a
href="https://redirect.github.com/google/gson/issues/2674">#2674</a>)</li>
<li><a
href="https://github.com/google/gson/commit/570d91194e223132982d56b6fa499af15fd7b1ea"><code>570d911</code></a>
Bump the github-actions group with 4 updates (<a
href="https://redirect.github.com/google/gson/issues/2671">#2671</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/google/gson/compare/gson-parent-2.10.1...gson-parent-2.11.0">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
As discussed in the discord I will defer updating bevy to its own PR.
(1/2) of point num 3 of #620 . I am not sure how to close all the
dependabot PRs.
Updates the requirements on
[glam](https://github.com/bitshifter/glam-rs) to permit the latest
version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/bitshifter/glam-rs/blob/main/CHANGELOG.md">glam's
changelog</a>.</em></p>
<blockquote>
<h2>[0.25.0] - 2023-12-19</h2>
<h3>Breaking changes</h3>
<ul>
<li>Changed <code>Vec4</code> to always used <code>BVec4A</code> as a
mask type, regardless if the
target architecture has SIMD support in glam. Previously this was
inconsistent
on different hardware like ARM. This will have a slight performance cost
when
SIMD is not available. <code>Vec4</code> will continue to use
<code>BVec4</code> as a mask type when
the <code>scalar-math</code> feature is used.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>
<p>Made <code>Affine2</code> implement the
<code>bytemuck::AnyBitPattern</code> trait instead of
<code>bytemuck::Pod</code> as it contains internal padding due to
<code>Mat2</code> being 16 byte
aligned.</p>
</li>
<li>
<p>Updated the <code>core-simd</code> implementation to build on latest
nightly.</p>
</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>to_angle</code> method to 2D vectors.</p>
</li>
<li>
<p>Added <code>FloatExt</code> trait which adds <code>lerp</code>,
<code>inverse_lerp</code> and <code>remap</code> methods
to <code>f32</code> and <code>f64</code> types.</p>
</li>
<li>
<p>Added <code>i16</code> and <code>u16</code> vector types,
<code>I16Vec2</code>, <code>I16Vec3</code>, <code>I16Vec4</code>,
<code>U16Vec2</code>, <code>U16Vec3</code> and <code>U16Vec4</code>.</p>
</li>
</ul>
<h3>Changed</h3>
<ul>
<li>
<p>Renamed <code>Quat::as_f64()</code> to <code>Quat::as_dquat()</code>
and <code>DQuat::as_f32()</code> to
<code>DQuat::as_quat()</code> to be consistent with other types. The old
methods have
been deprecated.</p>
</li>
<li>
<p>Added the <code>#[must_use]</code> attribute to all pure functions
following the
guidelines for the Rust standard library.</p>
</li>
</ul>
<h2>[0.24.2] - 2023-09-23</h2>
<h3>Fixed</h3>
<ul>
<li>Fixed singularities in <code>Quat::to_euler</code>.</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>div_euclid</code> and <code>rem_euclid</code> to integer
vector types.</p>
</li>
<li>
<p>Added wrapping and saturating arithmetic operations to integer vector
types.</p>
</li>
<li>
<p>Added <code>to_scale_angle_translation</code> to 2D affine types.</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/bitshifter/glam-rs/compare/0.25.0...0.25.0">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
i added the code to make switching the items in main and offhand work
with the PlayerAction from it.
I tested it and it worked.
# Objective
- So that anybody can open a codespace with rust and java on it
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
# Objective
IndexMap remove methods are deprecated in favor of [swap|shift]_remove
# Solution
match serde_json's implementation of swap and shift remove
---------
Co-authored-by: AviiNL <me@avii.nl>
# Objective
- Potion effects aren't supported by valence yet.
- You can send a packet to tell the client about a potion effect, but
the server still has no idea what they are
<details>
<summary>Example code</summary>
```rs
pub fn add_potion_effect(mut clients: Query<&mut Client>, mut events: EventReader<SneakEvent>) {
for event in events.iter() {
if event.state == SneakState::Start {
if let Ok(mut client) = clients.get_mut(event.client) {
client.write_packet(&EntityStatusEffectS2c {
entity_id: VarInt(0),
effect_id: VarInt(22),
amplifier: 0,
duration: VarInt(600),
flags: entity_status_effect_s2c::Flags::new()
.with_show_particles(true)
.with_show_icon(true),
factor_codec: None,
});
}
}
}
}
```
</details>
- Closes #401
- Also, when the potion effect expires, we need to tell the client that
their potion effect is no longer. Right now, with sending a packet, the
effect doesn't get removed when it goes down to 00:00.
# Solution
I want to add the necessary components and stuff to facilitate potion
effects.
> Note: I'm still somewhat new to rust and very new to bevy, so please
lmk if I can improve anything or if I should do anything differently.
Thanks!
# To do:
- [x] Extractor
- [x] `ActiveStatusEffects` component to handle the actual status effect
applied to the mc entity
- [x] Add `ActiveStatusEffects` component to all entities.
- [x] Make a plugin to handle potion effects
- [x] Decrease tick count
- [x] Remove effect (& tell client) when tick count is 0
- [x] Make the effects do stuff
- [x] Particles
- [x] Tell client
- [x] Add tests
- [x] Add example
- [x] Add examples on how to implement potion effects (speed, instant
health, etc.)
- [x] Extract stuff to make it easier to implement potions. See #593
# Playground
<details>
<summary>Current playground</summary>
```rs
use valence::client::despawn_disconnected_clients;
use valence::entity::active_status_effects::{ActiveStatusEffect, ActiveStatusEffects};
use valence::entity::status_effects::StatusEffect;
use valence::log::LogPlugin;
use valence::network::ConnectionMode;
use valence::prelude::*;
#[allow(unused_imports)]
use crate::extras::*;
const SPAWN_Y: i32 = 64;
pub fn build_app(app: &mut App) {
app.insert_resource(NetworkSettings {
connection_mode: ConnectionMode::Offline,
..Default::default()
})
.add_plugins(DefaultPlugins.build().disable::<LogPlugin>())
.add_systems(Startup, setup)
.add_systems(EventLoopUpdate, add_potion_effect)
.add_systems(Update, (init_clients, despawn_disconnected_clients))
.run();
}
fn setup(
mut commands: Commands,
server: Res<Server>,
biomes: Res<BiomeRegistry>,
dimensions: Res<DimensionTypeRegistry>,
) {
let mut layer = LayerBundle::new(ident!("overworld"), &dimensions, &biomes, &server);
for z in -5..5 {
for x in -5..5 {
layer.chunk.insert_chunk([x, z], UnloadedChunk::new());
}
}
for z in -25..25 {
for x in -25..25 {
layer
.chunk
.set_block([x, SPAWN_Y, z], BlockState::GRASS_BLOCK);
}
}
commands.spawn(layer);
}
fn init_clients(
mut clients: Query<
(
&mut EntityLayerId,
&mut VisibleChunkLayer,
&mut VisibleEntityLayers,
&mut Position,
&mut GameMode,
),
Added<Client>,
>,
layers: Query<Entity, (With<ChunkLayer>, With<EntityLayer>)>,
) {
for (
mut layer_id,
mut visible_chunk_layer,
mut visible_entity_layers,
mut pos,
mut game_mode,
) in &mut clients
{
let layer = layers.single();
layer_id.0 = layer;
visible_chunk_layer.0 = layer;
visible_entity_layers.0.insert(layer);
pos.set([0.0, SPAWN_Y as f64 + 1.0, 0.0]);
*game_mode = GameMode::Survival;
}
}
pub fn add_potion_effect(
mut clients: Query<&mut ActiveStatusEffects>,
mut events: EventReader<SneakEvent>,
) {
for event in events.iter() {
if event.state == SneakState::Start {
if let Ok(mut status) = clients.get_mut(event.client) {
status.add(
ActiveStatusEffect::from_effect(StatusEffect::Wither)
.with_amplifier(2)
.with_duration(200),
);
}
}
}
}
```
</details>
---------
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
# Objective
Certain potion status effects have attribute modifiers. Accessing them
would make using them much easier.
# Solution
- Extract them
- Also need to change how attribute modifiers are extracted and built. I
originally put them in `valence_entity`, but I think they would fit
better in `valence_generated` (just the generated stuff, we're still
using them in `valence_entity`)
# Objective
I went a bit too fast yesterday and forgot a few `Uuid::new_v4()` at one
location. @DasLixou pointed that out to me. Thx.
# Solution
Fix it.
# Objective
I made a bad decision to use names instead of UUID, like how Minecraft
does it. This means that implementing certain features won't behave like
they do in Vanilla (e.g. potion effects like speed, and running. they
use specific UUIDs)
# Solution
- Use UUIDs
Updates the requirements on
[glam](https://github.com/bitshifter/glam-rs) to permit the latest
version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/bitshifter/glam-rs/blob/main/CHANGELOG.md">glam's
changelog</a>.</em></p>
<blockquote>
<h2>[0.24.2] - 2023-09-23</h2>
<h3>Fixed</h3>
<ul>
<li>Fixed singularities in <code>Quat::to_euler</code>.</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>div_euclid</code> and <code>rem_euclid</code> to integer
vector types.</p>
</li>
<li>
<p>Added wrapping and saturating arithmetic operations to integer vector
types.</p>
</li>
<li>
<p>Added <code>to_scale_angle_translation</code> to 2D affine types.</p>
</li>
<li>
<p>Added <code>mul_assign</code> ops to affine types.</p>
</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Disable default features on optional <code>rkyv</code>
dependency.</li>
</ul>
<h2>[0.24.1] - 2023-06-24</h2>
<h3>Added</h3>
<ul>
<li>
<p>Implemented missing <code>bytemuck</code>, <code>mint</code>,
<code>rand</code>, <code>rkyv</code> and <code>serde</code> traits for
<code>i64</code> and <code>u64</code> types.</p>
</li>
<li>
<p>Added missing safe <code>From</code> conversions from
<code>f32</code> vectors to <code>f64</code> vectors.</p>
</li>
<li>
<p>Added <code>TryFrom</code> implementations between different vector
types.</p>
</li>
<li>
<p>Added <code>test</code> and <code>set</code> methods to
<code>bool</code> vector types for testing and setting
individual mask elements.</p>
</li>
<li>
<p>Added <code>MIN</code>, <code>MAX</code>, <code>INFINITY</code> and
<code>NEG_INFINITY</code> vector constants.</p>
</li>
</ul>
<h2>[0.24.0] - 2023-04-24</h2>
<h3>Breaking changes</h3>
<ul>
<li>Enabling <code>libm</code> in a <code>std</code> build now overrides
the <code>std</code> math functions. This
is unlikely to break anything but it is a change in behavior.</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>i64</code> and <code>u64</code> vector types;
<code>I64Vec2</code>, <code>I64Vec3</code>, <code>I64Vec4</code>,
<code>U64Vec2</code>, <code>U64Vec3</code> and <code>U64Vec4</code>.</p>
</li>
<li>
<p>Added <code>length_squared</code> method on signed and unsigned
integer vector types.</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/2641f2b0e54ffacd8b02a0ddef9d4d447f5652c5"><code>2641f2b</code></a>
Prepare for 0.24.2 release.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/f6ce74580a2947d415630253f7c3b3209c71eddf"><code>f6ce745</code></a>
Update CHANGELOG.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/cd822d176506a0f14a9256f39d7398719670955a"><code>cd822d1</code></a>
Add some tests for affine types mul_assign ops.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/030c4e22166715faa084312f0085971872de81d4"><code>030c4e2</code></a>
Implement <code>MulAssign</code> for affine types (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/425">#425</a>)</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/121d0e21182083d894e1303dae5e79c760b30122"><code>121d0e2</code></a>
Updated CHANGELOG with unreleased changes.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/b76110b707a7628239a5117e9724df696fa47e8e"><code>b76110b</code></a>
Doc fix for *Vec4::truncate.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/f3832dc1ca1f3ba6e0ad02c7606093891f0b468a"><code>f3832dc</code></a>
Add <code>to_scale_angle_translation</code> (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/430">#430</a>)</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/2db9a7fb548d01869ec8264f8019aa6352120da0"><code>2db9a7f</code></a>
Fix coverage action.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/efae39e6b552d0c1f56d5715e41d3bef60c09481"><code>efae39e</code></a>
Implement wrapping/saturating integer arithmetic methods (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/429">#429</a>)</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/d40d1464ac51669ab308faf7845f5284827183de"><code>d40d146</code></a>
Fix singularities in <code>Quat::to_euler()</code> (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/427">#427</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/bitshifter/glam-rs/compare/0.24.1...0.24.2">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Objective
The Player Inventory only focused on the main slots. Now it can process
all of its slots
# Solution

Possibility to index all of the player's inventory slots.
This also reverts #588
---------
Co-authored-by: Carson McManus <carson.mcmanus1@gmail.com>
# Objective
Add player inventory slots constants, so developers would not need to
lookup them themselves
# Solution
Added constant slots into `slots` module
Based on this image (notice that index on image starts from 1, not 0)

Generated with this code:
```rust
fn debug_inventory(inv: &mut Inventory) {
for slot in 0..inv.slot_count() {
inv.set_slot(
slot,
ItemStack::new(ItemKind::Cobblestone, (slot + 1) as i8, None),
);
}
}
```
---------
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
Updates the requirements on
[itertools](https://github.com/rust-itertools/itertools) to permit the
latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md">itertools's
changelog</a>.</em></p>
<blockquote>
<h2>0.11.0</h2>
<h3>Breaking</h3>
<ul>
<li>Make <code>Itertools::merge_join_by</code> also accept functions
returning bool (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/704">#704</a>)</li>
<li>Implement <code>PeekingNext</code> transitively over mutable
references (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/643">#643</a>)</li>
<li>Change <code>with_position</code> to yield <code>(Position,
Item)</code> instead of <code>Position<Item></code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/699">#699</a>)</li>
</ul>
<h3>Added</h3>
<ul>
<li>Add <code>Itertools::take_while_inclusive</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/616">#616</a>)</li>
<li>Implement <code>PeekingNext</code> for <code>PeekingTakeWhile</code>
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/644">#644</a>)</li>
<li>Add <code>EitherOrBoth::{just_left, just_right, into_left,
into_right, as_deref, as_deref_mut, left_or_insert, right_or_insert,
left_or_insert_with, right_or_insert_with, insert_left, insert_right,
insert_both}</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/629">#629</a>)</li>
<li>Implement <code>Clone</code> for <code>CircularTupleWindows</code>
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/686">#686</a>)</li>
<li>Implement <code>Clone</code> for <code>Chunks</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/683">#683</a>)</li>
<li>Add <code>Itertools::process_results</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/680">#680</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Use <code>Cell</code> instead of <code>RefCell</code> in
<code>Format</code> and <code>FormatWith</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/608">#608</a>)</li>
<li>CI tweaks (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/674">#674</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/675">#675</a>)</li>
<li>Document and test the difference between stable and unstable sorts
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/653">#653</a>)</li>
<li>Fix documentation error on <code>Itertools::max_set_by_key</code>
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/692">#692</a>)</li>
<li>Move MSRV metadata to <code>Cargo.toml</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/672">#672</a>)</li>
<li>Implement <code>equal</code> with <code>Iterator::eq</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/591">#591</a>)</li>
</ul>
<h2>0.10.5</h2>
<ul>
<li>Maintenance</li>
</ul>
<h2>0.10.4</h2>
<ul>
<li>Add <code>EitherOrBoth::or</code> and
<code>EitherOrBoth::or_else</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/593">#593</a>)</li>
<li>Add <code>min_set</code>, <code>max_set</code> et al. (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/613">#613</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/323">#323</a>)</li>
<li>Use <code>either/use_std</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/628">#628</a>)</li>
<li>Documentation fixes (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/612">#612</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/625">#625</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/632">#632</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/633">#633</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/634">#634</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/638">#638</a>)</li>
<li>Code maintenance (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/623">#623</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/624">#624</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/627">#627</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/630">#630</a>)</li>
</ul>
<h2>0.10.3</h2>
<ul>
<li>Maintenance</li>
</ul>
<h2>0.10.2</h2>
<ul>
<li>Add <code>Itertools::multiunzip</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/362">#362</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/565">#565</a>)</li>
<li>Add <code>intersperse</code> and <code>intersperse_with</code> free
functions (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/555">#555</a>)</li>
<li>Add <code>Itertools::sorted_by_cached_key</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/424">#424</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/575">#575</a>)</li>
<li>Specialize <code>ProcessResults::fold</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/563">#563</a>)</li>
<li>Fix subtraction overflow in <code>DuplicatesBy::size_hint</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/552">#552</a>)</li>
<li>Fix specialization tests (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/574">#574</a>)</li>
<li>More <code>Debug</code> impls (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/573">#573</a>)</li>
<li>Deprecate <code>fold1</code> (use <code>reduce</code> instead) (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/580">#580</a>)</li>
<li>Documentation fixes (<code>HomogenousTuple</code>,
<code>into_group_map</code>, <code>into_group_map_by</code>,
<code>MultiPeek::peek</code>) (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/543">#543</a>
et al.)</li>
</ul>
<h2>0.10.1</h2>
<ul>
<li>Add <code>Itertools::contains</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/514">#514</a>)</li>
<li>Add <code>Itertools::counts_by</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/515">#515</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/rust-itertools/itertools/compare/v0.11.0...v0.11.0">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Objective
Bevy should be updated to 0.12.0.
# Solution
Update bevy.
# Objective
Make the stresser compile properly again.
Current you get this error when you attempt to compile:
```
error[E0599]: no method named `set_compression` found for struct `PacketDecoder` in the current scope
--> tools/stresser/src/stresser.rs:89:25
|
89 | dec.set_compression(CompressionThreshold(threshold));
| ^^^^^^^^^^^^^^^ method not found in `PacketDecoder`
error[E0599]: no method named `set_compression` found for struct `PacketEncoder` in the current scope
--> tools/stresser/src/stresser.rs:90:25
|
90 | enc.set_compression(CompressionThreshold(threshold));
| ^^^^^^^^^^^^^^^ method not found in `PacketEncoder`
```
# Solution
Enable the `compression` feature in `valence_protocol` in the stresser
`Cargo.toml` file.
# Objective
To broadcast players' item interactions to other players as part of
`EquipmentPlugin`
# Solution
When a player has the `EquipmentInteractionBroadcast` component:
- Set the "use_item" LivingFlag to true whenever an `InteractItemEvent`
is received
- Set the flag false when a `PlayerActionC2s` packet with a
`PlayerAction::ReleaseUseItem` action is received
# Objective
Fix the clippy errors in the CI
# Solution
- Run `cargo +stable clippy --workspace --no-deps --all-features
--all-targets --fix -- -D warnings` multiple times
- Add `#[allow(clippy::large_stack_arrays)]`
https://github.com/valence-rs/valence/blob/8f3f84d557dacddd7faddb2ad724185ecee2e482/crates/valence_generated/build/block.rs#L695
- Replace every triple slash comment in `valence_generated` and
`valence_entity` with `#[doc]`
- Replace eliding `'a` lifetimes in `stresser.rs` with a single `'_`
# Objective
- make valence work with entity equipment (armor, main/off hand items)
# Solution
adds the crate `valence_equipment` that exposes the Equipment Plugin.
every `LivingEntity` will have a `Equipment` Component.
The Equipment plugin will NOT be compatible with the inventory by
default (thats intended, as that makes it possible to use the equipment
feature without the inventory feature + I do think there are probably
use cases where you want to make players appear as having armor,
although they dont have it in their inventory)
This PR would add Events when entities are (un)loaded by a player (used
for sending equipment once the player loads an entity). I do believe
this might also be a useful feature outside of the equipment feature.
used #254 as reference + stole example idea
fixes #662
Opening as a draft for now (might refactor the updating/event emitting
system).
Let me know what you think of the Entity Load/Unload events.
Client NBT can be different from whats on the server (e.g when you have
armor on you and you move it, the client will add the Damage value). For
``ClickMode::ShiftClicking``/``ClickMode::Click`` this is already
handled
https://github.com/valence-rs/valence/blob/76fb18f185913a9279862a3084787b2afeb514f2/crates/valence_inventory/src/validate.rs#L198.
Now its also handled for `ClickMode::Hotbar`
# Objective
Fixes some re-syncs because the validation did not accept the now
specific cases (all of the affected modifications where cases where the
user did not modify the inventory)
Cases like:
- user clicks without an item on the cursor outside the inventory
- user clicks on the margin area without an item held
- user clicks on an empty slot when not holding anything
- user uses hotbar keybinds on an empty slot to an empty hotbar slot
This causes unneccery re-syncs to the client and also unneccery logs
indicating some illegal client packets, while these packets are totaly
fine
# Solution
adjusted packet validation logic to allow these cases, but also check
for "conservation of mass" when these special magic slot ids shows up
modified the handling code to basically ignore these changes, (I guess
there is room for improvement here, as some event would probably be nice
to publish in these cases?)
# Objective
This pr attempts to solve some components that got triggered
unnecessarily
can be observed with a simple system like this:
```rust
fn log_inventories(invs: Query<(Entity, &Inventory), Changed<Inventory>>) {
for inv in invs.iter() {
println!("inventory updated");
}
}
```
the above system will print each tick when an inventory is open, this
will result in systems like the one above will trigger unnecessarily
# Solution
To solve this I found the places where we currently "reset" some state
in the inventory module each tick and replaced the modifications with
alternatives that only trigger a modification if the value needed to be
reset (was not in the reset state)
# Objective
When trying to use the packet inspector I noticed that it could not be
ran on nix, the `nix develop` simply does not include the required
libraries.
# Solution
I added dependencies listed for bevy window applications to work:
https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md#nix
and cleaned up the flake a bit while I was at it.
# Objective
- ability to make inventories read only (player should be able to click
things in the inventory and still emit a click event, this can be useful
for creating inventory menus.
- closes #427
- related #307 #355
# Solution
- adds a public ``readonly: bool`` field to the ``Inventory`` component,
that will make any interactions with this item impossible (includes:
moving, shift moving, hotbar moving, dropping) if a player inventory is
readonly, then the player will also not be able to drop items (even when
not in the inventory), so the drop event will not be emitted (this could
be changed if requested)
- when implementing this i discovered a bug where a player is not able
to put a item from a open inventory in the offhand (by hitting F) that
will cause a desync. On the client the item will be in the offhand, but
if you try to interact with that it dissapears. (unrelated to this PR
and will not be fixed in this PR)
---------
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
# Objective
Attempts to solve the issue shown in discord
https://discord.com/channels/998132822239870997/1292890441011957830
where doing has no effect in a "open inventory"
Looks like an oversight in the system to update the open inventories, no
attempt to send any packet to the user was made when the `CursorItem`
component was updated by any system
Playground to reproduce the issue solved by this pr.
```rust
use valence::interact_block::InteractBlockEvent;
use valence::inventory::ClickSlotEvent;
use valence::log::LogPlugin;
use valence::prelude::*;
#[allow(unused_imports)]
use crate::extras::*;
const SPAWN_Y: i32 = 64;
const CHEST_POS: [i32; 3] = [0, SPAWN_Y + 1, 3];
pub(crate) fn build_app(app: &mut App) {
app.insert_resource(NetworkSettings {
connection_mode: ConnectionMode::Offline,
..Default::default()
})
.add_plugins(DefaultPlugins.build().disable::<LogPlugin>())
.add_systems(Startup, setup)
.add_systems(
EventLoopUpdate,
(toggle_gamemode_on_sneak, open_chest, select_menu_item),
)
.add_systems(Update, (init_clients, despawn_disconnected_clients))
.run();
}
fn setup(
mut commands: Commands,
server: Res<Server>,
biomes: Res<BiomeRegistry>,
dimensions: Res<DimensionTypeRegistry>,
) {
let mut layer = LayerBundle::new(ident!("overworld"), &dimensions, &biomes, &server);
for z in -5..5 {
for x in -5..5 {
layer.chunk.insert_chunk([x, z], UnloadedChunk::new());
}
}
for z in -25..25 {
for x in -25..25 {
layer
.chunk
.set_block([x, SPAWN_Y, z], BlockState::GRASS_BLOCK);
}
}
layer.chunk.set_block(CHEST_POS, BlockState::CHEST);
commands.spawn(layer);
let mut inventory = Inventory::new(InventoryKind::Generic9x3);
inventory.set_slot(1, ItemStack::new(ItemKind::Apple, 64, None));
inventory.set_slot(2, ItemStack::new(ItemKind::Diamond, 40, None));
inventory.set_slot(3, ItemStack::new(ItemKind::Diamond, 30, None));
commands.spawn(inventory);
}
fn init_clients(
mut clients: Query<
(
&mut EntityLayerId,
&mut VisibleChunkLayer,
&mut VisibleEntityLayers,
&mut Position,
),
Added<Client>,
>,
layers: Query<Entity, (With<ChunkLayer>, With<EntityLayer>)>,
) {
for (mut layer_id, mut visible_chunk_layer, mut visible_entity_layers, mut pos) in &mut clients
{
let layer = layers.single();
layer_id.0 = layer;
visible_chunk_layer.0 = layer;
visible_entity_layers.0.insert(layer);
pos.set([0.0, f64::from(SPAWN_Y) + 1.0, 0.0]);
}
}
fn open_chest(
mut commands: Commands,
inventories: Query<Entity, (With<Inventory>, Without<Client>)>,
mut events: EventReader<InteractBlockEvent>,
) {
for event in events.read() {
if event.position != CHEST_POS.into() {
continue;
}
let open_inventory = OpenInventory::new(inventories.single());
commands.entity(event.client).insert(open_inventory);
}
}
fn select_menu_item(
mut clients: Query<(Entity, &mut CursorItem)>,
mut events: EventReader<ClickSlotEvent>,
) {
for event in events.read() {
let Ok((_player, mut cursor_item)) = clients.get_mut(event.client) else {
continue;
};
// this does not work properly
cursor_item.set_if_neq(CursorItem(ItemStack::EMPTY));
}
}
// Add more systems here!
```
# Solution
Copied the approach to sync the `CursorItem` state from the
`update_player_inventories` system to the `update_open_inventories`
where it was previously left out (my assumption is that it was left out
by mistake).
# Objective
I noticed that when trying to diagnose an issue that we don't compile
with the current nix lock, (rust being to old)
```
error: package `tokio-macros v2.4.0` cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.65.0-nightly
```
# Solution
ran `nix flake update`, and now it brings in a recent enough rust
nightly for everything to compile
https://github.blog/changelog/2024-02-13-deprecation-notice-v1-and-v2-of-the-artifact-actions/:
> With the introduction of v4, we will be deprecating v1 and v2 of
actions/upload-artifact, actions/download-artifact, and related npm
packages on June 30, 2024. We strongly encourage customers to update
their workflows to begin using v4 of the artifact actions.
EDIT: I have also updated deps to fix issues with CI
- The already visited map was using edge-type not the id of the parent
and the node its pointing too this leads to a situation where if two
nodes redirect to the same node only one path will be sent to the client
while the other is ignored (this could even be non deterministic)
- The macro supports structs and enums now updated docs to reflect
- Added space in docs for readability
- added some debug and trace logging for commands (Is it a good idea to
have the command dispatched message on info?)
Bumps [com.google.code.gson:gson](https://github.com/google/gson) from
2.10.1 to 2.11.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/google/gson/commit/828a97be0f8d58108b140b77df8dc76b657f4a87"><code>828a97b</code></a>
[maven-release-plugin] prepare release gson-parent-2.11.0</li>
<li><a
href="https://github.com/google/gson/commit/93bc0f23a13f9e9df3bf71894d479dbd5d952ba6"><code>93bc0f2</code></a>
Skip signing graal-native-test module. (<a
href="https://redirect.github.com/google/gson/issues/2675">#2675</a>)</li>
<li><a
href="https://github.com/google/gson/commit/b153ca18bfef611edff4dbea85de79e153ea4809"><code>b153ca1</code></a>
[maven-release-plugin] rollback the release of gson-parent-2.11.0</li>
<li><a
href="https://github.com/google/gson/commit/0e3d2aab622fb50addb98b10b0a661cadda0f989"><code>0e3d2aa</code></a>
[maven-release-plugin] prepare for next development iteration</li>
<li><a
href="https://github.com/google/gson/commit/545b802d639917c50928ec96bcab49b0c70dbb7a"><code>545b802</code></a>
[maven-release-plugin] prepare release gson-parent-2.11.0</li>
<li><a
href="https://github.com/google/gson/commit/8bfdbb4e14172b013c3d1f56c3a36812075e2886"><code>8bfdbb4</code></a>
Guarantee that <code>JsonElement.toString()</code> produces JSON (<a
href="https://redirect.github.com/google/gson/issues/2659">#2659</a>)</li>
<li><a
href="https://github.com/google/gson/commit/9008b093ac40f226643df17c767357aa1947984a"><code>9008b09</code></a>
Extend Troubleshooting Guide with some ProGuard / R8 information (<a
href="https://redirect.github.com/google/gson/issues/2656">#2656</a>)</li>
<li><a
href="https://github.com/google/gson/commit/05652c3b7dea68a9ffc781b2cdf89076fce56b12"><code>05652c3</code></a>
Document that other JVM languages are not fully supported (<a
href="https://redirect.github.com/google/gson/issues/2666">#2666</a>)</li>
<li><a
href="https://github.com/google/gson/commit/454a49127f9416f45221eecf311eefdca50e4cdc"><code>454a491</code></a>
Improved Long-Double Number Policy (<a
href="https://redirect.github.com/google/gson/issues/2674">#2674</a>)</li>
<li><a
href="https://github.com/google/gson/commit/570d91194e223132982d56b6fa499af15fd7b1ea"><code>570d911</code></a>
Bump the github-actions group with 4 updates (<a
href="https://redirect.github.com/google/gson/issues/2671">#2671</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/google/gson/compare/gson-parent-2.10.1...gson-parent-2.11.0">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on
[glam](https://github.com/bitshifter/glam-rs) to permit the latest
version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/bitshifter/glam-rs/blob/main/CHANGELOG.md">glam's
changelog</a>.</em></p>
<blockquote>
<h2>[0.25.0] - 2023-12-19</h2>
<h3>Breaking changes</h3>
<ul>
<li>Changed <code>Vec4</code> to always used <code>BVec4A</code> as a
mask type, regardless if the
target architecture has SIMD support in glam. Previously this was
inconsistent
on different hardware like ARM. This will have a slight performance cost
when
SIMD is not available. <code>Vec4</code> will continue to use
<code>BVec4</code> as a mask type when
the <code>scalar-math</code> feature is used.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>
<p>Made <code>Affine2</code> implement the
<code>bytemuck::AnyBitPattern</code> trait instead of
<code>bytemuck::Pod</code> as it contains internal padding due to
<code>Mat2</code> being 16 byte
aligned.</p>
</li>
<li>
<p>Updated the <code>core-simd</code> implementation to build on latest
nightly.</p>
</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>to_angle</code> method to 2D vectors.</p>
</li>
<li>
<p>Added <code>FloatExt</code> trait which adds <code>lerp</code>,
<code>inverse_lerp</code> and <code>remap</code> methods
to <code>f32</code> and <code>f64</code> types.</p>
</li>
<li>
<p>Added <code>i16</code> and <code>u16</code> vector types,
<code>I16Vec2</code>, <code>I16Vec3</code>, <code>I16Vec4</code>,
<code>U16Vec2</code>, <code>U16Vec3</code> and <code>U16Vec4</code>.</p>
</li>
</ul>
<h3>Changed</h3>
<ul>
<li>
<p>Renamed <code>Quat::as_f64()</code> to <code>Quat::as_dquat()</code>
and <code>DQuat::as_f32()</code> to
<code>DQuat::as_quat()</code> to be consistent with other types. The old
methods have
been deprecated.</p>
</li>
<li>
<p>Added the <code>#[must_use]</code> attribute to all pure functions
following the
guidelines for the Rust standard library.</p>
</li>
</ul>
<h2>[0.24.2] - 2023-09-23</h2>
<h3>Fixed</h3>
<ul>
<li>Fixed singularities in <code>Quat::to_euler</code>.</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>div_euclid</code> and <code>rem_euclid</code> to integer
vector types.</p>
</li>
<li>
<p>Added wrapping and saturating arithmetic operations to integer vector
types.</p>
</li>
<li>
<p>Added <code>to_scale_angle_translation</code> to 2D affine types.</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/bitshifter/glam-rs/compare/0.25.0...0.25.0">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Objective
- Potion effects aren't supported by valence yet.
- You can send a packet to tell the client about a potion effect, but
the server still has no idea what they are
<details>
<summary>Example code</summary>
```rs
pub fn add_potion_effect(mut clients: Query<&mut Client>, mut events: EventReader<SneakEvent>) {
for event in events.iter() {
if event.state == SneakState::Start {
if let Ok(mut client) = clients.get_mut(event.client) {
client.write_packet(&EntityStatusEffectS2c {
entity_id: VarInt(0),
effect_id: VarInt(22),
amplifier: 0,
duration: VarInt(600),
flags: entity_status_effect_s2c::Flags::new()
.with_show_particles(true)
.with_show_icon(true),
factor_codec: None,
});
}
}
}
}
```
</details>
- Closes #401
- Also, when the potion effect expires, we need to tell the client that
their potion effect is no longer. Right now, with sending a packet, the
effect doesn't get removed when it goes down to 00:00.
# Solution
I want to add the necessary components and stuff to facilitate potion
effects.
> Note: I'm still somewhat new to rust and very new to bevy, so please
lmk if I can improve anything or if I should do anything differently.
Thanks!
# To do:
- [x] Extractor
- [x] `ActiveStatusEffects` component to handle the actual status effect
applied to the mc entity
- [x] Add `ActiveStatusEffects` component to all entities.
- [x] Make a plugin to handle potion effects
- [x] Decrease tick count
- [x] Remove effect (& tell client) when tick count is 0
- [x] Make the effects do stuff
- [x] Particles
- [x] Tell client
- [x] Add tests
- [x] Add example
- [x] Add examples on how to implement potion effects (speed, instant
health, etc.)
- [x] Extract stuff to make it easier to implement potions. See #593
# Playground
<details>
<summary>Current playground</summary>
```rs
use valence::client::despawn_disconnected_clients;
use valence::entity::active_status_effects::{ActiveStatusEffect, ActiveStatusEffects};
use valence::entity::status_effects::StatusEffect;
use valence::log::LogPlugin;
use valence::network::ConnectionMode;
use valence::prelude::*;
#[allow(unused_imports)]
use crate::extras::*;
const SPAWN_Y: i32 = 64;
pub fn build_app(app: &mut App) {
app.insert_resource(NetworkSettings {
connection_mode: ConnectionMode::Offline,
..Default::default()
})
.add_plugins(DefaultPlugins.build().disable::<LogPlugin>())
.add_systems(Startup, setup)
.add_systems(EventLoopUpdate, add_potion_effect)
.add_systems(Update, (init_clients, despawn_disconnected_clients))
.run();
}
fn setup(
mut commands: Commands,
server: Res<Server>,
biomes: Res<BiomeRegistry>,
dimensions: Res<DimensionTypeRegistry>,
) {
let mut layer = LayerBundle::new(ident!("overworld"), &dimensions, &biomes, &server);
for z in -5..5 {
for x in -5..5 {
layer.chunk.insert_chunk([x, z], UnloadedChunk::new());
}
}
for z in -25..25 {
for x in -25..25 {
layer
.chunk
.set_block([x, SPAWN_Y, z], BlockState::GRASS_BLOCK);
}
}
commands.spawn(layer);
}
fn init_clients(
mut clients: Query<
(
&mut EntityLayerId,
&mut VisibleChunkLayer,
&mut VisibleEntityLayers,
&mut Position,
&mut GameMode,
),
Added<Client>,
>,
layers: Query<Entity, (With<ChunkLayer>, With<EntityLayer>)>,
) {
for (
mut layer_id,
mut visible_chunk_layer,
mut visible_entity_layers,
mut pos,
mut game_mode,
) in &mut clients
{
let layer = layers.single();
layer_id.0 = layer;
visible_chunk_layer.0 = layer;
visible_entity_layers.0.insert(layer);
pos.set([0.0, SPAWN_Y as f64 + 1.0, 0.0]);
*game_mode = GameMode::Survival;
}
}
pub fn add_potion_effect(
mut clients: Query<&mut ActiveStatusEffects>,
mut events: EventReader<SneakEvent>,
) {
for event in events.iter() {
if event.state == SneakState::Start {
if let Ok(mut status) = clients.get_mut(event.client) {
status.add(
ActiveStatusEffect::from_effect(StatusEffect::Wither)
.with_amplifier(2)
.with_duration(200),
);
}
}
}
}
```
</details>
---------
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
# Objective
Certain potion status effects have attribute modifiers. Accessing them
would make using them much easier.
# Solution
- Extract them
- Also need to change how attribute modifiers are extracted and built. I
originally put them in `valence_entity`, but I think they would fit
better in `valence_generated` (just the generated stuff, we're still
using them in `valence_entity`)
Updates the requirements on
[glam](https://github.com/bitshifter/glam-rs) to permit the latest
version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/bitshifter/glam-rs/blob/main/CHANGELOG.md">glam's
changelog</a>.</em></p>
<blockquote>
<h2>[0.24.2] - 2023-09-23</h2>
<h3>Fixed</h3>
<ul>
<li>Fixed singularities in <code>Quat::to_euler</code>.</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>div_euclid</code> and <code>rem_euclid</code> to integer
vector types.</p>
</li>
<li>
<p>Added wrapping and saturating arithmetic operations to integer vector
types.</p>
</li>
<li>
<p>Added <code>to_scale_angle_translation</code> to 2D affine types.</p>
</li>
<li>
<p>Added <code>mul_assign</code> ops to affine types.</p>
</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Disable default features on optional <code>rkyv</code>
dependency.</li>
</ul>
<h2>[0.24.1] - 2023-06-24</h2>
<h3>Added</h3>
<ul>
<li>
<p>Implemented missing <code>bytemuck</code>, <code>mint</code>,
<code>rand</code>, <code>rkyv</code> and <code>serde</code> traits for
<code>i64</code> and <code>u64</code> types.</p>
</li>
<li>
<p>Added missing safe <code>From</code> conversions from
<code>f32</code> vectors to <code>f64</code> vectors.</p>
</li>
<li>
<p>Added <code>TryFrom</code> implementations between different vector
types.</p>
</li>
<li>
<p>Added <code>test</code> and <code>set</code> methods to
<code>bool</code> vector types for testing and setting
individual mask elements.</p>
</li>
<li>
<p>Added <code>MIN</code>, <code>MAX</code>, <code>INFINITY</code> and
<code>NEG_INFINITY</code> vector constants.</p>
</li>
</ul>
<h2>[0.24.0] - 2023-04-24</h2>
<h3>Breaking changes</h3>
<ul>
<li>Enabling <code>libm</code> in a <code>std</code> build now overrides
the <code>std</code> math functions. This
is unlikely to break anything but it is a change in behavior.</li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Added <code>i64</code> and <code>u64</code> vector types;
<code>I64Vec2</code>, <code>I64Vec3</code>, <code>I64Vec4</code>,
<code>U64Vec2</code>, <code>U64Vec3</code> and <code>U64Vec4</code>.</p>
</li>
<li>
<p>Added <code>length_squared</code> method on signed and unsigned
integer vector types.</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/2641f2b0e54ffacd8b02a0ddef9d4d447f5652c5"><code>2641f2b</code></a>
Prepare for 0.24.2 release.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/f6ce74580a2947d415630253f7c3b3209c71eddf"><code>f6ce745</code></a>
Update CHANGELOG.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/cd822d176506a0f14a9256f39d7398719670955a"><code>cd822d1</code></a>
Add some tests for affine types mul_assign ops.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/030c4e22166715faa084312f0085971872de81d4"><code>030c4e2</code></a>
Implement <code>MulAssign</code> for affine types (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/425">#425</a>)</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/121d0e21182083d894e1303dae5e79c760b30122"><code>121d0e2</code></a>
Updated CHANGELOG with unreleased changes.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/b76110b707a7628239a5117e9724df696fa47e8e"><code>b76110b</code></a>
Doc fix for *Vec4::truncate.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/f3832dc1ca1f3ba6e0ad02c7606093891f0b468a"><code>f3832dc</code></a>
Add <code>to_scale_angle_translation</code> (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/430">#430</a>)</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/2db9a7fb548d01869ec8264f8019aa6352120da0"><code>2db9a7f</code></a>
Fix coverage action.</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/efae39e6b552d0c1f56d5715e41d3bef60c09481"><code>efae39e</code></a>
Implement wrapping/saturating integer arithmetic methods (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/429">#429</a>)</li>
<li><a
href="https://github.com/bitshifter/glam-rs/commit/d40d1464ac51669ab308faf7845f5284827183de"><code>d40d146</code></a>
Fix singularities in <code>Quat::to_euler()</code> (<a
href="https://redirect.github.com/bitshifter/glam-rs/issues/427">#427</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/bitshifter/glam-rs/compare/0.24.1...0.24.2">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Objective
The Player Inventory only focused on the main slots. Now it can process
all of its slots
# Solution

Possibility to index all of the player's inventory slots.
This also reverts #588
---------
Co-authored-by: Carson McManus <carson.mcmanus1@gmail.com>
# Objective
Add player inventory slots constants, so developers would not need to
lookup them themselves
# Solution
Added constant slots into `slots` module
Based on this image (notice that index on image starts from 1, not 0)

Generated with this code:
```rust
fn debug_inventory(inv: &mut Inventory) {
for slot in 0..inv.slot_count() {
inv.set_slot(
slot,
ItemStack::new(ItemKind::Cobblestone, (slot + 1) as i8, None),
);
}
}
```
---------
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
Updates the requirements on
[itertools](https://github.com/rust-itertools/itertools) to permit the
latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md">itertools's
changelog</a>.</em></p>
<blockquote>
<h2>0.11.0</h2>
<h3>Breaking</h3>
<ul>
<li>Make <code>Itertools::merge_join_by</code> also accept functions
returning bool (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/704">#704</a>)</li>
<li>Implement <code>PeekingNext</code> transitively over mutable
references (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/643">#643</a>)</li>
<li>Change <code>with_position</code> to yield <code>(Position,
Item)</code> instead of <code>Position<Item></code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/699">#699</a>)</li>
</ul>
<h3>Added</h3>
<ul>
<li>Add <code>Itertools::take_while_inclusive</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/616">#616</a>)</li>
<li>Implement <code>PeekingNext</code> for <code>PeekingTakeWhile</code>
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/644">#644</a>)</li>
<li>Add <code>EitherOrBoth::{just_left, just_right, into_left,
into_right, as_deref, as_deref_mut, left_or_insert, right_or_insert,
left_or_insert_with, right_or_insert_with, insert_left, insert_right,
insert_both}</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/629">#629</a>)</li>
<li>Implement <code>Clone</code> for <code>CircularTupleWindows</code>
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/686">#686</a>)</li>
<li>Implement <code>Clone</code> for <code>Chunks</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/683">#683</a>)</li>
<li>Add <code>Itertools::process_results</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/680">#680</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Use <code>Cell</code> instead of <code>RefCell</code> in
<code>Format</code> and <code>FormatWith</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/608">#608</a>)</li>
<li>CI tweaks (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/674">#674</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/675">#675</a>)</li>
<li>Document and test the difference between stable and unstable sorts
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/653">#653</a>)</li>
<li>Fix documentation error on <code>Itertools::max_set_by_key</code>
(<a
href="https://redirect.github.com/rust-itertools/itertools/issues/692">#692</a>)</li>
<li>Move MSRV metadata to <code>Cargo.toml</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/672">#672</a>)</li>
<li>Implement <code>equal</code> with <code>Iterator::eq</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/591">#591</a>)</li>
</ul>
<h2>0.10.5</h2>
<ul>
<li>Maintenance</li>
</ul>
<h2>0.10.4</h2>
<ul>
<li>Add <code>EitherOrBoth::or</code> and
<code>EitherOrBoth::or_else</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/593">#593</a>)</li>
<li>Add <code>min_set</code>, <code>max_set</code> et al. (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/613">#613</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/323">#323</a>)</li>
<li>Use <code>either/use_std</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/628">#628</a>)</li>
<li>Documentation fixes (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/612">#612</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/625">#625</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/632">#632</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/633">#633</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/634">#634</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/638">#638</a>)</li>
<li>Code maintenance (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/623">#623</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/624">#624</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/627">#627</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/630">#630</a>)</li>
</ul>
<h2>0.10.3</h2>
<ul>
<li>Maintenance</li>
</ul>
<h2>0.10.2</h2>
<ul>
<li>Add <code>Itertools::multiunzip</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/362">#362</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/565">#565</a>)</li>
<li>Add <code>intersperse</code> and <code>intersperse_with</code> free
functions (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/555">#555</a>)</li>
<li>Add <code>Itertools::sorted_by_cached_key</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/424">#424</a>,
<a
href="https://redirect.github.com/rust-itertools/itertools/issues/575">#575</a>)</li>
<li>Specialize <code>ProcessResults::fold</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/563">#563</a>)</li>
<li>Fix subtraction overflow in <code>DuplicatesBy::size_hint</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/552">#552</a>)</li>
<li>Fix specialization tests (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/574">#574</a>)</li>
<li>More <code>Debug</code> impls (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/573">#573</a>)</li>
<li>Deprecate <code>fold1</code> (use <code>reduce</code> instead) (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/580">#580</a>)</li>
<li>Documentation fixes (<code>HomogenousTuple</code>,
<code>into_group_map</code>, <code>into_group_map_by</code>,
<code>MultiPeek::peek</code>) (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/543">#543</a>
et al.)</li>
</ul>
<h2>0.10.1</h2>
<ul>
<li>Add <code>Itertools::contains</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/514">#514</a>)</li>
<li>Add <code>Itertools::counts_by</code> (<a
href="https://redirect.github.com/rust-itertools/itertools/issues/515">#515</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/rust-itertools/itertools/compare/v0.11.0...v0.11.0">compare
view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>