Skip to content

Commit

Permalink
Compatibility with "No Chat Report"
Browse files Browse the repository at this point in the history
  • Loading branch information
LifeIsAParadox committed Jun 28, 2024
1 parent 1884bdf commit 4064dec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.hysky.skyblocker.mixins.accessors;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.session.ProfileKeys;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(MinecraftClient.class)
public interface MinecraftClientAccessor {
@Accessor
ProfileKeys getProfileKeys();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.Objects;
import java.util.UUID;

import de.hysky.skyblocker.mixins.accessors.MinecraftClientAccessor;
import net.minecraft.client.session.ProfileKeys;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;

Expand Down Expand Up @@ -56,8 +58,9 @@ public static void init() {
* was generated by Mojang and is tied to said player. For information about what the randomly signed data is used for and why see {@link #getRandomSignedData(PrivateKey)}
*/
private static void updateToken() {
ProfileKeys profileKeys = ((MinecraftClientAccessor) CLIENT).getProfileKeys();
//The fetching runs async in ProfileKeysImpl#getKeyPair
CLIENT.getProfileKeys().fetchKeyPair().thenAcceptAsync(playerKeypairOpt -> {
profileKeys.fetchKeyPair().thenAcceptAsync(playerKeypairOpt -> {
if (playerKeypairOpt.isPresent()) {
PlayerKeyPair playerKeyPair = playerKeypairOpt.get();

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/skyblocker.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"accessors.FrustumInvoker",
"accessors.HandledScreenAccessor",
"accessors.MessageHandlerAccessor",
"accessors.MinecraftClientAccessor",
"accessors.PlayerListHudAccessor",
"accessors.RecipeBookWidgetAccessor",
"accessors.ScreenAccessor",
Expand Down

0 comments on commit 4064dec

Please sign in to comment.