revert resource pack names (#587)

This commit is contained in:
kralverde
2025-02-24 06:17:45 -10:00
committed by GitHub
parent 0bbb7f7823
commit 7c3487e9c1
3 changed files with 10 additions and 15 deletions

View File

@@ -5,9 +5,9 @@ use serde::{Deserialize, Serialize};
pub struct ResourcePackConfig {
pub enabled: bool,
/// The path to the resource pack.
pub resource_pack_url: String,
pub url: String,
/// The SHA1 hash (40) of the resource pack.
pub resource_pack_sha1: String,
pub sha1: String,
/// Custom prompt Text component, Leave blank for none
pub prompt_message: String,
/// Will force the Player to accept the resource pack
@@ -21,12 +21,12 @@ impl ResourcePackConfig {
}
assert_eq!(
!self.resource_pack_url.is_empty(),
!self.resource_pack_sha1.is_empty(),
!self.url.is_empty(),
!self.sha1.is_empty(),
"Resource Pack path or Sha1 hash is missing"
);
let hash_len = self.resource_pack_sha1.len();
let hash_len = self.sha1.len();
assert!(
hash_len == 40,
"Resource pack sha1 hash is the wrong length (should be 40, is {})",

View File

@@ -72,10 +72,8 @@ impl Client {
pub async fn handle_resource_pack_response(&self, packet: SConfigResourcePack) {
let resource_config = &ADVANCED_CONFIG.resource_pack;
if resource_config.enabled {
let expected_uuid = uuid::Uuid::new_v3(
&uuid::Uuid::NAMESPACE_DNS,
resource_config.resource_pack_url.as_bytes(),
);
let expected_uuid =
uuid::Uuid::new_v3(&uuid::Uuid::NAMESPACE_DNS, resource_config.url.as_bytes());
if packet.uuid == expected_uuid {
match packet.response_result() {

View File

@@ -358,14 +358,11 @@ impl Client {
let resource_config = &ADVANCED_CONFIG.resource_pack;
if resource_config.enabled {
let uuid = Uuid::new_v3(
&uuid::Uuid::NAMESPACE_DNS,
resource_config.resource_pack_url.as_bytes(),
);
let uuid = Uuid::new_v3(&uuid::Uuid::NAMESPACE_DNS, resource_config.url.as_bytes());
let resource_pack = CConfigAddResourcePack::new(
&uuid,
&resource_config.resource_pack_url,
&resource_config.resource_pack_sha1,
&resource_config.url,
&resource_config.sha1,
resource_config.force,
if resource_config.prompt_message.is_empty() {
None