From 1220d7a031015aaaabdd090a98a59368f2874d9e22041ea863b8bf37bfa4f062 Mon Sep 17 00:00:00 2001 From: raven <7156279+RavenX8@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:58:40 -0500 Subject: [PATCH] - update: HotbarItem struct to remove unnecessary internal structures. We will never use the union members - update: structs in types.rs to be public --- packet-service/src/types.rs | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/packet-service/src/types.rs b/packet-service/src/types.rs index 5c0899d..d952e16 100644 --- a/packet-service/src/types.rs +++ b/packet-service/src/types.rs @@ -2,35 +2,22 @@ use std::time::{Duration}; use bincode::{Encode, Decode}; // `HotbarItem` structure converted to Rust. -#[derive(Clone, Copy)] -struct HotbarItem { - data: HotbarItemData, -} - -// Definition for `data` union in `HotbarItem`. -#[derive(Clone, Copy)] -union HotbarItemData { - item: u16, - components: HotbarItemComponents, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)] -#[repr(C)] -struct HotbarItemComponents { +#[derive(Debug, Clone, Copy, Encode, Decode)] +pub(crate) struct HotbarItem { type_: u8, slot_id: u16, } // `Skill` structure converted to Rust. #[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)] -struct Skill { +pub(crate) struct Skill { id: u16, level: u8, } // `StatusEffect` structure converted to Rust. #[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)] -struct StatusEffect { +pub(crate) struct StatusEffect { expired: Duration, value: u16, unknown: u16,