vanilla-fixes

Minecraft: Better than Adventure! mod that fixes some issues
git clone git://memoryshards.xyz/vanilla-fixes.git
Log | Files | Refs | README | LICENSE

commit 218a67563278c30ad00744b43e1849179104f0d7
parent 6f7134447cd54e9bc82e221102cac1c59b81a641
Author: Amb0s <ambos@disroot.org>
Date:   Sat, 30 May 2020 14:29:31 +0200

Improved mixin

Diffstat:
Msrc/main/java/ambos/vanillafixes/mixin/ClientPlayNetworkHandlerMixin.java | 24+++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/main/java/ambos/vanillafixes/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/ambos/vanillafixes/mixin/ClientPlayNetworkHandlerMixin.java @@ -1,28 +1,14 @@ package ambos.vanillafixes.mixin; -import net.minecraft.client.Minecraft; import net.minecraft.network.ClientPlayNetworkHandler; -import net.minecraft.packet.login.ClientUsernameC2S; 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.Redirect; - -import java.net.MalformedURLException; -import java.net.URL; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; @Mixin(ClientPlayNetworkHandler.class) final class ClientPlayNetworkHandlerMixin { - @Shadow - private Minecraft minecraft; - - @Redirect(method = "method_1471", at = @At(value = "NEW", target = "java/net/URL")) - private URL toURL(String s, ClientUsernameC2S arg) { - try { - return new URL("http://session.minecraft.net/game/joinserver.jsp?user=" + minecraft.session.username + - "&sessionId=" + minecraft.session.field_873 + "&serverId=" + arg.serverId); - } catch (MalformedURLException e) { - return null; - } + @ModifyConstant(method = "method_1471", constant = @Constant(stringValue = "http://www.minecraft.net/game/joinserver.jsp?user=")) + private String changeURL(String url) { + return "http://session.minecraft.net/game/joinserver.jsp?user="; } }