From 6832e762d4e70edffdbdd057f6ec8d9c9bbab308 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 1 Oct 2022 12:12:56 +0200 Subject: [PATCH] Yeeting Libs --- fabric/build.gradle | 4 ---- .../chaoscaot/altauth/fabric/mixin/LoginRequestMixin.java | 7 ++++--- .../altauth/fabric/mixin/MinecraftServerMixin.java | 8 ++++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/fabric/build.gradle b/fabric/build.gradle index c377f4b..169fbb6 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -31,10 +31,6 @@ dependencies { } modCompileOnlyApi "com.terraformersmc:modmenu:4.0.6" compileOnly project(":common") - - // Used to Override 'private final' - compileOnly 'org.jooq:joor:0.9.14' - include 'org.jooq:joor:0.9.14' } processResources { diff --git a/fabric/src/de/chaoscaot/altauth/fabric/mixin/LoginRequestMixin.java b/fabric/src/de/chaoscaot/altauth/fabric/mixin/LoginRequestMixin.java index 09b326b..41c1f1b 100644 --- a/fabric/src/de/chaoscaot/altauth/fabric/mixin/LoginRequestMixin.java +++ b/fabric/src/de/chaoscaot/altauth/fabric/mixin/LoginRequestMixin.java @@ -3,9 +3,11 @@ package de.chaoscaot.altauth.fabric.mixin; import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; +import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; import de.chaoscaot.altauth.fabric.AltAuth; import de.chaoscaot.altauth.fabric.TrustServerScreen; import de.chaoscaot.altauth.fabric.config.ClientConfig; +import de.lixfel.ReflectionUtil; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -14,7 +16,6 @@ import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.network.ClientLoginNetworkHandler; import net.minecraft.network.packet.s2c.login.LoginHelloS2CPacket; import net.minecraft.text.Text; -import org.joor.Reflect; import org.slf4j.Logger; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -44,7 +45,7 @@ public class LoginRequestMixin { cs.status = Text.translatable("gui.altauth.connecting", server); } URL url = new URL("https://" + server + "/session/minecraft/join"); - Reflect.on(MinecraftClient.getInstance().getSessionService()).set("joinUrl", url); + ReflectionUtil.getField(YggdrasilMinecraftSessionService.class, URL.class, 0).set(MinecraftClient.getInstance().getSessionService(), url); } else { if(MinecraftClient.getInstance().currentScreen instanceof ConnectScreen cs) { ci.cancel(); @@ -59,7 +60,7 @@ public class LoginRequestMixin { } else { LOGGER.info("AltauthClient: LoginRequestMixin: Server is running on mojang"); URL url = new URL(YggdrasilEnvironment.PROD.getEnvironment().getSessionHost() + "/session/minecraft/join"); - Reflect.on(MinecraftClient.getInstance().getSessionService()).set("joinUrl", url); + ReflectionUtil.getField(YggdrasilMinecraftSessionService.class, URL.class, 0).set(MinecraftClient.getInstance().getSessionService(), url); } } catch (Exception e) { e.printStackTrace(); diff --git a/fabric/src/de/chaoscaot/altauth/fabric/mixin/MinecraftServerMixin.java b/fabric/src/de/chaoscaot/altauth/fabric/mixin/MinecraftServerMixin.java index b3a4d89..d1b3cd0 100644 --- a/fabric/src/de/chaoscaot/altauth/fabric/mixin/MinecraftServerMixin.java +++ b/fabric/src/de/chaoscaot/altauth/fabric/mixin/MinecraftServerMixin.java @@ -2,18 +2,20 @@ package de.chaoscaot.altauth.fabric.mixin; +import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; import com.mojang.datafixers.DataFixer; import de.chaoscaot.altauth.fabric.AltAuth; import de.chaoscaot.altauth.fabric.config.ServerConfig; +import de.lixfel.ReflectionUtil; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; import net.minecraft.resource.ResourcePackManager; import net.minecraft.server.MinecraftServer; import net.minecraft.server.SaveLoader; import net.minecraft.server.WorldGenerationProgressListenerFactory; import net.minecraft.util.ApiServices; import net.minecraft.world.level.storage.LevelStorage; -import org.joor.Reflect; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -31,9 +33,7 @@ public class MinecraftServerMixin { private void apiServiceMixin(Thread serverThread, LevelStorage.Session session, ResourcePackManager dataPackManager, SaveLoader saveLoader, Proxy proxy, DataFixer dataFixer, ApiServices apiServices, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory, CallbackInfo ci) { try { URL url = new URL("https://" + ServerConfig.INSTANCE.serverUrl + "/session/minecraft/hasJoined"); - Reflect.on(apiServices.sessionService()).set("checkUrl", url); - URL joinUrl = new URL("https://" + ServerConfig.INSTANCE.serverUrl + "/session/minecraft/join"); - Reflect.on(apiServices.sessionService()).set("joinUrl", joinUrl); + ReflectionUtil.getField(YggdrasilMinecraftSessionService.class, URL.class, 1).set(MinecraftClient.getInstance().getSessionService(), url); } catch (MalformedURLException e) { AltAuth.LOGGER.error("Malformed URL: {}", e.getMessage()); }