aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/game
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-12-09 13:29:59 -0600
committerGitHub <noreply@github.com>2025-12-09 13:29:59 -0600
commit26d619c9a329087a23d6577ee74bd764f50cd773 (patch)
tree8020fe902257764a23a445c6ed9987ea4848189d /azalea-protocol/src/packets/game
parent84cd261118c9d1e3145d4d1751c0d22098cd8cd8 (diff)
downloadazalea-drasl-26d619c9a329087a23d6577ee74bd764f50cd773.tar.xz
Enchantments (#286)
* start implementing enchants * store parsed registries * more work on enchants * implement deserializer for some entity effects * mostly working definitions for enchants * fix tests * detect equipment changes * fix errors * update changelog * fix some imports * remove outdated todo * add basic test for enchants applying attributes * use git simdnbt
Diffstat (limited to 'azalea-protocol/src/packets/game')
-rw-r--r--azalea-protocol/src/packets/game/c_container_set_slot.rs4
-rw-r--r--azalea-protocol/src/packets/game/c_set_equipment.rs27
-rw-r--r--azalea-protocol/src/packets/game/c_update_attributes.rs2
3 files changed, 6 insertions, 27 deletions
diff --git a/azalea-protocol/src/packets/game/c_container_set_slot.rs b/azalea-protocol/src/packets/game/c_container_set_slot.rs
index 73670439..571d8e82 100644
--- a/azalea-protocol/src/packets/game/c_container_set_slot.rs
+++ b/azalea-protocol/src/packets/game/c_container_set_slot.rs
@@ -6,8 +6,12 @@ use azalea_protocol_macros::ClientboundGamePacket;
pub struct ClientboundContainerSetSlot {
#[var]
pub container_id: i32,
+ /// An identifier used by the server to track client inventory desyncs.
#[var]
pub state_id: u32,
+ /// The slot index.
+ ///
+ /// See https://minecraft.wiki/w/Java_Edition_protocol/Inventory.
pub slot: u16,
pub item_stack: ItemStack,
}
diff --git a/azalea-protocol/src/packets/game/c_set_equipment.rs b/azalea-protocol/src/packets/game/c_set_equipment.rs
index b52672b0..0ef3d8e1 100644
--- a/azalea-protocol/src/packets/game/c_set_equipment.rs
+++ b/azalea-protocol/src/packets/game/c_set_equipment.rs
@@ -1,7 +1,7 @@
use std::io::{self, Cursor, Write};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError};
-use azalea_inventory::ItemStack;
+use azalea_inventory::{ItemStack, components::EquipmentSlot};
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
@@ -54,28 +54,3 @@ impl AzaleaWrite for EquipmentSlots {
Ok(())
}
}
-
-#[derive(Clone, Debug, Copy, AzBuf, PartialEq)]
-pub enum EquipmentSlot {
- MainHand = 0,
- OffHand = 1,
- Feet = 2,
- Legs = 3,
- Chest = 4,
- Head = 5,
-}
-
-impl EquipmentSlot {
- #[must_use]
- pub fn from_byte(byte: u8) -> Option<Self> {
- match byte {
- 0 => Some(EquipmentSlot::MainHand),
- 1 => Some(EquipmentSlot::OffHand),
- 2 => Some(EquipmentSlot::Feet),
- 3 => Some(EquipmentSlot::Legs),
- 4 => Some(EquipmentSlot::Chest),
- 5 => Some(EquipmentSlot::Head),
- _ => None,
- }
- }
-}
diff --git a/azalea-protocol/src/packets/game/c_update_attributes.rs b/azalea-protocol/src/packets/game/c_update_attributes.rs
index 39c921b0..d11b08cb 100644
--- a/azalea-protocol/src/packets/game/c_update_attributes.rs
+++ b/azalea-protocol/src/packets/game/c_update_attributes.rs
@@ -1,5 +1,5 @@
use azalea_buf::AzBuf;
-use azalea_entity::attributes::AttributeModifier;
+use azalea_inventory::components::AttributeModifier;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::Attribute;
use azalea_world::MinecraftEntityId;