aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2023-05-04 20:38:10 +0000
committermat <github@matdoes.dev>2023-05-04 20:38:10 +0000
commitc7a923ccc8ae825deca62ac2cc8c80c01484d5b6 (patch)
tree787c6eb579d0b126f0e9dfa161bdea758fe9aa0a /azalea-protocol/src
parentff6d43458cef8ac6a23e6e8accd4b71c2a04aef6 (diff)
parent634cb8d72c6608512aedba19e5cd669104bc35ea (diff)
downloadazalea-drasl-c7a923ccc8ae825deca62ac2cc8c80c01484d5b6.tar.xz
merge main
Diffstat (limited to 'azalea-protocol/src')
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs8
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs2
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_login_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs8
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_open_screen_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_respawn_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs6
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs19
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_container_click_packet.rs19
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs14
13 files changed, 49 insertions, 53 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
index 0e9ce32b..4e08232d 100755
--- a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
@@ -1,12 +1,12 @@
use azalea_buf::McBuf;
-use azalea_core::Slot;
+use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetContentPacket {
- pub container_id: u8,
+ pub container_id: i8,
#[var]
pub state_id: u32,
- pub items: Vec<Slot>,
- pub carried_item: Slot,
+ pub items: Vec<ItemSlot>,
+ pub carried_item: ItemSlot,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs
index e09c16d7..dc53a024 100755
--- a/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs
@@ -3,7 +3,7 @@ use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetDataPacket {
- pub container_id: u8,
+ pub container_id: i8,
pub id: u16,
pub value: u16,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs
index 0ed249a9..9b954fa0 100755
--- a/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs
@@ -1,12 +1,12 @@
use azalea_buf::McBuf;
-use azalea_core::Slot;
+use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetSlotPacket {
- pub container_id: u8,
+ pub container_id: i8,
#[var]
pub state_id: u32,
pub slot: u16,
- pub item_stack: Slot,
+ pub item_stack: ItemSlot,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs
index a35951a7..bafead86 100755
--- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs
@@ -1,6 +1,6 @@
use self::registry::RegistryHolder;
use azalea_buf::McBuf;
-use azalea_core::{GameType, GlobalPos, OptionalGameType, ResourceLocation};
+use azalea_core::{GameMode, GlobalPos, OptionalGameType, ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket;
/// The first packet sent by the server to the client after login.
@@ -11,7 +11,7 @@ use azalea_protocol_macros::ClientboundGamePacket;
pub struct ClientboundLoginPacket {
pub player_id: u32,
pub hardcore: bool,
- pub game_type: GameType,
+ pub game_type: GameMode,
pub previous_game_type: OptionalGameType,
pub levels: Vec<ResourceLocation>,
pub registry_holder: RegistryHolder,
diff --git a/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs b/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs
index 21ac8b2e..4253ace4 100755
--- a/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs
@@ -1,5 +1,5 @@
use azalea_buf::McBuf;
-use azalea_core::Slot;
+use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
@@ -17,9 +17,9 @@ pub struct ClientboundMerchantOffersPacket {
#[derive(Clone, Debug, McBuf)]
pub struct MerchantOffer {
- pub base_cost_a: Slot,
- pub result: Slot,
- pub cost_b: Slot,
+ pub base_cost_a: ItemSlot,
+ pub result: ItemSlot,
+ pub cost_b: ItemSlot,
pub out_of_stock: bool,
pub uses: u32,
pub max_uses: u32,
diff --git a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs
index 9b8b02a1..582cac17 100755
--- a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs
@@ -6,6 +6,6 @@ use azalea_protocol_macros::ClientboundGamePacket;
pub struct ClientboundOpenScreenPacket {
#[var]
pub container_id: u32,
- pub menu_type: azalea_registry::Menu,
+ pub menu_type: azalea_registry::MenuKind,
pub title: FormattedText,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs
index dc518c9c..1dad147f 100644
--- a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs
@@ -3,7 +3,7 @@ use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
use azalea_chat::FormattedText;
-use azalea_core::{FixedBitSet, GameType};
+use azalea_core::{FixedBitSet, GameMode};
use azalea_protocol_macros::ClientboundGamePacket;
use std::{
collections::HashMap,
@@ -24,7 +24,7 @@ pub struct PlayerInfoEntry {
pub profile: GameProfile,
pub listed: bool,
pub latency: i32,
- pub game_mode: GameType,
+ pub game_mode: GameMode,
pub display_name: Option<FormattedText>,
pub chat_session: Option<RemoteChatSessionData>,
}
@@ -40,7 +40,7 @@ pub struct InitializeChatAction {
}
#[derive(Clone, Debug, McBuf)]
pub struct UpdateGameModeAction {
- pub game_mode: GameType,
+ pub game_mode: GameMode,
}
#[derive(Clone, Debug, McBuf)]
pub struct UpdateListedAction {
diff --git a/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs b/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs
index 58488124..03cc2917 100755
--- a/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs
@@ -1,5 +1,5 @@
use azalea_buf::McBuf;
-use azalea_core::{GameType, GlobalPos, OptionalGameType, ResourceLocation};
+use azalea_core::{GameMode, GlobalPos, OptionalGameType, ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
@@ -7,7 +7,7 @@ pub struct ClientboundRespawnPacket {
pub dimension_type: ResourceLocation,
pub dimension: ResourceLocation,
pub seed: u64,
- pub player_game_type: GameType,
+ pub player_game_type: GameMode,
pub previous_player_game_type: OptionalGameType,
pub is_debug: bool,
pub is_flat: bool,
diff --git a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs
index 11472591..0acdc687 100755
--- a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs
@@ -1,6 +1,6 @@
use azalea_buf::{BufReadError, McBuf};
use azalea_buf::{McBufReadable, McBufWritable};
-use azalea_core::Slot;
+use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
use std::io::Cursor;
@@ -13,7 +13,7 @@ pub struct ClientboundSetEquipmentPacket {
#[derive(Clone, Debug)]
pub struct EquipmentSlots {
- pub slots: Vec<(EquipmentSlot, Slot)>,
+ pub slots: Vec<(EquipmentSlot, ItemSlot)>,
}
impl McBufReadable for EquipmentSlots {
@@ -28,7 +28,7 @@ impl McBufReadable for EquipmentSlots {
id: equipment_byte.into(),
}
})?;
- let item = Slot::read_from(buf)?;
+ let item = ItemSlot::read_from(buf)?;
slots.push((equipment_slot, item));
if equipment_byte & 128 == 0 {
break;
diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs
index 3dbac1b5..8c24bdbe 100755
--- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs
@@ -1,7 +1,8 @@
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
-use azalea_core::{ResourceLocation, Slot};
+use azalea_core::ResourceLocation;
+use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::RecipeSerializer;
@@ -26,7 +27,7 @@ pub struct ShapelessRecipe {
pub group: String,
pub category: CraftingBookCategory,
pub ingredients: Vec<Ingredient>,
- pub result: Slot,
+ pub result: ItemSlot,
}
#[derive(Clone, Debug)]
pub struct ShapedRecipe {
@@ -35,7 +36,7 @@ pub struct ShapedRecipe {
pub group: String,
pub category: CraftingBookCategory,
pub ingredients: Vec<Ingredient>,
- pub result: Slot,
+ pub result: ItemSlot,
pub show_notification: bool,
}
@@ -71,7 +72,7 @@ impl McBufReadable for ShapedRecipe {
for _ in 0..width * height {
ingredients.push(Ingredient::read_from(buf)?);
}
- let result = Slot::read_from(buf)?;
+ let result = ItemSlot::read_from(buf)?;
let show_notification = bool::read_from(buf)?;
Ok(ShapedRecipe {
@@ -91,7 +92,7 @@ pub struct CookingRecipe {
pub group: String,
pub category: CraftingBookCategory,
pub ingredient: Ingredient,
- pub result: Slot,
+ pub result: ItemSlot,
pub experience: f32,
#[var]
pub cooking_time: u32,
@@ -100,13 +101,13 @@ pub struct CookingRecipe {
pub struct StoneCutterRecipe {
pub group: String,
pub ingredient: Ingredient,
- pub result: Slot,
+ pub result: ItemSlot,
}
#[derive(Clone, Debug, McBuf)]
pub struct SmithingRecipe {
pub base: Ingredient,
pub addition: Ingredient,
- pub result: Slot,
+ pub result: ItemSlot,
}
#[derive(Clone, Debug, McBuf)]
@@ -119,7 +120,7 @@ pub struct SmithingTransformRecipe {
pub template: Ingredient,
pub base: Ingredient,
pub addition: Ingredient,
- pub result: Slot,
+ pub result: ItemSlot,
}
#[derive(Clone, Debug, McBuf)]
@@ -158,7 +159,7 @@ pub enum RecipeData {
#[derive(Clone, Debug, McBuf)]
pub struct Ingredient {
- pub allowed: Vec<Slot>,
+ pub allowed: Vec<ItemSlot>,
}
impl McBufWritable for Recipe {
diff --git a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs
index 768d3f94..119af220 100755
--- a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs
@@ -1,5 +1,5 @@
use azalea_buf::McBuf;
-use azalea_core::Slot;
+use azalea_inventory::{operations::ClickType, ItemSlot};
use azalea_protocol_macros::ServerboundGamePacket;
use std::collections::HashMap;
@@ -8,20 +8,9 @@ pub struct ServerboundContainerClickPacket {
pub container_id: u8,
#[var]
pub state_id: u32,
- pub slot_num: u16,
+ pub slot_num: i16,
pub button_num: u8,
pub click_type: ClickType,
- pub changed_slots: HashMap<u16, Slot>,
- pub carried_item: Slot,
-}
-
-#[derive(McBuf, Clone, Copy, Debug)]
-pub enum ClickType {
- Pickup = 0,
- QuickMove = 1,
- Swap = 2,
- Clone = 3,
- Throw = 4,
- QuickCraft = 5,
- PickupAll = 6,
+ pub changed_slots: HashMap<u16, ItemSlot>,
+ pub carried_item: ItemSlot,
}
diff --git a/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs
index 254950de..7730bf5a 100755
--- a/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs
@@ -1,9 +1,9 @@
use azalea_buf::McBuf;
-use azalea_core::Slot;
+use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ServerboundGamePacket;
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundSetCreativeModeSlotPacket {
pub slot_num: u16,
- pub item_stack: Slot,
+ pub item_stack: ItemSlot,
}
diff --git a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs b/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs
index c7a32a8f..50cbe914 100755
--- a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs
@@ -7,20 +7,26 @@ use std::io::{Cursor, Write};
#[derive(Clone, Debug, McBuf, ServerboundGamePacket)]
pub struct ServerboundUseItemOnPacket {
pub hand: InteractionHand,
- pub block_hit: BlockHitResult,
+ pub block_hit: BlockHit,
#[var]
pub sequence: u32,
}
#[derive(Clone, Debug)]
-pub struct BlockHitResult {
+pub struct BlockHit {
+ /// The block that we clicked.
pub block_pos: BlockPos,
+ /// The face of the block that was clicked.
pub direction: Direction,
+ /// The exact coordinates of the world where the block was clicked. In the
+ /// network, this is transmitted as the difference between the location and
+ /// block position.
pub location: Vec3,
+ /// Whether the player's head is inside of a block.
pub inside: bool,
}
-impl McBufWritable for BlockHitResult {
+impl McBufWritable for BlockHit {
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
self.block_pos.write_into(buf)?;
self.direction.write_into(buf)?;
@@ -41,7 +47,7 @@ impl McBufWritable for BlockHitResult {
}
}
-impl McBufReadable for BlockHitResult {
+impl McBufReadable for BlockHit {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let block_pos = BlockPos::read_from(buf)?;
let direction = Direction::read_from(buf)?;