Remove account mixins (meteor added them), Fix account not working in prod env. (#232)
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
package anticope.rejects.utils.accounts;
|
||||
|
||||
import anticope.rejects.mixin.MinecraftClientAccessor;
|
||||
import anticope.rejects.mixin.PlayerSkinProviderAccessor;
|
||||
import com.mojang.authlib.exceptions.AuthenticationException;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.minecraft.UserApiService;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
import net.minecraft.client.network.SocialInteractionsManager;
|
||||
import net.minecraft.client.report.AbuseReportContext;
|
||||
import net.minecraft.client.report.ReporterEnvironment;
|
||||
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 java.io.File;
|
||||
|
||||
import static meteordevelopment.meteorclient.MeteorClient.mc;
|
||||
|
||||
public class AccountUtils {
|
||||
public static MinecraftSessionService applyLoginEnvironment(YggdrasilAuthenticationService authService, MinecraftSessionService sessService, Session session) {
|
||||
File skinDir = ((PlayerSkinProviderAccessor) mc.getSkinProvider()).getSkinCacheDir();
|
||||
((MinecraftClientAccessor) mc).setSession(session);
|
||||
((MinecraftClientAccessor) mc).setAuthenticationService(authService);
|
||||
((MinecraftClientAccessor) mc).setSessionService(sessService);
|
||||
((MinecraftClientAccessor) mc).setServicesSignatureVerifier(SignatureVerifier.create(authService.getServicesKey()));
|
||||
((MinecraftClientAccessor) mc).setSkinProvider(new PlayerSkinProvider(mc.getTextureManager(), skinDir, sessService));
|
||||
UserApiService apiService = createUserApiService(authService, session);
|
||||
((MinecraftClientAccessor) mc).setUserApiService(apiService);
|
||||
((MinecraftClientAccessor) mc).setSocialInteractionsManager(new SocialInteractionsManager(mc, apiService));
|
||||
((MinecraftClientAccessor) mc).setProfileKeys(ProfileKeys.create(apiService, session, mc.runDirectory.toPath()));
|
||||
((MinecraftClientAccessor) mc).setAbuseReportContext(AbuseReportContext.create(ReporterEnvironment.ofIntegratedServer(), apiService));
|
||||
return sessService;
|
||||
}
|
||||
|
||||
public static UserApiService createUserApiService(YggdrasilAuthenticationService authService, Session session) {
|
||||
try {
|
||||
return authService.createUserApiService(session.getAccessToken());
|
||||
} catch (AuthenticationException e) {
|
||||
return UserApiService.OFFLINE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package anticope.rejects.utils.accounts;
|
||||
|
||||
import com.mojang.authlib.exceptions.AuthenticationException;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
@@ -37,9 +38,12 @@ public class CustomYggdrasilAccount extends Account<CustomYggdrasilAccount> {
|
||||
@Override
|
||||
public boolean login() {
|
||||
try {
|
||||
Session session = CustomYggdrasilLogin.login(name, password, server);
|
||||
CustomYggdrasilLogin.LocalYggdrasilAuthenticationService service = new CustomYggdrasilLogin.LocalYggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy(), server);
|
||||
CustomYggdrasilLogin.applyYggdrasilAccount(service, session);
|
||||
MinecraftSessionService sessService = new CustomYggdrasilLogin.LocalYggdrasilMinecraftSessionService(service, service.server);
|
||||
applyLoginEnvironment(service, sessService);
|
||||
|
||||
Session session = CustomYggdrasilLogin.login(name, password, server);
|
||||
setSession(session);
|
||||
cache.username = session.getUsername();
|
||||
cache.loadHead();
|
||||
return true;
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.exceptions.AuthenticationException;
|
||||
import com.mojang.authlib.minecraft.InsecureTextureException;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
|
||||
@@ -56,11 +55,6 @@ public class CustomYggdrasilLogin {
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyYggdrasilAccount(LocalYggdrasilAuthenticationService authService, Session session) {
|
||||
MinecraftSessionService service = new LocalYggdrasilMinecraftSessionService(authService, authService.server);
|
||||
AccountUtils.applyLoginEnvironment(authService, service, session);
|
||||
}
|
||||
|
||||
public static class LocalYggdrasilApi implements Environment {
|
||||
private final String url;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user