use std::time::Duration;
use vek::Vec3;
use crate::block_pos::BlockPos;
use crate::entity::EntityId;
use crate::protocol::packets::c2s::play::BlockFace;
pub use crate::protocol::packets::c2s::play::{ChatMode, DisplayedSkinParts, Hand, MainHand};
pub use crate::protocol::packets::s2c::play::GameMode;
#[derive(Debug)]
pub enum ClientEvent {
ChatMessage {
message: String,
timestamp: Duration,
},
SettingsChanged {
locale: String,
view_distance: u8,
chat_mode: ChatMode,
chat_colors: bool,
main_hand: MainHand,
displayed_skin_parts: DisplayedSkinParts,
allow_server_listings: bool,
},
MovePosition {
position: Vec3<f64>,
on_ground: bool,
},
MovePositionAndRotation {
position: Vec3<f64>,
yaw: f32,
pitch: f32,
on_ground: bool,
},
MoveRotation {
yaw: f32,
pitch: f32,
on_ground: bool,
},
MoveOnGround {
on_ground: bool,
},
MoveVehicle {
position: Vec3<f64>,
yaw: f32,
pitch: f32,
},
StartSneaking,
StopSneaking,
StartSprinting,
StopSprinting,
StartJumpWithHorse {
jump_boost: u8,
},
StopJumpWithHorse,
LeaveBed,
OpenHorseInventory,
StartFlyingWithElytra,
ArmSwing(Hand),
InteractWithEntity {
id: EntityId,
sneaking: bool,
kind: InteractWithEntityKind,
},
SteerBoat {
left_paddle_turning: bool,
right_paddle_turning: bool,
},
Digging {
status: DiggingStatus,
position: BlockPos,
face: BlockFace,
},
}
#[derive(Clone, PartialEq, Debug)]
pub struct Settings {
pub locale: String,
pub view_distance: u8,
pub chat_mode: ChatMode,
pub chat_colors: bool,
pub main_hand: MainHand,
pub displayed_skin_parts: DisplayedSkinParts,
pub allow_server_listings: bool,
}
#[derive(Clone, PartialEq, Debug)]
pub enum InteractWithEntityKind {
Interact(Hand),
InteractAt { target: Vec3<f32>, hand: Hand },
Attack,
}
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum DiggingStatus {
Start,
Cancel,
Finish,
}