content: package io.github.anonymous123_code.quilt_bisect.mixin;
  
  import io.github.anonymous123_code.quilt_bisect.shared_mod.AbstractBisectConfig;
  import io.github.anonymous123_code.quilt_bisect.shared_mod.AutoTest;
  import net.minecraft.client.MinecraftClient;
  import net.minecraft.client.gui.screen.ConnectScreen;
  import net.minecraft.client.gui.screen.Screen;
  import net.minecraft.client.network.ServerAddress;
  import net.minecraft.client.network.ServerInfo;
  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.CallbackInfo;
  
  import java.io.IOException;
  import java.nio.file.Files;
  
  @Mixin(ConnectScreen.class)
  public class ConnectScreenMixin {
  	@Inject(method = "connect(Lnet/minecraft/client/gui/screen/Screen;Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ServerAddress;Lnet/minecraft/client/network/ServerInfo;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;startOnlineMode()V"))
  	private static void updateAutoJoinData(Screen screen, MinecraftClient client, ServerAddress address, ServerInfo info, boolean quickPlay, CallbackInfo ci) {
  		try {
  			Files.writeString(AbstractBisectConfig.configDirectory.resolve("lastActiveJoin.txt"), AutoTest.AutoJoinType.Server + "\n" + address.toString());
  		} catch (IOException e) {
  			throw new RuntimeException("Failed to write last join comm file", e);
  		}
  	}
  }
  