mirror of
https://github.com/italicsjenga/valence.git
synced 2025-01-10 06:41:30 +11:00
don't bother marking the inventory as dirty when handling SetCreativeModeSlot (#134)
fixes #133 ### Test plan 1. run building example 2. open inventory 3. place any item in hotbar 4. try to pick it up 5. see that it does not disappear
This commit is contained in:
parent
c683a0d94c
commit
bbbeb7ae28
|
@ -8,7 +8,7 @@ use crate::config::Config;
|
||||||
use crate::entity::types::Pose;
|
use crate::entity::types::Pose;
|
||||||
use crate::entity::{Entity, EntityEvent, EntityId, TrackedData};
|
use crate::entity::{Entity, EntityEvent, EntityId, TrackedData};
|
||||||
use crate::ident::Ident;
|
use crate::ident::Ident;
|
||||||
use crate::inventory::Inventory;
|
use crate::inventory::{Inventory, InventoryDirtyable};
|
||||||
use crate::item::ItemStack;
|
use crate::item::ItemStack;
|
||||||
use crate::protocol::packets::c2s::play::ClickContainerMode;
|
use crate::protocol::packets::c2s::play::ClickContainerMode;
|
||||||
pub use crate::protocol::packets::c2s::play::{
|
pub use crate::protocol::packets::c2s::play::{
|
||||||
|
@ -348,7 +348,11 @@ pub fn handle_event_default<C: Config>(
|
||||||
ClientEvent::DropItem => {}
|
ClientEvent::DropItem => {}
|
||||||
ClientEvent::DropItemStack { .. } => {}
|
ClientEvent::DropItemStack { .. } => {}
|
||||||
ClientEvent::SetSlotCreative { slot_id, slot } => {
|
ClientEvent::SetSlotCreative { slot_id, slot } => {
|
||||||
|
let previous_dirty = client.inventory.is_dirty();
|
||||||
client.inventory.set_slot(*slot_id, slot.clone());
|
client.inventory.set_slot(*slot_id, slot.clone());
|
||||||
|
// HACK: we don't need to mark the inventory as dirty because the
|
||||||
|
// client already knows what the updated state of the inventory is.
|
||||||
|
client.inventory.mark_dirty(previous_dirty);
|
||||||
}
|
}
|
||||||
ClientEvent::ClickContainer { .. } => {}
|
ClientEvent::ClickContainer { .. } => {}
|
||||||
ClientEvent::RespawnRequest => {}
|
ClientEvent::RespawnRequest => {}
|
||||||
|
|
Loading…
Reference in a new issue