From 5ea127114582e3320381d09e880f6a433ccb8710 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 6 Jan 2024 18:16:11 -0600 Subject: [PATCH] add doc comment about d= --- azalea-auth/src/auth.rs | 9 ++++++--- azalea-block/src/generated.rs | 1 - azalea-inventory/src/slot.rs | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs index 67a45aa3c..7b5846c42 100755 --- a/azalea-auth/src/auth.rs +++ b/azalea-auth/src/auth.rs @@ -140,6 +140,9 @@ pub async fn auth(email: &str, opts: AuthOpts) -> Result /// /// If you don't have a Microsoft auth token, you can get it from /// [`get_ms_link_code`] and then [`get_ms_auth_token`]. +/// +/// If you got the MSA token from your own app (as opposed to the default +/// Nintendo Switch one), you may have to prepend "d=" to the token. pub async fn get_minecraft_token( client: &reqwest::Client, msa: &str, @@ -418,9 +421,9 @@ async fn auth_with_xbox_live( "Properties": { "AuthMethod": "RPS", "SiteName": "user.auth.xboxlive.com", - // i thought this was supposed to be d={} but it doesn't work for - // me when i add it ?????? - "RpsTicket": format!("{access_token}") + // this value should have "d=" prepended if you're using your own app (as opposed to + // the default nintendo switch one) + "RpsTicket": access_token }, "RelyingParty": "http://auth.xboxlive.com", "TokenType": "JWT" diff --git a/azalea-block/src/generated.rs b/azalea-block/src/generated.rs index 97236b4ba..5267c9a18 100755 --- a/azalea-block/src/generated.rs +++ b/azalea-block/src/generated.rs @@ -5380,4 +5380,3 @@ make_block_states! { }, } } - diff --git a/azalea-inventory/src/slot.rs b/azalea-inventory/src/slot.rs index 814b6c37a..c4f8da056 100644 --- a/azalea-inventory/src/slot.rs +++ b/azalea-inventory/src/slot.rs @@ -71,6 +71,14 @@ impl ItemSlot { } } } + + /// Convert this slot into an [`ItemSlotData`], if it's present. + pub fn as_present(&self) -> Option<&ItemSlotData> { + match self { + ItemSlot::Empty => None, + ItemSlot::Present(i) => Some(i), + } + } } /// An item in an inventory, with a count and NBT. Usually you want [`ItemSlot`]