Fix: Resource pack
This commit is contained in:
parent
77b205ada0
commit
43fbb6a68d
@ -2,21 +2,23 @@ use pumpkin_macros::packet;
|
|||||||
use pumpkin_text::TextComponent;
|
use pumpkin_text::TextComponent;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use crate::uuid::UUID;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[packet(0x09)]
|
#[packet(0x09)]
|
||||||
pub struct CConfigAddResourcePack {
|
pub struct CConfigAddResourcePack<'a> {
|
||||||
uuid: uuid::Uuid,
|
uuid: UUID,
|
||||||
url: String,
|
url: &'a str,
|
||||||
hash: String,
|
hash: &'a str, // max 40
|
||||||
forced: bool,
|
forced: bool,
|
||||||
prompt_message: Option<TextComponent>,
|
prompt_message: Option<TextComponent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CConfigAddResourcePack {
|
impl<'a> CConfigAddResourcePack<'a> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
uuid: uuid::Uuid,
|
uuid: UUID,
|
||||||
url: String,
|
url: &'a str,
|
||||||
hash: String,
|
hash: &'a str,
|
||||||
forced: bool,
|
forced: bool,
|
||||||
prompt_message: Option<TextComponent>,
|
prompt_message: Option<TextComponent>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use num_traits::FromPrimitive;
|
use num_traits::FromPrimitive;
|
||||||
use pumpkin_protocol::{
|
use pumpkin_protocol::{
|
||||||
@ -203,9 +202,12 @@ impl Client {
|
|||||||
Some(TextComponent::from(resource_config.prompt_message.clone()))
|
Some(TextComponent::from(resource_config.prompt_message.clone()))
|
||||||
};
|
};
|
||||||
self.send_packet(&CConfigAddResourcePack::new(
|
self.send_packet(&CConfigAddResourcePack::new(
|
||||||
uuid::Uuid::from_str(&resource_config.resource_pack_url).unwrap(),
|
pumpkin_protocol::uuid::UUID(uuid::Uuid::new_v3(
|
||||||
resource_config.resource_pack_url.clone(),
|
&uuid::Uuid::NAMESPACE_DNS,
|
||||||
resource_config.resource_pack_sha1.clone(),
|
resource_config.resource_pack_url.as_bytes(),
|
||||||
|
)),
|
||||||
|
&resource_config.resource_pack_url,
|
||||||
|
&resource_config.resource_pack_sha1,
|
||||||
resource_config.force,
|
resource_config.force,
|
||||||
prompt_message,
|
prompt_message,
|
||||||
));
|
));
|
||||||
|
|||||||
@ -314,9 +314,7 @@ impl Client {
|
|||||||
&CHurtAnimation::new(&entity_id, 10.0),
|
&CHurtAnimation::new(&entity_id, 10.0),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if config.swing {
|
if config.swing {}
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
self.kick("Interacted with invalid entitiy id")
|
self.kick("Interacted with invalid entitiy id")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user