aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/game/s_container_click.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-09-20 20:35:16 -1200
committermat <git@matdoes.dev>2025-09-20 20:35:16 -1200
commit585b51e91a5335eae37bc5af7c0111bb2092b156 (patch)
treec1559014df9db20dd625d9fe972d4e9f88317008 /azalea-protocol/src/packets/game/s_container_click.rs
parentdb793448ff8e656ad80859835edc3b89cb547dd2 (diff)
downloadazalea-drasl-585b51e91a5335eae37bc5af7c0111bb2092b156.tar.xz
more accurate mining and impl PartialEq for packets
Diffstat (limited to 'azalea-protocol/src/packets/game/s_container_click.rs')
-rw-r--r--azalea-protocol/src/packets/game/s_container_click.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/azalea-protocol/src/packets/game/s_container_click.rs b/azalea-protocol/src/packets/game/s_container_click.rs
index a06e7c0c..ef2e832d 100644
--- a/azalea-protocol/src/packets/game/s_container_click.rs
+++ b/azalea-protocol/src/packets/game/s_container_click.rs
@@ -1,11 +1,10 @@
-use std::collections::HashMap;
-
use azalea_buf::AzBuf;
use azalea_core::{checksum::Checksum, registry_holder::RegistryHolder};
use azalea_inventory::{ItemStack, operations::ClickType};
use azalea_protocol_macros::ServerboundGamePacket;
+use indexmap::IndexMap;
-#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)]
+#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)]
pub struct ServerboundContainerClick {
#[var]
pub container_id: i32,
@@ -14,16 +13,16 @@ pub struct ServerboundContainerClick {
pub slot_num: i16,
pub button_num: u8,
pub click_type: ClickType,
- pub changed_slots: HashMap<u16, HashedStack>,
+ pub changed_slots: IndexMap<u16, HashedStack>,
pub carried_item: HashedStack,
}
/// Similar to an [`ItemStack`] but only carrying a CRC32 hash of the value of
/// added data components instead of their entire contents.
-#[derive(Clone, Debug, AzBuf)]
+#[derive(Clone, Debug, AzBuf, PartialEq)]
pub struct HashedStack(pub Option<HashedActualItem>);
-#[derive(Clone, Debug, AzBuf)]
+#[derive(Clone, Debug, AzBuf, PartialEq)]
pub struct HashedActualItem {
pub kind: azalea_registry::Item,
#[var]
@@ -31,10 +30,8 @@ pub struct HashedActualItem {
pub components: HashedPatchMap,
}
-#[derive(Clone, Debug, AzBuf)]
+#[derive(Clone, Debug, AzBuf, PartialEq)]
pub struct HashedPatchMap {
- /// The value is a CRC32 hash of the data component's network serialization.
- /// (kind + data)
#[limit(256)]
pub added_components: Vec<(azalea_registry::DataComponentKind, Checksum)>,
#[limit(256)]