diff --git a/src/main/java/anticope/rejects/mixin/MinecraftClientAccessor.java b/src/main/java/anticope/rejects/mixin/MinecraftClientAccessor.java deleted file mode 100644 index 5e7d71f7..00000000 --- a/src/main/java/anticope/rejects/mixin/MinecraftClientAccessor.java +++ /dev/null @@ -1,54 +0,0 @@ -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); -} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/mixin/PlayerSkinProviderAccessor.java b/src/main/java/anticope/rejects/mixin/PlayerSkinProviderAccessor.java deleted file mode 100644 index 0bd1f795..00000000 --- a/src/main/java/anticope/rejects/mixin/PlayerSkinProviderAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -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(); -} diff --git a/src/main/java/anticope/rejects/mixin/meteor/AccountMixin.java b/src/main/java/anticope/rejects/mixin/meteor/AccountMixin.java index f5d718c6..b83cfc1d 100644 --- a/src/main/java/anticope/rejects/mixin/meteor/AccountMixin.java +++ b/src/main/java/anticope/rejects/mixin/meteor/AccountMixin.java @@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; -@Mixin(value = Account.class, remap = false) +@Mixin(value = Account.class) 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) { diff --git a/src/main/java/anticope/rejects/mixin/meteor/AccountsMixin.java b/src/main/java/anticope/rejects/mixin/meteor/AccountsMixin.java index 4398cd63..e263a1d4 100644 --- a/src/main/java/anticope/rejects/mixin/meteor/AccountsMixin.java +++ b/src/main/java/anticope/rejects/mixin/meteor/AccountsMixin.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -@Mixin(value = Accounts.class, remap = false) +@Mixin(value = Accounts.class) 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> cir, NbtCompound t) { diff --git a/src/main/java/anticope/rejects/utils/accounts/AccountUtils.java b/src/main/java/anticope/rejects/utils/accounts/AccountUtils.java deleted file mode 100644 index 288a0ce4..00000000 --- a/src/main/java/anticope/rejects/utils/accounts/AccountUtils.java +++ /dev/null @@ -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; - } - } -} - diff --git a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java index 0f4b9a3d..57adf390 100644 --- a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java +++ b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilAccount.java @@ -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 boolean fetchInfo() { @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; diff --git a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java index bb6e2874..b19fd3c2 100644 --- a/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java +++ b/src/main/java/anticope/rejects/utils/accounts/CustomYggdrasilLogin.java @@ -9,7 +9,6 @@ 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 static Session login(String name, String password, String server) throws } } - 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; diff --git a/src/main/resources/meteor-rejects.mixins.json b/src/main/resources/meteor-rejects.mixins.json index 9f489c3d..b681774e 100644 --- a/src/main/resources/meteor-rejects.mixins.json +++ b/src/main/resources/meteor-rejects.mixins.json @@ -12,11 +12,9 @@ "GameRendererMixin", "LivingEntityMixin", "LivingEntityRendererMixin", - "MinecraftClientAccessor", "MultiplayerScreenAccessor", "MultiplayerScreenMixin", "PlayerMoveC2SPacketAccessor", - "PlayerSkinProviderAccessor", "ServerListAccessor", "StructureVoidBlockMixin", "TexturedRenderLayersMixin",