Yggdrasil Login (#229)
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.minecraft.UserApiService;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.SocialInteractionsManager;
|
||||
import net.minecraft.client.report.AbuseReportContext;
|
||||
import net.minecraft.client.texture.PlayerSkinProvider;
|
||||
import net.minecraft.client.util.ProfileKeys;
|
||||
import net.minecraft.client.util.Session;
|
||||
import net.minecraft.network.encryption.SignatureVerifier;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public interface MinecraftClientAccessor {
|
||||
@Mutable
|
||||
@Accessor("session")
|
||||
void setSession(Session session);
|
||||
|
||||
@Mutable
|
||||
@Accessor("sessionService")
|
||||
void setSessionService(MinecraftSessionService sessionService);
|
||||
|
||||
@Mutable
|
||||
@Accessor("authenticationService")
|
||||
void setAuthenticationService(YggdrasilAuthenticationService authenticationService);
|
||||
|
||||
@Mutable
|
||||
@Accessor("servicesSignatureVerifier")
|
||||
void setServicesSignatureVerifier(SignatureVerifier servicesSignatureVerifier);
|
||||
|
||||
@Mutable
|
||||
@Accessor("skinProvider")
|
||||
void setSkinProvider(PlayerSkinProvider skinProvider);
|
||||
|
||||
@Mutable
|
||||
@Accessor("socialInteractionsManager")
|
||||
void setSocialInteractionsManager(SocialInteractionsManager socialInteractionsManager);
|
||||
|
||||
@Mutable
|
||||
@Accessor("userApiService")
|
||||
void setUserApiService(UserApiService userApiService);
|
||||
|
||||
@Mutable
|
||||
@Accessor("abuseReportContext")
|
||||
void setAbuseReportContext(AbuseReportContext abuseReportContext);
|
||||
|
||||
@Mutable
|
||||
@Accessor("profileKeys")
|
||||
void setProfileKeys(ProfileKeys profileKeys);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import net.minecraft.client.texture.PlayerSkinProvider;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Mixin(PlayerSkinProvider.class)
|
||||
public interface PlayerSkinProviderAccessor {
|
||||
@Accessor("skinCacheDir")
|
||||
File getSkinCacheDir();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.utils.accounts.CustomYggdrasilAccount;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
@Mixin(value = Account.class, remap = false)
|
||||
public class AccountMixin {
|
||||
@ModifyArg(method = "toTag", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NbtCompound;putString(Ljava/lang/String;Ljava/lang/String;)V", ordinal = 0), index = 1)
|
||||
private String putString(String key) {
|
||||
if ((Object) this instanceof CustomYggdrasilAccount) return "Yggdrasil";
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.utils.accounts.CustomYggdrasilAccount;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Accounts;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(value = Accounts.class, remap = false)
|
||||
public class AccountsMixin {
|
||||
@Inject(method = "lambda$fromTag$0", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NbtCompound;getString(Ljava/lang/String;)Ljava/lang/String;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
|
||||
private static void onFromTag(NbtElement tag1, CallbackInfoReturnable<Account<?>> cir, NbtCompound t) {
|
||||
if (t.getString("type").equals("Yggdrasil")) {
|
||||
Account<CustomYggdrasilAccount> account = new CustomYggdrasilAccount(null, null, null).fromTag(t);
|
||||
if (account.fetchInfo()) cir.setReturnValue(account);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.utils.accounts.AddCustomYggdrasilAccountScreen;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.WindowScreen;
|
||||
import meteordevelopment.meteorclient.gui.screens.AccountsScreen;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WContainer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import static meteordevelopment.meteorclient.MeteorClient.mc;
|
||||
|
||||
@Mixin(value = AccountsScreen.class, remap = false)
|
||||
public abstract class AccountsScreenMixin extends WindowScreen {
|
||||
public AccountsScreenMixin(GuiTheme theme, WWidget icon, String title) {
|
||||
super(theme, icon, title);
|
||||
}
|
||||
|
||||
@Shadow
|
||||
protected abstract void addButton(WContainer c, String text, Runnable action);
|
||||
|
||||
@Inject(method = "initWidgets", at = @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/gui/screens/AccountsScreen;addButton(Lmeteordevelopment/meteorclient/gui/widgets/containers/WContainer;Ljava/lang/String;Ljava/lang/Runnable;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void afterAddCrackedButton(CallbackInfo info, WHorizontalList l) {
|
||||
addButton(l, "Yggdrasil", () -> mc.setScreen(new AddCustomYggdrasilAccountScreen(theme, (AccountsScreen) (Object) this)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.utils.accounts.CustomYggdrasilAccount;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WAccount;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
@Mixin(value = WAccount.class, remap = false)
|
||||
public class WAccountMixin {
|
||||
@Shadow @Final private Account<?> account;
|
||||
|
||||
@ModifyArg(method = "init", at = @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/gui/GuiTheme;label(Ljava/lang/String;)Lmeteordevelopment/meteorclient/gui/widgets/WLabel;",ordinal = 1))
|
||||
private String accountName(String text) {
|
||||
if (account instanceof CustomYggdrasilAccount) return "(Yggdrasil)";
|
||||
return text;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user