From bb4a34e777abfc475907e3ffb4c5f42de7713ab5 Mon Sep 17 00:00:00 2001
From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com>
Date: Sun, 7 Jul 2024 14:23:12 -0300
Subject: [PATCH] remove legacy versions from main branch
---
build.gradle | 2 -
gradle.properties | 2 +-
settings.gradle.kts | 2 -
src/main/resources/fabric.mod.json | 2 +-
viafabric-mc1122/build.gradle.kts | 14 --
.../viaversion/fabric/mc1122/ViaFabric.java | 97 ----------
.../mc1122/commands/NMSCommandImpl.java | 66 -------
.../mc1122/commands/NMSCommandSender.java | 62 ------
.../mc1122/commands/VFCommandHandler.java | 31 ---
.../fabric/mc1122/gui/ChangedListener.java | 43 -----
.../fabric/mc1122/gui/ListeneableButton.java | 37 ----
.../fabric/mc1122/gui/ViaButton.java | 67 -------
.../fabric/mc1122/gui/ViaConfigScreen.java | 180 ------------------
.../client/MixinConnectScreenThread.java | 41 ----
.../address/client/MixinServerAddress.java | 46 -----
.../address/client/MixinServerPinger.java | 42 ----
.../debug/client/MixinClientConnection.java | 41 ----
.../client/MixinClientConnectionAccessor.java | 29 ---
.../mixin/debug/client/MixinDebugHud.java | 56 ------
.../gui/client/MixinMultiplayerScreen.java | 54 ------
.../mixin/pipeline/MixinClientConnection.java | 38 ----
.../pipeline/MixinServerNetworkIoChInit.java | 45 -----
.../client/MixinClientConnection.java | 44 -----
.../client/MixinClientConnectionChInit.java | 47 -----
.../MixinHandshakeC2SPacketAccessor.java | 11 --
.../shutdown/server/MixinMinecraftServer.java | 34 ----
.../platform/FabricNativeVersionProvider.java | 50 -----
.../mc1122/platform/FabricPlatform.java | 152 ---------------
.../fabric/mc1122/platform/VFLoader.java | 48 -----
.../providers/FabricVersionProvider.java | 45 -----
.../mc1122/providers/VFHandItemProvider.java | 95 ---------
.../mc1122/service/ProtocolAutoDetector.java | 143 --------------
.../src/main/resources/fabric.mod.json | 60 ------
.../mixins.viafabric1122.address.json | 15 --
.../resources/mixins.viafabric1122.debug.json | 15 --
.../resources/mixins.viafabric1122.gui.json | 13 --
.../mixins.viafabric1122.pipeline.json | 17 --
.../mixins.viafabric1122.shutdown.json | 13 --
viafabric-mc189/build.gradle.kts | 17 --
.../viaversion/fabric/mc189/ViaFabric.java | 97 ----------
.../fabric/mc189/commands/NMSCommandImpl.java | 64 -------
.../mc189/commands/NMSCommandSender.java | 62 ------
.../mc189/commands/VFCommandHandler.java | 31 ---
.../fabric/mc189/gui/ChangedListener.java | 43 -----
.../fabric/mc189/gui/ListeneableButton.java | 37 ----
.../fabric/mc189/gui/ModMenuConfig.java | 35 ----
.../fabric/mc189/gui/ViaButton.java | 67 -------
.../fabric/mc189/gui/ViaConfigScreen.java | 180 ------------------
.../client/MixinConnectScreenThread.java | 41 ----
.../address/client/MixinServerAddress.java | 46 -----
.../address/client/MixinServerPinger.java | 42 ----
.../debug/client/MixinClientConnection.java | 41 ----
.../client/MixinClientConnectionAccessor.java | 29 ---
.../mixin/debug/client/MixinDebugHud.java | 56 ------
.../gui/client/MixinMultiplayerScreen.java | 54 ------
.../mixin/pipeline/MixinClientConnection.java | 38 ----
.../pipeline/MixinServerNetworkIoChInit.java | 45 -----
.../client/MixinClientConnection.java | 44 -----
.../client/MixinClientConnectionChInit.java | 47 -----
.../shutdown/server/MixinMinecraftServer.java | 34 ----
.../platform/FabricNativeVersionProvider.java | 50 -----
.../fabric/mc189/platform/FabricPlatform.java | 152 ---------------
.../fabric/mc189/platform/VFLoader.java | 48 -----
.../providers/FabricVersionProvider.java | 45 -----
.../mc189/providers/VFHandItemProvider.java | 95 ---------
.../mc189/service/ProtocolAutoDetector.java | 137 -------------
.../src/main/resources/fabric.mod.json | 76 --------
.../mixins.viafabric189.address.json | 15 --
.../resources/mixins.viafabric189.debug.json | 15 --
.../resources/mixins.viafabric189.gui.json | 13 --
.../mixins.viafabric189.pipeline.json | 16 --
.../mixins.viafabric189.shutdown.json | 13 --
72 files changed, 2 insertions(+), 3622 deletions(-)
delete mode 100644 viafabric-mc1122/build.gradle.kts
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/ViaFabric.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandImpl.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandSender.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/VFCommandHandler.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ChangedListener.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ListeneableButton.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaButton.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaConfigScreen.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinConnectScreenThread.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerAddress.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerPinger.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnection.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnectionAccessor.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinDebugHud.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/gui/client/MixinMultiplayerScreen.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinClientConnection.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinServerNetworkIoChInit.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnection.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnectionChInit.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinHandshakeC2SPacketAccessor.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/shutdown/server/MixinMinecraftServer.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricNativeVersionProvider.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricPlatform.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/VFLoader.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/FabricVersionProvider.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/VFHandItemProvider.java
delete mode 100644 viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/service/ProtocolAutoDetector.java
delete mode 100644 viafabric-mc1122/src/main/resources/fabric.mod.json
delete mode 100644 viafabric-mc1122/src/main/resources/mixins.viafabric1122.address.json
delete mode 100644 viafabric-mc1122/src/main/resources/mixins.viafabric1122.debug.json
delete mode 100644 viafabric-mc1122/src/main/resources/mixins.viafabric1122.gui.json
delete mode 100644 viafabric-mc1122/src/main/resources/mixins.viafabric1122.pipeline.json
delete mode 100644 viafabric-mc1122/src/main/resources/mixins.viafabric1122.shutdown.json
delete mode 100644 viafabric-mc189/build.gradle.kts
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/ViaFabric.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandImpl.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandSender.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/VFCommandHandler.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ChangedListener.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ListeneableButton.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ModMenuConfig.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaButton.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaConfigScreen.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinConnectScreenThread.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerAddress.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerPinger.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnection.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnectionAccessor.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinDebugHud.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/gui/client/MixinMultiplayerScreen.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinClientConnection.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinServerNetworkIoChInit.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnection.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnectionChInit.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/shutdown/server/MixinMinecraftServer.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricNativeVersionProvider.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricPlatform.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/VFLoader.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/FabricVersionProvider.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/VFHandItemProvider.java
delete mode 100644 viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/service/ProtocolAutoDetector.java
delete mode 100644 viafabric-mc189/src/main/resources/fabric.mod.json
delete mode 100644 viafabric-mc189/src/main/resources/mixins.viafabric189.address.json
delete mode 100644 viafabric-mc189/src/main/resources/mixins.viafabric189.debug.json
delete mode 100644 viafabric-mc189/src/main/resources/mixins.viafabric189.gui.json
delete mode 100644 viafabric-mc189/src/main/resources/mixins.viafabric189.pipeline.json
delete mode 100644 viafabric-mc189/src/main/resources/mixins.viafabric189.shutdown.json
diff --git a/build.gradle b/build.gradle
index e7ebf170..12a7223f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -199,7 +199,6 @@ curseforge {
displayName = versionNameMsg
relations {
optionalDependency("fabric-api")
- optionalDependency("legacy-fabric-api")
embeddedLibrary("cotton-client-commands")
}
}
@@ -231,7 +230,6 @@ modrinth {
dependencies {
optional.project "P7dR8mSH" // fabric api
- optional.project "9CJED7xi" // legacy fabric api
embedded.project "P1OZGk5p" // viaversion
}
}
diff --git a/gradle.properties b/gradle.properties
index 1efb0a0a..50483fda 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -5,7 +5,7 @@ loader_version=0.15.11
viaver_version=5.0.2-SNAPSHOT
yaml_version=2.2
-publish_mc_versions=1.21, 1.20.6, 1.20.4, 1.20.1, 1.19.4, 1.18.2, 1.17.1, 1.16.5, 1.15.2, 1.14.4, 1.12.2, 1.8.9
+publish_mc_versions=1.21, 1.20.6, 1.20.4, 1.20.1, 1.19.4, 1.18.2, 1.17.1, 1.16.5, 1.15.2, 1.14.4
# example: 1.19.1-rc1. Can be a blank value
modrinth_mc_snapshot=
# example: 1.19-Snapshot. Can be a blank value
diff --git a/settings.gradle.kts b/settings.gradle.kts
index f8478917..3d4cba2a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -8,8 +8,6 @@ pluginManagement {
rootProject.name = "ViaFabric"
-include("viafabric-mc189")
-include("viafabric-mc1122")
include("viafabric-mc1144")
include("viafabric-mc1152")
include("viafabric-mc1165")
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 4d6c8076..5c2f6e0f 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -13,7 +13,7 @@
},
"depends": {
"fabricloader": ">=0.15.11",
- "minecraft": ["1.8.9", "1.12.2", "1.14.4", "1.15.2", "1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20.1", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21"],
+ "minecraft": ["1.14.4", "1.15.2", "1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20.1", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21"],
"viaversion": ">=5.0.0"
},
"breaks": {
diff --git a/viafabric-mc1122/build.gradle.kts b/viafabric-mc1122/build.gradle.kts
deleted file mode 100644
index cff9b959..00000000
--- a/viafabric-mc1122/build.gradle.kts
+++ /dev/null
@@ -1,14 +0,0 @@
-dependencies {
- minecraft("com.mojang:minecraft:1.12.2")
- mappings("net.legacyfabric:yarn:1.12.2+build.541:v2")
-
- modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:1.9.4+1.12.2")
-
- // fix newer java
- @Suppress("GradlePackageUpdate", "RedundantSuppression")
- implementation("io.netty:netty-all:4.0.56.Final")
-}
-
-loom {
- intermediaryUrl.set("https://maven.legacyfabric.net/net/legacyfabric/intermediary/%1\$s/intermediary-%1\$s-v2.jar")
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/ViaFabric.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/ViaFabric.java
deleted file mode 100644
index 30495444..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/ViaFabric.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122;
-
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.viaversion.fabric.common.config.VFConfig;
-import com.viaversion.fabric.common.platform.FabricInjector;
-import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
-import com.viaversion.fabric.common.util.JLoggerToLog4j;
-import com.viaversion.fabric.mc1122.commands.NMSCommandImpl;
-import com.viaversion.fabric.mc1122.commands.VFCommandHandler;
-import com.viaversion.fabric.mc1122.platform.FabricPlatform;
-import com.viaversion.fabric.mc1122.platform.VFLoader;
-import com.viaversion.viaversion.ViaManagerImpl;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import io.netty.channel.EventLoop;
-import io.netty.channel.local.LocalEventLoopGroup;
-import net.fabricmc.api.ModInitializer;
-import net.fabricmc.loader.api.FabricLoader;
-import net.legacyfabric.fabric.api.registry.CommandRegistry;
-import org.apache.logging.log4j.LogManager;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.logging.Logger;
-
-public class ViaFabric implements ModInitializer {
- public static final Logger JLOGGER = new JLoggerToLog4j(LogManager.getLogger("ViaFabric"));
- public static final ExecutorService ASYNC_EXECUTOR;
- public static final EventLoop EVENT_LOOP;
- public static final CompletableFuture INIT_FUTURE = new CompletableFuture<>();
- public static VFConfig config;
-
- static {
- ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ViaFabric-%d").build();
- ASYNC_EXECUTOR = Executors.newFixedThreadPool(8, factory);
- EVENT_LOOP = new LocalEventLoopGroup(1, factory).next(); // ugly code
- EVENT_LOOP.submit(INIT_FUTURE::join); // https://github.com/ViaVersion/ViaFabric/issues/53 ugly workaround code but works tm
- }
-
- @Override
- public void onInitialize() {
- FabricPlatform platform = new FabricPlatform();
-
- Via.init(ViaManagerImpl.builder()
- .injector(new FabricInjector())
- .loader(new VFLoader())
- .commandHandler(new VFCommandHandler())
- .platform(platform).build());
-
- platform.init();
-
- ViaManagerImpl manager = (ViaManagerImpl) Via.getManager();
- manager.init();
-
- HostnameParserProtocol.INSTANCE.initialize();
- HostnameParserProtocol.INSTANCE.register(Via.getManager().getProviders());
- ProtocolVersion.register(-2, "AUTO");
-
- FabricLoader.getInstance().getEntrypoints("viafabric:via_api_initialized", Runnable.class).forEach(Runnable::run);
-
- registerCommandsV1();
-
- config = new VFConfig(FabricLoader.getInstance().getConfigDir().resolve("ViaFabric")
- .resolve("viafabric.yml").toFile(), JLOGGER);
-
- manager.onServerLoaded();
-
- INIT_FUTURE.complete(null);
- }
-
- private void registerCommandsV1() {
- try {
- CommandRegistry.INSTANCE.register(new NMSCommandImpl(Via.getManager().getCommandHandler()));
- } catch (NoClassDefFoundError ignored2) {
- JLOGGER.info("Couldn't register command as Fabric Commands isn't installed");
- }
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandImpl.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandImpl.java
deleted file mode 100644
index a570d562..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandImpl.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.commands;
-
-import net.minecraft.command.AbstractCommand;
-import net.minecraft.command.CommandSource;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.math.BlockPos;
-import com.viaversion.viaversion.api.command.ViaVersionCommand;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class NMSCommandImpl extends AbstractCommand {
- private final ViaVersionCommand handler;
-
- public NMSCommandImpl(ViaVersionCommand handler) {
- this.handler = handler;
- }
-
- @Override
- public String getCommandName() {
- return "viaversion";
- }
-
- @Override
- public List getAliases() {
- return Arrays.asList("vvfabric", "viaver");
- }
-
- @Override
- public void method_3279(MinecraftServer minecraftServer, CommandSource commandSource, String[] strings) {
- handler.onCommand(new NMSCommandSender(commandSource), strings);
- }
-
- @Override
- public String getUsageTranslationKey(CommandSource commandSource) {
- return "/viaversion [help|subcommand]";
- }
-
- @Override
- public List method_10738(MinecraftServer server, CommandSource commandSource, String[] strings, @Nullable BlockPos pos) {
- return handler.onTabComplete(new NMSCommandSender(commandSource), strings);
- }
-
- @Override
- public int getPermissionLevel() {
- return 3;
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandSender.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandSender.java
deleted file mode 100644
index 4e33caf5..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/NMSCommandSender.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.commands;
-
-import com.viaversion.viaversion.api.command.ViaCommandSender;
-import com.viaversion.viaversion.util.ComponentUtil;
-import net.minecraft.command.CommandSource;
-import net.minecraft.entity.Entity;
-import net.minecraft.text.Text;
-
-import java.nio.charset.StandardCharsets;
-import java.util.UUID;
-
-public class NMSCommandSender implements ViaCommandSender {
- private final CommandSource source;
-
- public NMSCommandSender(CommandSource source) {
- this.source = source;
- }
-
- @Override
- public boolean hasPermission(String s) {
- // https://gaming.stackexchange.com/questions/138602/what-does-op-permission-level-do
- return source.canUseCommand(3, "viaversion.admin"); // the string seems to be the command
- }
-
- @Override
- public void sendMessage(String s) {
- source.sendMessage(Text.Serializer.deserializeText(ComponentUtil.legacyToJsonString(s)));
- }
-
- @Override
- public UUID getUUID() {
- if (source instanceof Entity) {
- return ((Entity) source).getUuid();
- }
- return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8));
- }
-
- @Override
- public String getName() {
- if (source instanceof Entity) {
- return source.getName().asUnformattedString();
- }
- return "?";
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/VFCommandHandler.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/VFCommandHandler.java
deleted file mode 100644
index d8b3b985..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/commands/VFCommandHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.commands;
-
-import com.viaversion.fabric.common.commands.subs.LeakDetectSubCommand;
-import com.viaversion.viaversion.commands.ViaCommandHandler;
-
-public class VFCommandHandler extends ViaCommandHandler {
- {
- try {
- registerSubCommand(new LeakDetectSubCommand());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ChangedListener.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ChangedListener.java
deleted file mode 100644
index 7d0dd6f6..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ChangedListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.gui;
-
-import net.minecraft.client.gui.widget.PagedEntryListWidget;
-
-import java.util.function.Consumer;
-
-public class ChangedListener implements PagedEntryListWidget.Listener {
- private final Consumer consumer;
-
- public ChangedListener(Consumer consumer) {
- this.consumer = consumer;
- }
-
- @Override
- public void setBooleanValue(int id, boolean value) {
- }
-
- @Override
- public void setFloatValue(int id, float value) {
- }
-
- @Override
- public void setStringValue(int id, String text) {
- consumer.accept(text);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ListeneableButton.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ListeneableButton.java
deleted file mode 100644
index df2967d7..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ListeneableButton.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.gui;
-
-import net.minecraft.client.gui.widget.ButtonWidget;
-
-import java.util.function.Consumer;
-
-public class ListeneableButton extends ButtonWidget {
- private final Consumer click;
-
- public ListeneableButton(int id, int x, int y, int width, int height, String message, Consumer click) {
- super(id, x, y, width, height, message);
- this.click = click;
- }
-
- @Override
- public void mouseReleased(int mouseX, int mouseY) {
- super.mouseReleased(mouseX, mouseY);
- click.accept(this);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaButton.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaButton.java
deleted file mode 100644
index e616c65d..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaButton.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.gui;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.sound.SoundManager;
-import net.minecraft.util.Identifier;
-
-import java.util.function.Consumer;
-
-public class ViaButton extends ButtonWidget {
- // Meant to be similar to higher versions TexturedButtonWidget
- private final int startU;
- private final int startV;
- private final int offsetHoverV;
- private final Identifier texturePath;
- private final Consumer onClick;
-
- public ViaButton(int id, int x, int y, int width, int height, int startU, int startV, int offsetHoverV, Identifier texturePath,
- int textureSizeX, int textureSizeY, Consumer onClick, String altTxt) {
- super(id, x, y, width, height, altTxt);
- this.startU = startU;
- this.startV = startV;
- this.offsetHoverV = offsetHoverV;
- this.texturePath = texturePath;
- assert textureSizeX == 256;
- assert textureSizeY == 256;
- this.onClick = onClick;
- }
-
- public void render(MinecraftClient client, int mouseX, int mouseY) {
- // Modified copy-paste from LockButtonWidget
- if (this.visible) {
- client.getTextureManager().bindTexture(texturePath);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- boolean hover = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
- int v = startV;
- if (hover) {
- v += offsetHoverV;
- }
- this.drawTexture(this.x, this.y, startU, v, this.width, this.height);
- }
- }
-
- @Override
- public void playDownSound(SoundManager soundManager) {
- super.playDownSound(soundManager);
- onClick.accept(this);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaConfigScreen.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaConfigScreen.java
deleted file mode 100644
index b56930ae..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/gui/ViaConfigScreen.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.gui;
-
-import com.viaversion.fabric.common.config.AbstractViaConfigScreen;
-import com.viaversion.fabric.mc1122.ViaFabric;
-import com.viaversion.fabric.common.util.ProtocolUtils;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.ConfirmScreen;
-import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.gui.widget.TextFieldWidget;
-import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
-
-import java.util.concurrent.CompletableFuture;
-
-@Environment(EnvType.CLIENT)
-public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
- private static CompletableFuture latestProtocolSave;
- private final Screen parent;
- private TextFieldWidget protocolVersion;
- private final Text title;
-
- public ViaConfigScreen(Screen parent) {
- super();
- title = new TranslatableText(TITLE_TRANSLATE_ID);
- this.parent = parent;
- }
-
- @Override
- public void init() {
- int entries = 0;
-
- this.buttons.add(new ListeneableButton("clientside".hashCode(), calculatePosX(this.width, entries),
- calculatePosY(this.height, entries),
- 150,
- 20, getClientSideText().asUnformattedString(), this::onClickClientSide));
- entries++;
-
- this.buttons.add(new ListeneableButton("hidevia".hashCode(), calculatePosX(this.width, entries),
- calculatePosY(this.height, entries),
- 150,
- 20, getHideViaButtonText().asUnformattedString(), this::onHideViaButton));
- entries++;
-
- protocolVersion = new TextFieldWidget("protover".hashCode(), textRenderer,
- calculatePosX(this.width, entries),
- calculatePosY(this.height, entries),
- 150,
- 20);
- protocolVersion.setText(new TranslatableText(VERSION_TRANSLATE_ID).asUnformattedString());
- entries++;
-
- protocolVersion.setTextPredicate(ProtocolUtils::isStartOfProtocolText);
- protocolVersion.setListener(new ChangedListener(this::onChangeVersionField));
- int clientSideVersion = ViaFabric.config.getClientSideVersion();
- protocolVersion.setText(ProtocolUtils.getProtocolName(clientSideVersion));
- onChangeVersionField(protocolVersion.getText());
-
- //this.children.add(protocolVersion);
-
- buttons.add(new ListeneableButton("done".hashCode(), this.width / 2 - 100, this.height - 40, 200, 20, new TranslatableText("gui.done").asUnformattedString(),
- (buttonWidget) -> MinecraftClient.getInstance().setScreen(this.parent)));
- }
-
- private void onChangeVersionField(String text) {
- //protocolVersion.setSuggestion(null);
- int newVersion = ViaFabric.config.getClientSideVersion();
-
- Integer parsed = ProtocolUtils.parseProtocolId(text);
- boolean validProtocol;
-
- if (parsed != null) {
- newVersion = parsed;
- validProtocol = true;
- } else {
- validProtocol = false;
- }
-
- protocolVersion.setEditableColor(getProtocolTextColor(ProtocolVersion.getProtocol(newVersion), validProtocol));
-
- int finalNewVersion = newVersion;
- if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
- ViaFabric.config.setClientSideVersion(finalNewVersion);
- latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
- }
-
- private void onClickClientSide(ButtonWidget widget) {
- if (!ViaFabric.config.isClientSideEnabled()) {
- MinecraftClient.getInstance().setScreen(new ConfirmScreen(
- (answer, id) -> {
- if (answer) {
- ViaFabric.config.setClientSideEnabled(true);
- ViaFabric.config.setClientSideVersion(-2); // AUTO
- ViaFabric.config.save();
- widget.message = getClientSideText().asUnformattedString();
- }
- MinecraftClient.getInstance().setScreen(this);
- },
- new TranslatableText("gui.enable_client_side.question").asUnformattedString(),
- new TranslatableText("gui.enable_client_side.warning").asUnformattedString(),
- new TranslatableText("gui.enable_client_side.enable").asUnformattedString(),
- new TranslatableText("gui.cancel").asUnformattedString(),
- "via anticheat consent".hashCode()
- ));
- } else {
- ViaFabric.config.setClientSideEnabled(false);
- ViaFabric.config.save();
- }
- widget.message = getClientSideText().asUnformattedString();
- }
-
- @Override
- public void removed() {
- ViaFabric.config.save();
- }
-
- private TranslatableText getClientSideText() {
- return ViaFabric.config.isClientSideEnabled() ?
- new TranslatableText("gui.client_side.disable")
- : new TranslatableText("gui.client_side.enable");
- }
-
- private TranslatableText getHideViaButtonText() {
- return ViaFabric.config.isHideButton() ?
- new TranslatableText("gui.hide_via_button.disable") : new TranslatableText("gui.hide_via_button.enable");
- }
-
- private void onHideViaButton(ButtonWidget widget) {
- ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
- ViaFabric.config.save();
- widget.message = getHideViaButtonText().asUnformattedString();
- }
-
- @Override
- public void render(int mouseX, int mouseY, float delta) {
- this.renderBackground();
- drawCenteredString(this.textRenderer, this.title.asUnformattedString(), this.width / 2, 20, 16777215);
- super.render(mouseX, mouseY, delta);
- protocolVersion.render();
- }
-
- @Override
- public void tick() {
- super.tick();
- protocolVersion.tick();
- }
-
- @Override
- protected void keyPressed(char character, int code) {
- super.keyPressed(character, code);
- protocolVersion.keyPressed(character, code);
- }
-
- @Override
- protected void mouseClicked(int mouseX, int mouseY, int button) {
- super.mouseClicked(mouseX, mouseY, button);
- protocolVersion.method_920(mouseX, mouseY, button);
- }
-}
-
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinConnectScreenThread.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinConnectScreenThread.java
deleted file mode 100644
index bc85571f..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinConnectScreenThread.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.address.client;
-
-import com.viaversion.fabric.common.AddressParser;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-@Mixin(targets = "net.minecraft.client.gui.screen.ConnectScreen$1")
-public class MixinConnectScreenThread {
- @Redirect(method = "run()V", at = @At(value = "INVOKE",
- target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
- private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
- AddressParser viaAddr = new AddressParser().parse(address);
- if (viaAddr.viaSuffix == null) {
- return InetAddress.getByName(address);
- }
-
- InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
- return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerAddress.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerAddress.java
deleted file mode 100644
index b58a1e26..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerAddress.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.address.client;
-
-import com.viaversion.fabric.common.AddressParser;
-import net.minecraft.network.ServerAddress;
-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;
-
-@Mixin(ServerAddress.class)
-public abstract class MixinServerAddress {
- @Shadow
- private static String[] resolveSrv(String address) {
- throw new AssertionError();
- }
-
- @Redirect(method = "parse", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ServerAddress;resolveSrv(Ljava/lang/String;)[Ljava/lang/String;"))
- private static String[] modifySrvAddr(String address) {
- AddressParser viaAddr = new AddressParser().parse(address);
- if (viaAddr.viaSuffix == null) {
- return resolveSrv(address);
- }
-
- String[] resolvedSrv = resolveSrv(viaAddr.serverAddress);
- resolvedSrv[0] = resolvedSrv[0].replaceAll("\\.$", "") + "." + viaAddr.getSuffixWithOptions();
-
- return resolvedSrv;
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerPinger.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerPinger.java
deleted file mode 100644
index bff283df..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/address/client/MixinServerPinger.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.address.client;
-
-import com.viaversion.fabric.common.AddressParser;
-import net.minecraft.client.network.MultiplayerServerListPinger;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-@Mixin(MultiplayerServerListPinger.class)
-public class MixinServerPinger {
- @Redirect(method = "add", at = @At(value = "INVOKE",
- target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
- private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
- AddressParser viaAddr = new AddressParser().parse(address);
- if (viaAddr.viaSuffix == null) {
- return InetAddress.getByName(address);
- }
-
- InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
- return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnection.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnection.java
deleted file mode 100644
index 20d78c20..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnection.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.debug.client;
-
-import io.netty.channel.ChannelHandlerContext;
-import net.minecraft.network.ClientConnection;
-import org.apache.logging.log4j.Logger;
-import org.spongepowered.asm.mixin.Final;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(ClientConnection.class)
-public abstract class MixinClientConnection {
-
- @Shadow
- @Final
- private static Logger LOGGER;
-
- @Inject(method = "exceptionCaught", at = @At("TAIL"))
- public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) {
- LOGGER.error("Packet error", ex);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnectionAccessor.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnectionAccessor.java
deleted file mode 100644
index ee08a739..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinClientConnectionAccessor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.debug.client;
-
-import io.netty.channel.Channel;
-import net.minecraft.network.ClientConnection;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@Mixin(ClientConnection.class)
-public interface MixinClientConnectionAccessor {
- @Accessor
- Channel getChannel();
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinDebugHud.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinDebugHud.java
deleted file mode 100644
index ab6e3cca..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/debug/client/MixinDebugHud.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.debug.client;
-
-import com.viaversion.fabric.common.handler.CommonTransformer;
-import com.viaversion.fabric.common.handler.FabricDecodeHandler;
-import com.viaversion.viaversion.api.connection.ProtocolInfo;
-import com.viaversion.viaversion.api.connection.UserConnection;
-import io.netty.channel.ChannelHandler;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.hud.DebugHud;
-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.CallbackInfoReturnable;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-
-import java.util.List;
-
-@Mixin(DebugHud.class)
-public class MixinDebugHud {
- @Inject(at = @At("RETURN"), method = "getLeftText")
- protected void getLeftText(CallbackInfoReturnable> info) {
- String line = "[ViaFabric] I: " + Via.getManager().getConnectionManager().getConnections().size() + " (F: "
- + Via.getManager().getConnectionManager().getConnectedClients().size() + ")";
- ChannelHandler viaDecoder = ((MixinClientConnectionAccessor) MinecraftClient.getInstance().getNetworkHandler()
- .getClientConnection()).getChannel().pipeline().get(CommonTransformer.HANDLER_DECODER_NAME);
- if (viaDecoder instanceof FabricDecodeHandler) {
- UserConnection user = ((FabricDecodeHandler) viaDecoder).getInfo();
- ProtocolInfo protocol = user.getProtocolInfo();
- if (protocol != null) {
- ProtocolVersion serverVer = ProtocolVersion.getProtocol(protocol.getServerProtocolVersion());
- ProtocolVersion clientVer = ProtocolVersion.getProtocol(protocol.getProtocolVersion());
- line += " / C: " + clientVer + " S: " + serverVer + " A: " + user.isActive();
- }
- }
-
- info.getReturnValue().add(line);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/gui/client/MixinMultiplayerScreen.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/gui/client/MixinMultiplayerScreen.java
deleted file mode 100644
index 315e1019..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/gui/client/MixinMultiplayerScreen.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.gui.client;
-
-import com.viaversion.fabric.mc1122.ViaFabric;
-import com.viaversion.fabric.mc1122.gui.ViaButton;
-import com.viaversion.fabric.mc1122.gui.ViaConfigScreen;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.text.TranslatableText;
-import net.minecraft.util.Identifier;
-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;
-
-@Mixin(MultiplayerScreen.class)
-public abstract class MixinMultiplayerScreen extends Screen {
- protected MixinMultiplayerScreen(UnsupportedOperationException e) {
- super();
- throw e;
- }
-
- @Inject(method = "init", at = @At("TAIL"))
- private void onInit(CallbackInfo ci) {
- ButtonWidget enableClientSideViaVersion = new ViaButton("via".hashCode(), this.width / 2 + 113, 10,
- 40, 20, // Size
- 0, 0, // Start pos of texture
- 20, // v Hover offset
- new Identifier("viafabric:textures/gui/widgets.png"),
- 256, 256, // Texture size
- it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(this)),
- new TranslatableText("gui.via_button").asUnformattedString());
- if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false;
- this.buttons.add(enableClientSideViaVersion);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinClientConnection.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinClientConnection.java
deleted file mode 100644
index 69f98f8f..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinClientConnection.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.pipeline;
-
-import com.viaversion.fabric.common.handler.PipelineReorderEvent;
-import io.netty.channel.Channel;
-import net.minecraft.network.ClientConnection;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(ClientConnection.class)
-public class MixinClientConnection {
- @Shadow
- private Channel channel;
-
- @Inject(method = "setCompressionThreshold", at = @At("RETURN"))
- private void reorderCompression(int compressionThreshold, CallbackInfo ci) {
- channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinServerNetworkIoChInit.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinServerNetworkIoChInit.java
deleted file mode 100644
index f97539fe..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/MixinServerNetworkIoChInit.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.pipeline;
-
-import com.viaversion.fabric.common.handler.CommonTransformer;
-import com.viaversion.fabric.common.handler.FabricDecodeHandler;
-import com.viaversion.fabric.common.handler.FabricEncodeHandler;
-import com.viaversion.viaversion.connection.UserConnectionImpl;
-import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
-import io.netty.channel.Channel;
-import io.netty.channel.socket.SocketChannel;
-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 com.viaversion.viaversion.api.connection.UserConnection;
-
-@Mixin(targets = "net.minecraft.server.ServerNetworkIo$4")
-public class MixinServerNetworkIoChInit {
- @Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
- private void onInitChannel(Channel channel, CallbackInfo ci) {
- if (channel instanceof SocketChannel) {
- UserConnection user = new UserConnectionImpl(channel);
- new ProtocolPipelineImpl(user);
-
- channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
- channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
- }
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnection.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnection.java
deleted file mode 100644
index 1cd4c2f4..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.pipeline.client;
-
-import com.viaversion.fabric.mc1122.ViaFabric;
-import com.viaversion.fabric.mc1122.service.ProtocolAutoDetector;
-import net.minecraft.network.ClientConnection;
-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.CallbackInfoReturnable;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-
-@Mixin(ClientConnection.class)
-public class MixinClientConnection {
- @Inject(method = "connect", at = @At("HEAD"))
- private static void onConnect(InetAddress address, int port, boolean shouldUseNativeTransport, CallbackInfoReturnable cir) {
- try {
- if (!ViaFabric.config.isClientSideEnabled()) return;
- ProtocolAutoDetector.detectVersion(new InetSocketAddress(address, port)).get(10, TimeUnit.SECONDS);
- } catch (Exception e) {
- ViaFabric.JLOGGER.log(Level.WARNING, "Could not auto-detect protocol for " + address + " " + e);
- }
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnectionChInit.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnectionChInit.java
deleted file mode 100644
index d2583e2b..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinClientConnectionChInit.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.pipeline.client;
-
-import com.viaversion.fabric.common.handler.FabricDecodeHandler;
-import com.viaversion.fabric.common.handler.FabricEncodeHandler;
-import com.viaversion.fabric.common.handler.CommonTransformer;
-import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
-import com.viaversion.viaversion.connection.UserConnectionImpl;
-import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
-import io.netty.channel.Channel;
-import io.netty.channel.socket.SocketChannel;
-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 com.viaversion.viaversion.api.connection.UserConnection;
-
-@Mixin(targets = "net.minecraft.network.ClientConnection$5")
-public class MixinClientConnectionChInit {
- @Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
- private void onInitChannel(Channel channel, CallbackInfo ci) {
- if (channel instanceof SocketChannel) {
- UserConnection user = new UserConnectionImpl(channel, true);
- new ProtocolPipelineImpl(user).add(HostnameParserProtocol.INSTANCE);
-
- channel.pipeline()
- .addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user))
- .addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
- }
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinHandshakeC2SPacketAccessor.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinHandshakeC2SPacketAccessor.java
deleted file mode 100644
index 28ce8df8..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/pipeline/client/MixinHandshakeC2SPacketAccessor.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.viaversion.fabric.mc1122.mixin.pipeline.client;
-
-import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@Mixin(HandshakeC2SPacket.class)
-public interface MixinHandshakeC2SPacketAccessor {
- @Accessor
- void setProtocolVersion(int version);
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/shutdown/server/MixinMinecraftServer.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/shutdown/server/MixinMinecraftServer.java
deleted file mode 100644
index 3c2d944c..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/mixin/shutdown/server/MixinMinecraftServer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.mixin.shutdown.server;
-
-import com.viaversion.viaversion.ViaManagerImpl;
-import com.viaversion.viaversion.api.Via;
-import net.minecraft.server.MinecraftServer;
-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;
-
-@Mixin(MinecraftServer.class)
-public class MixinMinecraftServer {
- @Inject(method = "stopRunning", at = @At("TAIL"))
- private void onStopRunning(CallbackInfo ci) {
- ((ViaManagerImpl) Via.getManager()).destroy();
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricNativeVersionProvider.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricNativeVersionProvider.java
deleted file mode 100644
index 3b73c68d..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricNativeVersionProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.platform;
-
-import com.viaversion.fabric.common.platform.NativeVersionProvider;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.fabricmc.loader.api.FabricLoader;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.realms.RealmsSharedConstants;
-import net.minecraft.server.ServerMetadata;
-
-public class FabricNativeVersionProvider implements NativeVersionProvider {
- @Override
- public int getNativeServerVersion() {
- if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
- return getClientProtocol();
- }
-
- ServerMetadata.Version version = MinecraftClient.getInstance().getServer().getServerMetadata().getVersion();
- if (version == null) return ProtocolVersion.v1_12_2.getVersion();
- return version.getProtocolVersion();
- }
-
- @Environment(EnvType.CLIENT)
- private int getClientProtocol() {
- try {
- return RealmsSharedConstants.class.getField("NETWORK_PROTOCOL_VERSION").getInt(null);
- } catch (IllegalAccessException | NoSuchFieldException e) {
- e.printStackTrace();
- }
- return ProtocolVersion.v1_12_2.getVersion(); // fallback
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricPlatform.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricPlatform.java
deleted file mode 100644
index 018ef780..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/FabricPlatform.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.platform;
-
-import com.viaversion.fabric.common.commands.UserCommandSender;
-import com.viaversion.fabric.common.platform.NativeVersionProvider;
-import com.viaversion.fabric.common.provider.AbstractFabricPlatform;
-import com.viaversion.fabric.common.util.FutureTaskId;
-import com.viaversion.fabric.mc1122.ViaFabric;
-import com.viaversion.fabric.mc1122.commands.NMSCommandSender;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.command.ViaCommandSender;
-import com.viaversion.viaversion.util.ComponentUtil;
-import io.netty.channel.EventLoop;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.loader.api.FabricLoader;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.entity.player.ServerPlayerEntity;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.text.Text;
-
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
-import java.util.function.Supplier;
-import java.util.logging.Level;
-
-public class FabricPlatform extends AbstractFabricPlatform {
- public static MinecraftServer getServer() {
- // In 1.12.2 integrated server instance exists even if it's not running
- if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT
- && !MinecraftClient.getInstance().isIntegratedServerRunning()) return null;
- return MinecraftClient.getInstance().getServer();
- }
-
- @Override
- protected void installNativeVersionProvider() {
- Via.getManager().getProviders().use(NativeVersionProvider.class, new FabricNativeVersionProvider());
- }
-
- @Override
- protected ExecutorService asyncService() {
- return ViaFabric.ASYNC_EXECUTOR;
- }
-
- @Override
- protected EventLoop eventLoop() {
- return ViaFabric.EVENT_LOOP;
- }
-
- @Override
- public FutureTaskId runAsync(Runnable runnable) {
- return new FutureTaskId(CompletableFuture
- .runAsync(runnable, ViaFabric.ASYNC_EXECUTOR)
- .exceptionally(throwable -> {
- if (!(throwable instanceof CancellationException)) {
- throwable.printStackTrace();
- }
- return null;
- })
- );
- }
-
- @Override
- public FutureTaskId runSync(Runnable runnable) {
- if (getServer() != null) {
- return runServerSync(runnable);
- } else {
- return runEventLoop(runnable);
- }
- }
-
- private FutureTaskId runServerSync(Runnable runnable) {
- // Kick task needs to be on main thread, it does already have error logger
- return new FutureTaskId(CompletableFuture.runAsync(runnable, it -> getServer().method_10815((Callable) () -> {
- it.run();
- return null;
- })));
- }
-
- @Override
- public ViaCommandSender[] getOnlinePlayers() {
- MinecraftServer server = getServer();
- if (server != null && server.isOnThread()) {
- return getServerPlayers();
- }
- return Via.getManager().getConnectionManager().getConnectedClients().values().stream()
- .map(UserCommandSender::new)
- .toArray(ViaCommandSender[]::new);
- }
-
- private ViaCommandSender[] getServerPlayers() {
- return getServer().getPlayerManager().getPlayers().stream()
- .map(NMSCommandSender::new)
- .toArray(ViaCommandSender[]::new);
- }
-
- @Override
- public void sendMessage(UUID uuid, String s) {
- sendMessageServer(uuid, s);
- }
-
- private void sendMessageServer(UUID uuid, String s) {
- MinecraftServer server = getServer();
- if (server == null) return;
- runServerSync(() -> {
- ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
- if (player == null) return;
- player.sendMessage(Text.Serializer.deserializeText(ComponentUtil.legacyToJsonString(s)));
- });
- }
-
- @Override
- public boolean kickPlayer(UUID uuid, String s) {
- return kickServer(uuid, s);
- }
-
- private boolean kickServer(UUID uuid, String s) {
- MinecraftServer server = getServer();
- if (server == null) return false;
- Supplier kickTask = () -> {
- ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
- if (player == null) return false;
- player.networkHandler.method_14977(Text.Serializer.deserializeText(s));
- return true;
- };
- if (server.isOnThread()) {
- return kickTask.get();
- } else {
- ViaFabric.JLOGGER.log(Level.WARNING, "Weird!? Player kicking was called off-thread", new Throwable());
- runServerSync(kickTask::get);
- }
- return false; // Can't know if it worked
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/VFLoader.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/VFLoader.java
deleted file mode 100644
index 6061f70a..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/platform/VFLoader.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.platform;
-
-import com.viaversion.fabric.mc1122.providers.VFHandItemProvider;
-import com.viaversion.fabric.mc1122.providers.FabricVersionProvider;
-import com.viaversion.viaversion.protocols.v1_8to1_9.provider.HandItemProvider;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.loader.api.FabricLoader;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
-import com.viaversion.viaversion.api.protocol.version.VersionProvider;
-
-public class VFLoader implements ViaPlatformLoader {
- @Override
- public void load() {
- Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
-
- if (Via.getPlatform().getConf().isItemCache()) {
- VFHandItemProvider handProvider = new VFHandItemProvider();
- if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
- handProvider.registerClientTick();
- }
- handProvider.registerServerTick();
- Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
- }
- }
-
- @Override
- public void unload() {
- // Nothing to do
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/FabricVersionProvider.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/FabricVersionProvider.java
deleted file mode 100644
index 71e66614..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/FabricVersionProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.providers;
-
-import com.viaversion.fabric.common.config.VFConfig;
-import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
-import com.viaversion.fabric.mc1122.ViaFabric;
-import com.viaversion.fabric.mc1122.service.ProtocolAutoDetector;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-
-import java.net.InetSocketAddress;
-import java.util.concurrent.CompletableFuture;
-import java.util.logging.Logger;
-
-public class FabricVersionProvider extends AbstractFabricVersionProvider {
- @Override
- protected Logger getLogger() {
- return ViaFabric.JLOGGER;
- }
-
- @Override
- protected VFConfig getConfig() {
- return ViaFabric.config;
- }
-
- @Override
- protected CompletableFuture detectVersion(InetSocketAddress address) {
- return ProtocolAutoDetector.detectVersion(address);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/VFHandItemProvider.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/VFHandItemProvider.java
deleted file mode 100644
index fbded5a8..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/providers/VFHandItemProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.providers;
-
-import com.viaversion.fabric.mc1122.ViaFabric;
-import com.viaversion.viaversion.api.connection.UserConnection;
-import com.viaversion.viaversion.api.minecraft.item.DataItem;
-import com.viaversion.viaversion.api.minecraft.item.Item;
-import com.viaversion.viaversion.protocols.v1_8to1_9.provider.HandItemProvider;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
-import net.legacyfabric.fabric.api.event.lifecycle.v1.ServerTickEvents;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.entity.player.ClientPlayerEntity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.server.MinecraftServer;
-
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class VFHandItemProvider extends HandItemProvider {
- public final Map serverPlayers = new ConcurrentHashMap<>();
- public Item clientItem = null;
-
- @Override
- public Item getHandItem(UserConnection info) {
- Item serverItem;
- if (info.isClientSide()) {
- return getClientItem();
- } else if ((serverItem = serverPlayers.get(info.getProtocolInfo().getUuid())) != null) {
- return serverItem.copy();
- }
- return super.getHandItem(info);
- }
-
- private Item getClientItem() {
- if (clientItem == null) {
- return new DataItem(0, (byte) 0, null);
- }
- return clientItem.copy();
- }
-
- @Environment(EnvType.CLIENT)
- public void registerClientTick() {
- try {
- ClientTickEvents.END_WORLD_TICK.register(world -> tickClient());
- } catch (NoClassDefFoundError ignored1) {
- ViaFabric.JLOGGER.info("Fabric Lifecycle V1 isn't installed");
- }
- }
-
- public void registerServerTick() {
- try {
- ServerTickEvents.END_SERVER_TICK.register(this::tickServer);
- } catch (NoClassDefFoundError ignored1) {
- ViaFabric.JLOGGER.info("Fabric Lifecycle V1 isn't installed");
- }
- }
-
- private void tickClient() {
- ClientPlayerEntity p = MinecraftClient.getInstance().player;
- if (p != null) {
- clientItem = fromNative(p.inventory.getMainHandStack());
- }
- }
-
- private void tickServer(MinecraftServer server) {
- serverPlayers.clear();
- server.getPlayerManager().getPlayers().forEach(it -> serverPlayers
- .put(it.getUuid(), fromNative(it.inventory.getMainHandStack())));
- }
-
- private Item fromNative(ItemStack original) {
- if (original == null) return new DataItem(0, (byte) 0, (short) 0, null);
- int id = net.minecraft.item.Item.getRawId(original.getItem());
- return new DataItem(id, (byte) original.getCount(), (short) original.getDamage(), null);
- }
-}
diff --git a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/service/ProtocolAutoDetector.java b/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/service/ProtocolAutoDetector.java
deleted file mode 100644
index cf4fe09e..00000000
--- a/viafabric-mc1122/src/main/java/com/viaversion/fabric/mc1122/service/ProtocolAutoDetector.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc1122.service;
-
-import com.viaversion.fabric.mc1122.ViaFabric;
-import com.viaversion.fabric.common.AddressParser;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.viaversion.fabric.mc1122.mixin.pipeline.client.MixinHandshakeC2SPacketAccessor;
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.*;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.timeout.ReadTimeoutHandler;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.network.*;
-import net.minecraft.network.listener.ClientQueryPacketListener;
-import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
-import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
-import net.minecraft.network.packet.s2c.query.QueryPongS2CPacket;
-import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
-import net.minecraft.realms.RealmsSharedConstants;
-import net.minecraft.server.ServerMetadata;
-import net.minecraft.text.LiteralText;
-import net.minecraft.text.Text;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import com.viaversion.viaversion.api.Via;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-
-@Environment(EnvType.CLIENT)
-public class ProtocolAutoDetector {
- private static final LoadingCache> SERVER_VER = CacheBuilder.newBuilder()
- .expireAfterWrite(30, TimeUnit.SECONDS)
- .build(CacheLoader.from((address) -> {
- CompletableFuture future = new CompletableFuture<>();
-
- try {
- final ClientConnection clientConnection = new ClientConnection(NetworkSide.CLIENTBOUND);
-
- ChannelFuture ch = new Bootstrap()
- .group(ClientConnection.field_11553.get())
- .channel(NioSocketChannel.class)
- .handler(new ChannelInitializer() {
- protected void initChannel(Channel channel) {
- try {
- channel.config().setOption(ChannelOption.TCP_NODELAY, true);
- channel.config().setOption(ChannelOption.IP_TOS, 0x18); // Stolen from Velocity, low delay, high reliability
- } catch (ChannelException ignored) {
- }
-
- channel.pipeline()
- .addLast("timeout", new ReadTimeoutHandler(30))
- .addLast("splitter", new SplitterHandler())
- .addLast("decoder", new DecoderHandler(NetworkSide.CLIENTBOUND))
- .addLast("prepender", new SizePrepender())
- .addLast("encoder", new PacketEncoder(NetworkSide.SERVERBOUND))
- .addLast("packet_handler", clientConnection);
- }
- })
- .connect(address);
-
- ch.addListener(future1 -> {
- if (!future1.isSuccess()) {
- future.completeExceptionally(future1.cause());
- } else {
- ch.channel().eventLoop().execute(() -> { // needs to execute after channel init
- clientConnection.setPacketListener(new ClientQueryPacketListener() {
- @Override
- public void onResponse(QueryResponseS2CPacket packet) {
- ServerMetadata meta = packet.getServerMetadata();
- ServerMetadata.Version version;
- if (meta != null && (version = meta.getVersion()) != null) {
- ProtocolVersion ver = ProtocolVersion.getProtocol(version.getProtocolVersion());
- future.complete(ver);
- ViaFabric.JLOGGER.info("Auto-detected " + ver + " for " + address);
- } else {
- future.completeExceptionally(new IllegalArgumentException("Null version in query response"));
- }
- clientConnection.disconnect(new LiteralText(""));
- }
-
- @Override
- public void onPong(QueryPongS2CPacket packet) {
- clientConnection.disconnect(new LiteralText("Pong not requested!"));
- }
-
- @Override
- public void onDisconnected(Text reason) {
- future.completeExceptionally(new IllegalStateException(reason.asUnformattedString()));
- }
- });
-
- HandshakeC2SPacket handshakeC2SPacket = new HandshakeC2SPacket(address.getHostString(),
- address.getPort(), NetworkState.STATUS);
- ((MixinHandshakeC2SPacketAccessor) handshakeC2SPacket).setProtocolVersion(
- RealmsSharedConstants.NETWORK_PROTOCOL_VERSION);
- clientConnection.send(handshakeC2SPacket);
- clientConnection.send(new QueryRequestC2SPacket());
- });
- }
- });
- } catch (Throwable throwable) {
- future.completeExceptionally(throwable);
- }
-
- return future;
- }));
-
- public static CompletableFuture detectVersion(InetSocketAddress address) {
- try {
- InetSocketAddress real = new InetSocketAddress(InetAddress.getByAddress
- (new AddressParser().parse(address.getHostString()).serverAddress,
- address.getAddress().getAddress()), address.getPort());
- return SERVER_VER.get(real);
- } catch (UnknownHostException | ExecutionException e) {
- ViaFabric.JLOGGER.log(Level.WARNING, "Protocol auto detector error: ", e);
- return CompletableFuture.completedFuture(null);
- }
- }
-}
diff --git a/viafabric-mc1122/src/main/resources/fabric.mod.json b/viafabric-mc1122/src/main/resources/fabric.mod.json
deleted file mode 100644
index 87108419..00000000
--- a/viafabric-mc1122/src/main/resources/fabric.mod.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "schemaVersion": 1,
- "id": "viafabric-mc1122",
- "name": "ViaFabric for 1.12",
- "version": "${version}",
- "description": "${description}",
- "license": "GPL-3.0",
- "contact": {
- "homepage": "https://viaversion.com/fabric",
- "issues": "https://github.com/ViaVersion/ViaFabric/issues",
- "sources": "https://github.com/ViaVersion/ViaFabric"
- },
- "environment": "*",
- "authors": [
- {
- "name": "creeper123123321",
- "contact": {
- "homepage": "https://creeper123123321.github.io/"
- }
- },
- {
- "name": "FlorianMichael/EnZaXD",
- "contact": {
- "homepage": "https://github.com/FlorianMichael"
- }
- },
- {
- "name": "kennytv",
- "contact": {
- "homepage": "https://kennytv.eu"
- }
- },
- {
- "name": "Kichura",
- "contact": {
- "homepage": "https://github.com/Kichura"
- }
- }
- ],
- "entrypoints": {
- "main": [
- "com.viaversion.fabric.mc1122.ViaFabric"
- ]
- },
- "depends": {
- "legacy-fabric-resource-loader-v1": "*",
- "minecraft": "1.12.2",
- "viafabric": "*"
- },
- "recommends": {
- "legacy-fabric-command-api-v1": "*"
- },
- "mixins": [
- "mixins.viafabric1122.address.json",
- "mixins.viafabric1122.gui.json",
- "mixins.viafabric1122.debug.json",
- "mixins.viafabric1122.pipeline.json",
- "mixins.viafabric1122.shutdown.json"
- ]
-}
diff --git a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.address.json b/viafabric-mc1122/src/main/resources/mixins.viafabric1122.address.json
deleted file mode 100644
index 77b53e95..00000000
--- a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.address.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc1122.mixin.address",
- "mixins": [
- ],
- "client": [
- "client.MixinConnectScreenThread",
- "client.MixinServerAddress",
- "client.MixinServerPinger"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}
diff --git a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.debug.json b/viafabric-mc1122/src/main/resources/mixins.viafabric1122.debug.json
deleted file mode 100644
index bfa50334..00000000
--- a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.debug.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc1122.mixin.debug",
- "mixins": [
- ],
- "client": [
- "client.MixinClientConnectionAccessor",
- "client.MixinDebugHud",
- "client.MixinClientConnection"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}
diff --git a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.gui.json b/viafabric-mc1122/src/main/resources/mixins.viafabric1122.gui.json
deleted file mode 100644
index e6f53bd3..00000000
--- a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.gui.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc1122.mixin.gui",
- "mixins": [
- ],
- "client": [
- "client.MixinMultiplayerScreen"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}
diff --git a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.pipeline.json b/viafabric-mc1122/src/main/resources/mixins.viafabric1122.pipeline.json
deleted file mode 100644
index 4ec32463..00000000
--- a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.pipeline.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc1122.mixin.pipeline",
- "mixins": [
- "MixinClientConnection",
- "MixinServerNetworkIoChInit"
- ],
- "client": [
- "client.MixinClientConnection",
- "client.MixinClientConnectionChInit",
- "client.MixinHandshakeC2SPacketAccessor"
- ],
- "injectors": {
- "defaultRequire": 1
- }
-}
diff --git a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.shutdown.json b/viafabric-mc1122/src/main/resources/mixins.viafabric1122.shutdown.json
deleted file mode 100644
index e474d715..00000000
--- a/viafabric-mc1122/src/main/resources/mixins.viafabric1122.shutdown.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc1122.mixin.shutdown",
- "mixins": [
- ],
- "server": [
- "server.MixinMinecraftServer"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}
diff --git a/viafabric-mc189/build.gradle.kts b/viafabric-mc189/build.gradle.kts
deleted file mode 100644
index e7893e67..00000000
--- a/viafabric-mc189/build.gradle.kts
+++ /dev/null
@@ -1,17 +0,0 @@
-dependencies {
- minecraft("com.mojang:minecraft:1.8.9")
- mappings("net.legacyfabric:yarn:1.8.9+build.541:v2")
-
- modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:1.9.4+1.8.9")
- modImplementation("io.github.boogiemonster1o1:rewoven-modmenu:1.0.0+1.8.9") {
- isTransitive = false
- }
-
- // fix newer java
- @Suppress("GradlePackageUpdate", "RedundantSuppression")
- implementation("io.netty:netty-all:4.0.56.Final")
-}
-
-loom {
- intermediaryUrl.set("https://maven.legacyfabric.net/net/legacyfabric/intermediary/%1\$s/intermediary-%1\$s-v2.jar")
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/ViaFabric.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/ViaFabric.java
deleted file mode 100644
index ccb95973..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/ViaFabric.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189;
-
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.viaversion.fabric.common.config.VFConfig;
-import com.viaversion.fabric.common.platform.FabricInjector;
-import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
-import com.viaversion.fabric.common.util.JLoggerToLog4j;
-import com.viaversion.fabric.mc189.commands.NMSCommandImpl;
-import com.viaversion.fabric.mc189.commands.VFCommandHandler;
-import com.viaversion.fabric.mc189.platform.FabricPlatform;
-import com.viaversion.fabric.mc189.platform.VFLoader;
-import com.viaversion.viaversion.ViaManagerImpl;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import io.netty.channel.EventLoop;
-import io.netty.channel.local.LocalEventLoopGroup;
-import net.fabricmc.api.ModInitializer;
-import net.fabricmc.loader.api.FabricLoader;
-import net.legacyfabric.fabric.api.registry.CommandRegistry;
-import org.apache.logging.log4j.LogManager;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.logging.Logger;
-
-public class ViaFabric implements ModInitializer {
- public static final Logger JLOGGER = new JLoggerToLog4j(LogManager.getLogger("ViaFabric"));
- public static final ExecutorService ASYNC_EXECUTOR;
- public static final EventLoop EVENT_LOOP;
- public static final CompletableFuture INIT_FUTURE = new CompletableFuture<>();
- public static VFConfig config;
-
- static {
- ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ViaFabric-%d").build();
- ASYNC_EXECUTOR = Executors.newFixedThreadPool(8, factory);
- EVENT_LOOP = new LocalEventLoopGroup(1, factory).next(); // ugly code
- EVENT_LOOP.submit(INIT_FUTURE::join); // https://github.com/ViaVersion/ViaFabric/issues/53 ugly workaround code but works tm
- }
-
- @Override
- public void onInitialize() {
- FabricPlatform platform = new FabricPlatform();
-
- Via.init(ViaManagerImpl.builder()
- .injector(new FabricInjector())
- .loader(new VFLoader())
- .commandHandler(new VFCommandHandler())
- .platform(platform).build());
-
- platform.init();
-
- ViaManagerImpl manager = (ViaManagerImpl) Via.getManager();
- manager.init();
-
- HostnameParserProtocol.INSTANCE.initialize();
- HostnameParserProtocol.INSTANCE.register(Via.getManager().getProviders());
- ProtocolVersion.register(-2, "AUTO");
-
- FabricLoader.getInstance().getEntrypoints("viafabric:via_api_initialized", Runnable.class).forEach(Runnable::run);
-
- registerCommandsV1();
-
- config = new VFConfig(FabricLoader.getInstance().getConfigDir().resolve("ViaFabric")
- .resolve("viafabric.yml").toFile(), JLOGGER);
-
- manager.onServerLoaded();
-
- INIT_FUTURE.complete(null);
- }
-
- private void registerCommandsV1() {
- try {
- CommandRegistry.INSTANCE.register(new NMSCommandImpl(Via.getManager().getCommandHandler()));
- } catch (NoClassDefFoundError ignored2) {
- JLOGGER.info("Couldn't register command as Fabric Commands isn't installed");
- }
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandImpl.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandImpl.java
deleted file mode 100644
index f41e7ef3..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.commands;
-
-import net.minecraft.command.AbstractCommand;
-import net.minecraft.command.CommandSource;
-import net.minecraft.util.math.BlockPos;
-import com.viaversion.viaversion.api.command.ViaVersionCommand;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class NMSCommandImpl extends AbstractCommand {
- private final ViaVersionCommand handler;
-
- public NMSCommandImpl(ViaVersionCommand handler) {
- this.handler = handler;
- }
-
- @Override
- public String getCommandName() {
- return "viaversion";
- }
-
- @Override
- public List getAliases() {
- return Arrays.asList("vvfabric", "viaver");
- }
-
- @Override
- public String getUsageTranslationKey(CommandSource commandSource) {
- return "/viaversion [help|subcommand]";
- }
-
- @Override
- public void execute(CommandSource commandSource, String[] strings) {
- handler.onCommand(new NMSCommandSender(commandSource), strings);
- }
-
- @Override
- public List getAutoCompleteHints(CommandSource commandSource, String[] strings, BlockPos blockPos) {
- return handler.onTabComplete(new NMSCommandSender(commandSource), strings);
- }
-
- @Override
- public int getPermissionLevel() {
- return 3;
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandSender.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandSender.java
deleted file mode 100644
index d46513f8..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/NMSCommandSender.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.commands;
-
-import com.viaversion.viaversion.api.command.ViaCommandSender;
-import com.viaversion.viaversion.util.ComponentUtil;
-import net.minecraft.command.CommandSource;
-import net.minecraft.entity.Entity;
-import net.minecraft.text.Text;
-
-import java.nio.charset.StandardCharsets;
-import java.util.UUID;
-
-public class NMSCommandSender implements ViaCommandSender {
- private final CommandSource source;
-
- public NMSCommandSender(CommandSource source) {
- this.source = source;
- }
-
- @Override
- public boolean hasPermission(String s) {
- // https://gaming.stackexchange.com/questions/138602/what-does-op-permission-level-do
- return source.canUseCommand(3, "viaversion.admin"); // the string seems to be the command
- }
-
- @Override
- public void sendMessage(String s) {
- source.sendMessage(Text.Serializer.deserialize(ComponentUtil.legacyToJsonString(s)));
- }
-
- @Override
- public UUID getUUID() {
- if (source instanceof Entity) {
- return ((Entity) source).getUuid();
- }
- return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8));
- }
-
- @Override
- public String getName() {
- if (source instanceof Entity) {
- return source.getName().asUnformattedString();
- }
- return "?";
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/VFCommandHandler.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/VFCommandHandler.java
deleted file mode 100644
index a98923df..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/commands/VFCommandHandler.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.commands;
-
-import com.viaversion.fabric.common.commands.subs.LeakDetectSubCommand;
-import com.viaversion.viaversion.commands.ViaCommandHandler;
-
-public class VFCommandHandler extends ViaCommandHandler {
- {
- try {
- registerSubCommand(new LeakDetectSubCommand());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ChangedListener.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ChangedListener.java
deleted file mode 100644
index be9827ee..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ChangedListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.gui;
-
-import net.minecraft.client.gui.widget.PagedEntryListWidget;
-
-import java.util.function.Consumer;
-
-public class ChangedListener implements PagedEntryListWidget.Listener {
- private final Consumer consumer;
-
- public ChangedListener(Consumer consumer) {
- this.consumer = consumer;
- }
-
- @Override
- public void setBooleanValue(int id, boolean value) {
- }
-
- @Override
- public void setFloatValue(int id, float value) {
- }
-
- @Override
- public void setStringValue(int id, String text) {
- consumer.accept(text);
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ListeneableButton.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ListeneableButton.java
deleted file mode 100644
index 8bcac8b4..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ListeneableButton.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.gui;
-
-import net.minecraft.client.gui.widget.ButtonWidget;
-
-import java.util.function.Consumer;
-
-public class ListeneableButton extends ButtonWidget {
- private final Consumer click;
-
- public ListeneableButton(int id, int x, int y, int width, int height, String message, Consumer click) {
- super(id, x, y, width, height, message);
- this.click = click;
- }
-
- @Override
- public void mouseReleased(int mouseX, int mouseY) {
- super.mouseReleased(mouseX, mouseY);
- click.accept(this);
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ModMenuConfig.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ModMenuConfig.java
deleted file mode 100644
index b01669f8..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ModMenuConfig.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.gui;
-
-import io.github.prospector.modmenu.api.ModMenuApi;
-import net.minecraft.client.gui.screen.Screen;
-
-import java.util.function.Function;
-
-public class ModMenuConfig implements ModMenuApi {
- @Override
- public String getModId() {
- return "viafabric";
- }
-
- @Override
- public Function getConfigScreenFactory() {
- return ViaConfigScreen::new;
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaButton.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaButton.java
deleted file mode 100644
index 9928895b..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaButton.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.gui;
-
-import com.mojang.blaze3d.platform.GlStateManager;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.sound.SoundManager;
-import net.minecraft.util.Identifier;
-
-import java.util.function.Consumer;
-
-public class ViaButton extends ButtonWidget {
- // Meant to be similar to higher versions TexturedButtonWidget
- private final int startU;
- private final int startV;
- private final int offsetHoverV;
- private final Identifier texturePath;
- private final Consumer onClick;
-
- public ViaButton(int id, int x, int y, int width, int height, int startU, int startV, int offsetHoverV, Identifier texturePath,
- int textureSizeX, int textureSizeY, Consumer onClick, String altTxt) {
- super(id, x, y, width, height, altTxt);
- this.startU = startU;
- this.startV = startV;
- this.offsetHoverV = offsetHoverV;
- this.texturePath = texturePath;
- assert textureSizeX == 256;
- assert textureSizeY == 256;
- this.onClick = onClick;
- }
-
- public void render(MinecraftClient client, int mouseX, int mouseY) {
- // Modified copy-paste from LockButtonWidget
- if (this.visible) {
- client.getTextureManager().bindTexture(texturePath);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- boolean hover = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
- int v = startV;
- if (hover) {
- v += offsetHoverV;
- }
- this.drawTexture(this.x, this.y, startU, v, this.width, this.height);
- }
- }
-
- @Override
- public void playDownSound(SoundManager soundManager) {
- super.playDownSound(soundManager);
- onClick.accept(this);
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaConfigScreen.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaConfigScreen.java
deleted file mode 100644
index 18ae0288..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/gui/ViaConfigScreen.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.gui;
-
-import com.viaversion.fabric.common.config.AbstractViaConfigScreen;
-import com.viaversion.fabric.mc189.ViaFabric;
-import com.viaversion.fabric.common.util.ProtocolUtils;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.ConfirmScreen;
-import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.gui.widget.TextFieldWidget;
-import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
-
-import java.util.concurrent.CompletableFuture;
-
-@Environment(EnvType.CLIENT)
-public class ViaConfigScreen extends Screen implements AbstractViaConfigScreen {
- private static CompletableFuture latestProtocolSave;
- private final Screen parent;
- private TextFieldWidget protocolVersion;
- private final Text title;
-
- public ViaConfigScreen(Screen parent) {
- super();
- title = new TranslatableText(TITLE_TRANSLATE_ID);
- this.parent = parent;
- }
-
- @Override
- public void init() {
- int entries = 0;
-
- this.buttons.add(new ListeneableButton("clientside".hashCode(), calculatePosX(this.width, entries),
- calculatePosY(this.height, entries),
- 150,
- 20, getClientSideText().asUnformattedString(), this::onClickClientSide));
- entries++;
-
- this.buttons.add(new ListeneableButton("hidevia".hashCode(), calculatePosX(this.width, entries),
- calculatePosY(this.height, entries),
- 150,
- 20, getHideViaButtonText().asUnformattedString(), this::onHideViaButton));
- entries++;
-
- protocolVersion = new TextFieldWidget("protover".hashCode(), textRenderer,
- calculatePosX(this.width, entries),
- calculatePosY(this.height, entries),
- 150,
- 20);
- protocolVersion.setText(new TranslatableText(VERSION_TRANSLATE_ID).asUnformattedString());
- entries++;
-
- protocolVersion.setTextPredicate(ProtocolUtils::isStartOfProtocolText);
- protocolVersion.setListener(new ChangedListener(this::onChangeVersionField));
- int clientSideVersion = ViaFabric.config.getClientSideVersion();
- protocolVersion.setText(ProtocolUtils.getProtocolName(clientSideVersion));
- onChangeVersionField(protocolVersion.getText());
-
- //this.children.add(protocolVersion);
-
- buttons.add(new ListeneableButton("done".hashCode(), this.width / 2 - 100, this.height - 40, 200, 20, new TranslatableText("gui.done").asUnformattedString(),
- (buttonWidget) -> MinecraftClient.getInstance().setScreen(this.parent)));
- }
-
- private void onChangeVersionField(String text) {
- //protocolVersion.setSuggestion(null);
- int newVersion = ViaFabric.config.getClientSideVersion();
-
- Integer parsed = ProtocolUtils.parseProtocolId(text);
- boolean validProtocol;
-
- if (parsed != null) {
- newVersion = parsed;
- validProtocol = true;
- } else {
- validProtocol = false;
- }
-
- protocolVersion.setEditableColor(getProtocolTextColor(ProtocolVersion.getProtocol(newVersion), validProtocol));
-
- int finalNewVersion = newVersion;
- if (latestProtocolSave == null) latestProtocolSave = CompletableFuture.completedFuture(null);
- ViaFabric.config.setClientSideVersion(finalNewVersion);
- latestProtocolSave = latestProtocolSave.thenRunAsync(ViaFabric.config::save, ViaFabric.ASYNC_EXECUTOR);
- }
-
- private void onClickClientSide(ButtonWidget widget) {
- if (!ViaFabric.config.isClientSideEnabled()) {
- MinecraftClient.getInstance().setScreen(new ConfirmScreen(
- (answer, id) -> {
- if (answer) {
- ViaFabric.config.setClientSideEnabled(true);
- ViaFabric.config.setClientSideVersion(-2); // AUTO
- ViaFabric.config.save();
- widget.message = getClientSideText().asUnformattedString();
- }
- MinecraftClient.getInstance().setScreen(this);
- },
- new TranslatableText("gui.enable_client_side.question").asUnformattedString(),
- new TranslatableText("gui.enable_client_side.warning").asUnformattedString(),
- new TranslatableText("gui.enable_client_side.enable").asUnformattedString(),
- new TranslatableText("gui.cancel").asUnformattedString(),
- "via anticheat consent".hashCode()
- ));
- } else {
- ViaFabric.config.setClientSideEnabled(false);
- ViaFabric.config.save();
- }
- widget.message = getClientSideText().asUnformattedString();
- }
-
- @Override
- public void removed() {
- ViaFabric.config.save();
- }
-
- private TranslatableText getClientSideText() {
- return ViaFabric.config.isClientSideEnabled() ?
- new TranslatableText("gui.client_side.disable")
- : new TranslatableText("gui.client_side.enable");
- }
-
- private TranslatableText getHideViaButtonText() {
- return ViaFabric.config.isHideButton() ?
- new TranslatableText("gui.hide_via_button.disable") : new TranslatableText("gui.hide_via_button.enable");
- }
-
- private void onHideViaButton(ButtonWidget widget) {
- ViaFabric.config.setHideButton(!ViaFabric.config.isHideButton());
- ViaFabric.config.save();
- widget.message = getHideViaButtonText().asUnformattedString();
- }
-
- @Override
- public void render(int mouseX, int mouseY, float delta) {
- this.renderBackground();
- drawCenteredString(this.textRenderer, this.title.asUnformattedString(), this.width / 2, 20, 16777215);
- super.render(mouseX, mouseY, delta);
- protocolVersion.render();
- }
-
- @Override
- public void tick() {
- super.tick();
- protocolVersion.tick();
- }
-
- @Override
- protected void keyPressed(char character, int code) {
- super.keyPressed(character, code);
- protocolVersion.keyPressed(character, code);
- }
-
- @Override
- protected void mouseClicked(int mouseX, int mouseY, int button) {
- super.mouseClicked(mouseX, mouseY, button);
- protocolVersion.mouseClicked(mouseX, mouseY, button);
- }
-}
-
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinConnectScreenThread.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinConnectScreenThread.java
deleted file mode 100644
index cf6916ce..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinConnectScreenThread.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.address.client;
-
-import com.viaversion.fabric.common.AddressParser;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-@Mixin(targets = "net.minecraft.client.gui.screen.ConnectScreen$1")
-public class MixinConnectScreenThread {
- @Redirect(method = "run()V", at = @At(value = "INVOKE",
- target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
- private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
- AddressParser viaAddr = new AddressParser().parse(address);
- if (viaAddr.viaSuffix == null) {
- return InetAddress.getByName(address);
- }
-
- InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
- return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
- }
-}
\ No newline at end of file
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerAddress.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerAddress.java
deleted file mode 100644
index 2cd6a278..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerAddress.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.address.client;
-
-import com.viaversion.fabric.common.AddressParser;
-import net.minecraft.network.ServerAddress;
-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;
-
-@Mixin(ServerAddress.class)
-public abstract class MixinServerAddress {
- @Shadow
- private static String[] resolveSrv(String address) {
- throw new AssertionError();
- }
-
- @Redirect(method = "parse", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ServerAddress;resolveSrv(Ljava/lang/String;)[Ljava/lang/String;"))
- private static String[] modifySrvAddr(String address) {
- AddressParser viaAddr = new AddressParser().parse(address);
- if (viaAddr.viaSuffix == null) {
- return resolveSrv(address);
- }
-
- String[] resolvedSrv = resolveSrv(viaAddr.serverAddress);
- resolvedSrv[0] = resolvedSrv[0].replaceAll("\\.$", "") + "." + viaAddr.getSuffixWithOptions();
-
- return resolvedSrv;
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerPinger.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerPinger.java
deleted file mode 100644
index 6a13b536..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/address/client/MixinServerPinger.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.address.client;
-
-import com.viaversion.fabric.common.AddressParser;
-import net.minecraft.client.network.MultiplayerServerListPinger;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Redirect;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-@Mixin(MultiplayerServerListPinger.class)
-public class MixinServerPinger {
- @Redirect(method = "add", at = @At(value = "INVOKE",
- target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
- private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
- AddressParser viaAddr = new AddressParser().parse(address);
- if (viaAddr.viaSuffix == null) {
- return InetAddress.getByName(address);
- }
-
- InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
- return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnection.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnection.java
deleted file mode 100644
index 6f6f5400..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnection.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.debug.client;
-
-import io.netty.channel.ChannelHandlerContext;
-import net.minecraft.network.ClientConnection;
-import org.apache.logging.log4j.Logger;
-import org.spongepowered.asm.mixin.Final;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(ClientConnection.class)
-public abstract class MixinClientConnection {
-
- @Shadow
- @Final
- private static Logger LOGGER;
-
- @Inject(method = "exceptionCaught", at = @At("TAIL"))
- public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) {
- LOGGER.error("Packet error", ex);
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnectionAccessor.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnectionAccessor.java
deleted file mode 100644
index 1fbc1614..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinClientConnectionAccessor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.debug.client;
-
-import io.netty.channel.Channel;
-import net.minecraft.network.ClientConnection;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@Mixin(ClientConnection.class)
-public interface MixinClientConnectionAccessor {
- @Accessor
- Channel getChannel();
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinDebugHud.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinDebugHud.java
deleted file mode 100644
index ea3473fe..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/debug/client/MixinDebugHud.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.debug.client;
-
-import com.viaversion.fabric.common.handler.CommonTransformer;
-import com.viaversion.fabric.common.handler.FabricDecodeHandler;
-import com.viaversion.viaversion.api.connection.ProtocolInfo;
-import com.viaversion.viaversion.api.connection.UserConnection;
-import io.netty.channel.ChannelHandler;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.hud.DebugHud;
-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.CallbackInfoReturnable;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-
-import java.util.List;
-
-@Mixin(DebugHud.class)
-public class MixinDebugHud {
- @Inject(at = @At("RETURN"), method = "getLeftText")
- protected void getLeftText(CallbackInfoReturnable> info) {
- String line = "[ViaFabric] I: " + Via.getManager().getConnectionManager().getConnections().size() + " (F: "
- + Via.getManager().getConnectionManager().getConnectedClients().size() + ")";
- ChannelHandler viaDecoder = ((MixinClientConnectionAccessor) MinecraftClient.getInstance().getNetworkHandler()
- .getClientConnection()).getChannel().pipeline().get(CommonTransformer.HANDLER_DECODER_NAME);
- if (viaDecoder instanceof FabricDecodeHandler) {
- UserConnection user = ((FabricDecodeHandler) viaDecoder).getInfo();
- ProtocolInfo protocol = user.getProtocolInfo();
- if (protocol != null) {
- ProtocolVersion serverVer = ProtocolVersion.getProtocol(protocol.getServerProtocolVersion());
- ProtocolVersion clientVer = ProtocolVersion.getProtocol(protocol.getProtocolVersion());
- line += " / C: " + clientVer + " S: " + serverVer + " A: " + user.isActive();
- }
- }
-
- info.getReturnValue().add(line);
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/gui/client/MixinMultiplayerScreen.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/gui/client/MixinMultiplayerScreen.java
deleted file mode 100644
index 0a92a411..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/gui/client/MixinMultiplayerScreen.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.gui.client;
-
-import com.viaversion.fabric.mc189.ViaFabric;
-import com.viaversion.fabric.mc189.gui.ViaButton;
-import com.viaversion.fabric.mc189.gui.ViaConfigScreen;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.text.TranslatableText;
-import net.minecraft.util.Identifier;
-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;
-
-@Mixin(MultiplayerScreen.class)
-public abstract class MixinMultiplayerScreen extends Screen {
- protected MixinMultiplayerScreen(UnsupportedOperationException e) {
- super();
- throw e;
- }
-
- @Inject(method = "init", at = @At("TAIL"))
- private void onInit(CallbackInfo ci) {
- ButtonWidget enableClientSideViaVersion = new ViaButton("via".hashCode(), this.width / 2 + 113, 10,
- 40, 20, // Size
- 0, 0, // Start pos of texture
- 20, // v Hover offset
- new Identifier("viafabric:textures/gui/widgets.png"),
- 256, 256, // Texture size
- it -> MinecraftClient.getInstance().setScreen(new ViaConfigScreen(this)),
- new TranslatableText("gui.via_button").asUnformattedString());
- if (ViaFabric.config.isHideButton()) enableClientSideViaVersion.visible = false;
- this.buttons.add(enableClientSideViaVersion);
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinClientConnection.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinClientConnection.java
deleted file mode 100644
index 76a52cc2..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinClientConnection.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.pipeline;
-
-import com.viaversion.fabric.common.handler.PipelineReorderEvent;
-import io.netty.channel.Channel;
-import net.minecraft.network.ClientConnection;
-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.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(ClientConnection.class)
-public class MixinClientConnection {
- @Shadow
- private Channel channel;
-
- @Inject(method = "setCompressionThreshold", at = @At("RETURN"))
- private void reorderCompression(int compressionThreshold, CallbackInfo ci) {
- channel.pipeline().fireUserEventTriggered(new PipelineReorderEvent());
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinServerNetworkIoChInit.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinServerNetworkIoChInit.java
deleted file mode 100644
index 9ff40482..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/MixinServerNetworkIoChInit.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.pipeline;
-
-import com.viaversion.fabric.common.handler.CommonTransformer;
-import com.viaversion.fabric.common.handler.FabricDecodeHandler;
-import com.viaversion.fabric.common.handler.FabricEncodeHandler;
-import com.viaversion.viaversion.connection.UserConnectionImpl;
-import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
-import io.netty.channel.Channel;
-import io.netty.channel.socket.SocketChannel;
-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 com.viaversion.viaversion.api.connection.UserConnection;
-
-@Mixin(targets = "net.minecraft.server.ServerNetworkIo$4")
-public class MixinServerNetworkIoChInit {
- @Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
- private void onInitChannel(Channel channel, CallbackInfo ci) {
- if (channel instanceof SocketChannel) {
- UserConnection user = new UserConnectionImpl(channel);
- new ProtocolPipelineImpl(user);
-
- channel.pipeline().addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user));
- channel.pipeline().addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
- }
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnection.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnection.java
deleted file mode 100644
index 68968455..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.pipeline.client;
-
-import com.viaversion.fabric.mc189.ViaFabric;
-import com.viaversion.fabric.mc189.service.ProtocolAutoDetector;
-import net.minecraft.network.ClientConnection;
-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.CallbackInfoReturnable;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-
-@Mixin(ClientConnection.class)
-public class MixinClientConnection {
- @Inject(method = "connect", at = @At("HEAD"))
- private static void onConnect(InetAddress address, int port, boolean shouldUseNativeTransport, CallbackInfoReturnable cir) {
- try {
- if (!ViaFabric.config.isClientSideEnabled()) return;
- ProtocolAutoDetector.detectVersion(new InetSocketAddress(address, port)).get(10, TimeUnit.SECONDS);
- } catch (Exception e) {
- ViaFabric.JLOGGER.log(Level.WARNING, "Could not auto-detect protocol for " + address + " " + e);
- }
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnectionChInit.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnectionChInit.java
deleted file mode 100644
index 885261d2..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/pipeline/client/MixinClientConnectionChInit.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.pipeline.client;
-
-import com.viaversion.fabric.common.handler.FabricDecodeHandler;
-import com.viaversion.fabric.common.handler.FabricEncodeHandler;
-import com.viaversion.fabric.common.handler.CommonTransformer;
-import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
-import com.viaversion.viaversion.connection.UserConnectionImpl;
-import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
-import io.netty.channel.Channel;
-import io.netty.channel.socket.SocketChannel;
-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 com.viaversion.viaversion.api.connection.UserConnection;
-
-@Mixin(targets = "net.minecraft.network.ClientConnection$5")
-public class MixinClientConnectionChInit {
- @Inject(method = "initChannel", at = @At(value = "TAIL"), remap = false)
- private void onInitChannel(Channel channel, CallbackInfo ci) {
- if (channel instanceof SocketChannel) {
- UserConnection user = new UserConnectionImpl(channel, true);
- new ProtocolPipelineImpl(user).add(HostnameParserProtocol.INSTANCE);
-
- channel.pipeline()
- .addBefore("encoder", CommonTransformer.HANDLER_ENCODER_NAME, new FabricEncodeHandler(user))
- .addBefore("decoder", CommonTransformer.HANDLER_DECODER_NAME, new FabricDecodeHandler(user));
- }
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/shutdown/server/MixinMinecraftServer.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/shutdown/server/MixinMinecraftServer.java
deleted file mode 100644
index 41c33fd0..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/mixin/shutdown/server/MixinMinecraftServer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.mixin.shutdown.server;
-
-import com.viaversion.viaversion.ViaManagerImpl;
-import com.viaversion.viaversion.api.Via;
-import net.minecraft.server.MinecraftServer;
-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;
-
-@Mixin(MinecraftServer.class)
-public class MixinMinecraftServer {
- @Inject(method = "stopRunning", at = @At("TAIL"))
- private void onStopRunning(CallbackInfo ci) {
- ((ViaManagerImpl) Via.getManager()).destroy();
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricNativeVersionProvider.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricNativeVersionProvider.java
deleted file mode 100644
index c49c47fa..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricNativeVersionProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.platform;
-
-import com.viaversion.fabric.common.platform.NativeVersionProvider;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.fabricmc.loader.api.FabricLoader;
-import net.minecraft.realms.RealmsSharedConstants;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.ServerMetadata;
-
-public class FabricNativeVersionProvider implements NativeVersionProvider {
- @Override
- public int getNativeServerVersion() {
- if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
- return getClientProtocol();
- }
-
- ServerMetadata.Version version = MinecraftServer.getServer().getServerMetadata().getVersion();
- if (version == null) return ProtocolVersion.v1_8.getVersion();
- return version.getProtocolVersion();
- }
-
- @Environment(EnvType.CLIENT)
- private int getClientProtocol() {
- try {
- return RealmsSharedConstants.class.getField("NETWORK_PROTOCOL_VERSION").getInt(null);
- } catch (IllegalAccessException | NoSuchFieldException e) {
- e.printStackTrace();
- }
- return ProtocolVersion.v1_8.getVersion(); // fallback
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricPlatform.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricPlatform.java
deleted file mode 100644
index 3b70f081..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/FabricPlatform.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.platform;
-
-import com.viaversion.fabric.common.commands.UserCommandSender;
-import com.viaversion.fabric.common.platform.NativeVersionProvider;
-import com.viaversion.fabric.common.provider.AbstractFabricPlatform;
-import com.viaversion.fabric.common.util.FutureTaskId;
-import com.viaversion.fabric.mc189.ViaFabric;
-import com.viaversion.fabric.mc189.commands.NMSCommandSender;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.command.ViaCommandSender;
-import com.viaversion.viaversion.util.ComponentUtil;
-import io.netty.channel.EventLoop;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.loader.api.FabricLoader;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.entity.player.ServerPlayerEntity;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.text.Text;
-
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
-import java.util.function.Supplier;
-import java.util.logging.Level;
-
-public class FabricPlatform extends AbstractFabricPlatform {
- public static MinecraftServer getServer() {
- // In 1.8.9 integrated server instance exists even if it's not running
- if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT
- && !MinecraftClient.getInstance().isIntegratedServerRunning()) return null;
- return MinecraftServer.getServer();
- }
-
- @Override
- protected void installNativeVersionProvider() {
- Via.getManager().getProviders().use(NativeVersionProvider.class, new FabricNativeVersionProvider());
- }
-
- @Override
- protected ExecutorService asyncService() {
- return ViaFabric.ASYNC_EXECUTOR;
- }
-
- @Override
- protected EventLoop eventLoop() {
- return ViaFabric.EVENT_LOOP;
- }
-
- @Override
- public FutureTaskId runAsync(Runnable runnable) {
- return new FutureTaskId(CompletableFuture
- .runAsync(runnable, ViaFabric.ASYNC_EXECUTOR)
- .exceptionally(throwable -> {
- if (!(throwable instanceof CancellationException)) {
- throwable.printStackTrace();
- }
- return null;
- })
- );
- }
-
- @Override
- public FutureTaskId runSync(Runnable runnable) {
- if (getServer() != null) {
- return runServerSync(runnable);
- } else {
- return runEventLoop(runnable);
- }
- }
-
- private FutureTaskId runServerSync(Runnable runnable) {
- // Kick task needs to be on main thread, it does already have error logger
- return new FutureTaskId(CompletableFuture.runAsync(runnable, it -> getServer().method_10815((Callable) () -> {
- it.run();
- return null;
- })));
- }
-
- @Override
- public ViaCommandSender[] getOnlinePlayers() {
- MinecraftServer server = getServer();
- if (server != null && server.isOnThread()) {
- return getServerPlayers();
- }
- return Via.getManager().getConnectionManager().getConnectedClients().values().stream()
- .map(UserCommandSender::new)
- .toArray(ViaCommandSender[]::new);
- }
-
- private ViaCommandSender[] getServerPlayers() {
- return getServer().getPlayerManager().getPlayers().stream()
- .map(NMSCommandSender::new)
- .toArray(ViaCommandSender[]::new);
- }
-
- @Override
- public void sendMessage(UUID uuid, String s) {
- sendMessageServer(uuid, s);
- }
-
- private void sendMessageServer(UUID uuid, String s) {
- MinecraftServer server = getServer();
- if (server == null) return;
- runServerSync(() -> {
- ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
- if (player == null) return;
- player.sendMessage(Text.Serializer.deserialize(ComponentUtil.legacyToJsonString(s)));
- });
- }
-
- @Override
- public boolean kickPlayer(UUID uuid, String s) {
- return kickServer(uuid, s);
- }
-
- private boolean kickServer(UUID uuid, String s) {
- MinecraftServer server = getServer();
- if (server == null) return false;
- Supplier kickTask = () -> {
- ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid);
- if (player == null) return false;
- player.networkHandler.disconnect(s);
- return true;
- };
- if (server.isOnThread()) {
- return kickTask.get();
- } else {
- ViaFabric.JLOGGER.log(Level.WARNING, "Weird!? Player kicking was called off-thread", new Throwable());
- runServerSync(kickTask::get);
- }
- return false; // Can't know if it worked
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/VFLoader.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/VFLoader.java
deleted file mode 100644
index b60adc0f..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/platform/VFLoader.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.platform;
-
-import com.viaversion.fabric.mc189.providers.VFHandItemProvider;
-import com.viaversion.fabric.mc189.providers.FabricVersionProvider;
-import com.viaversion.viaversion.protocols.v1_8to1_9.provider.HandItemProvider;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.loader.api.FabricLoader;
-import com.viaversion.viaversion.api.Via;
-import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
-import com.viaversion.viaversion.api.protocol.version.VersionProvider;
-
-public class VFLoader implements ViaPlatformLoader {
- @Override
- public void load() {
- Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
-
- if (Via.getPlatform().getConf().isItemCache()) {
- VFHandItemProvider handProvider = new VFHandItemProvider();
- if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
- handProvider.registerClientTick();
- }
- handProvider.registerServerTick();
- Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
- }
- }
-
- @Override
- public void unload() {
- // Nothing to do
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/FabricVersionProvider.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/FabricVersionProvider.java
deleted file mode 100644
index 5565ac5c..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/FabricVersionProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.providers;
-
-import com.viaversion.fabric.common.config.VFConfig;
-import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
-import com.viaversion.fabric.mc189.ViaFabric;
-import com.viaversion.fabric.mc189.service.ProtocolAutoDetector;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-
-import java.net.InetSocketAddress;
-import java.util.concurrent.CompletableFuture;
-import java.util.logging.Logger;
-
-public class FabricVersionProvider extends AbstractFabricVersionProvider {
- @Override
- protected Logger getLogger() {
- return ViaFabric.JLOGGER;
- }
-
- @Override
- protected VFConfig getConfig() {
- return ViaFabric.config;
- }
-
- @Override
- protected CompletableFuture detectVersion(InetSocketAddress address) {
- return ProtocolAutoDetector.detectVersion(address);
- }
-}
\ No newline at end of file
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/VFHandItemProvider.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/VFHandItemProvider.java
deleted file mode 100644
index 065ad578..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/providers/VFHandItemProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.providers;
-
-import com.viaversion.fabric.mc189.ViaFabric;
-import com.viaversion.viaversion.api.connection.UserConnection;
-import com.viaversion.viaversion.api.minecraft.item.DataItem;
-import com.viaversion.viaversion.api.minecraft.item.Item;
-import com.viaversion.viaversion.protocols.v1_8to1_9.provider.HandItemProvider;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
-import net.legacyfabric.fabric.api.event.lifecycle.v1.ServerTickEvents;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.entity.player.ClientPlayerEntity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.server.MinecraftServer;
-
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class VFHandItemProvider extends HandItemProvider {
- public final Map serverPlayers = new ConcurrentHashMap<>();
- public Item clientItem = null;
-
- @Override
- public Item getHandItem(UserConnection info) {
- Item serverItem;
- if (info.isClientSide()) {
- return getClientItem();
- } else if ((serverItem = serverPlayers.get(info.getProtocolInfo().getUuid())) != null) {
- return serverItem.copy();
- }
- return super.getHandItem(info);
- }
-
- private Item getClientItem() {
- if (clientItem == null) {
- return new DataItem(0, (byte) 0, (short) 0, null);
- }
- return clientItem.copy();
- }
-
- @Environment(EnvType.CLIENT)
- public void registerClientTick() {
- try {
- ClientTickEvents.END_WORLD_TICK.register(world -> tickClient());
- } catch (NoClassDefFoundError ignored1) {
- ViaFabric.JLOGGER.info("Fabric Lifecycle V1 isn't installed");
- }
- }
-
- public void registerServerTick() {
- try {
- ServerTickEvents.END_SERVER_TICK.register(this::tickServer);
- } catch (NoClassDefFoundError ignored1) {
- ViaFabric.JLOGGER.info("Fabric Lifecycle V1 isn't installed");
- }
- }
-
- private void tickClient() {
- ClientPlayerEntity p = MinecraftClient.getInstance().player;
- if (p != null) {
- clientItem = fromNative(p.inventory.getMainHandStack());
- }
- }
-
- private void tickServer(MinecraftServer server) {
- serverPlayers.clear();
- server.getPlayerManager().getPlayers().forEach(it -> serverPlayers
- .put(it.getUuid(), fromNative(it.inventory.getMainHandStack())));
- }
-
- private Item fromNative(ItemStack original) {
- if (original == null) return new DataItem(0, (byte) 0, (short) 0, null);
- int id = net.minecraft.item.Item.getRawId(original.getItem());
- return new DataItem(id, (byte) original.count, (short) original.getDamage(), null);
- }
-}
diff --git a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/service/ProtocolAutoDetector.java b/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/service/ProtocolAutoDetector.java
deleted file mode 100644
index c3ec327b..00000000
--- a/viafabric-mc189/src/main/java/com/viaversion/fabric/mc189/service/ProtocolAutoDetector.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * This file is part of ViaFabric - https://github.com/ViaVersion/ViaFabric
- * Copyright (C) 2018-2024 ViaVersion and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.viaversion.fabric.mc189.service;
-
-import com.viaversion.fabric.mc189.ViaFabric;
-import com.viaversion.fabric.common.AddressParser;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.*;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.timeout.ReadTimeoutHandler;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.network.*;
-import net.minecraft.network.listener.ClientQueryPacketListener;
-import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
-import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
-import net.minecraft.network.packet.s2c.query.QueryPongS2CPacket;
-import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
-import net.minecraft.realms.RealmsSharedConstants;
-import net.minecraft.server.ServerMetadata;
-import net.minecraft.text.LiteralText;
-import net.minecraft.text.Text;
-import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-
-@Environment(EnvType.CLIENT)
-public class ProtocolAutoDetector {
- private static final LoadingCache> SERVER_VER = CacheBuilder.newBuilder()
- .expireAfterWrite(30, TimeUnit.SECONDS)
- .build(CacheLoader.from((address) -> {
- CompletableFuture future = new CompletableFuture<>();
-
- try {
- final ClientConnection clientConnection = new ClientConnection(NetworkSide.CLIENTBOUND);
-
- ChannelFuture ch = new Bootstrap()
- .group(ClientConnection.field_11553.get())
- .channel(NioSocketChannel.class)
- .handler(new ChannelInitializer() {
- protected void initChannel(Channel channel) {
- try {
- channel.config().setOption(ChannelOption.TCP_NODELAY, true);
- channel.config().setOption(ChannelOption.IP_TOS, 0x18); // Stolen from Velocity, low delay, high reliability
- } catch (ChannelException ignored) {
- }
-
- channel.pipeline()
- .addLast("timeout", new ReadTimeoutHandler(30))
- .addLast("splitter", new SplitterHandler())
- .addLast("decoder", new DecoderHandler(NetworkSide.CLIENTBOUND))
- .addLast("prepender", new SizePrepender())
- .addLast("encoder", new PacketEncoder(NetworkSide.SERVERBOUND))
- .addLast("packet_handler", clientConnection);
- }
- })
- .connect(address);
-
- ch.addListener(future1 -> {
- if (!future1.isSuccess()) {
- future.completeExceptionally(future1.cause());
- } else {
- ch.channel().eventLoop().execute(() -> { // needs to execute after channel init
- clientConnection.setPacketListener(new ClientQueryPacketListener() {
- @Override
- public void onResponse(QueryResponseS2CPacket packet) {
- ServerMetadata meta = packet.getServerMetadata();
- ServerMetadata.Version version;
- if (meta != null && (version = meta.getVersion()) != null) {
- ProtocolVersion ver = ProtocolVersion.getProtocol(version.getProtocolVersion());
- future.complete(ver);
- ViaFabric.JLOGGER.info("Auto-detected " + ver + " for " + address);
- } else {
- future.completeExceptionally(new IllegalArgumentException("Null version in query response"));
- }
- clientConnection.disconnect(new LiteralText(""));
- }
-
- @Override
- public void onPong(QueryPongS2CPacket packet) {
- clientConnection.disconnect(new LiteralText("Pong not requested!"));
- }
-
- @Override
- public void onDisconnected(Text reason) {
- future.completeExceptionally(new IllegalStateException(reason.asUnformattedString()));
- }
- });
-
- clientConnection.send(new HandshakeC2SPacket(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION, address.getHostString(),
- address.getPort(), NetworkState.STATUS));
- clientConnection.send(new QueryRequestC2SPacket());
- });
- }
- });
- } catch (Throwable throwable) {
- future.completeExceptionally(throwable);
- }
-
- return future;
- }));
-
- public static CompletableFuture detectVersion(InetSocketAddress address) {
- try {
- InetSocketAddress real = new InetSocketAddress(InetAddress.getByAddress
- (new AddressParser().parse(address.getHostString()).serverAddress,
- address.getAddress().getAddress()), address.getPort());
- return SERVER_VER.get(real);
- } catch (UnknownHostException | ExecutionException e) {
- ViaFabric.JLOGGER.log(Level.WARNING, "Protocol auto detector error: ", e);
- return CompletableFuture.completedFuture(null);
- }
- }
-}
diff --git a/viafabric-mc189/src/main/resources/fabric.mod.json b/viafabric-mc189/src/main/resources/fabric.mod.json
deleted file mode 100644
index 7ffc07c3..00000000
--- a/viafabric-mc189/src/main/resources/fabric.mod.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "schemaVersion": 1,
- "id": "viafabric-mc189",
- "name": "ViaFabric for 1.8",
- "version": "${version}",
- "description": "${description}",
- "license": "GPL-3.0",
- "contact": {
- "homepage": "https://viaversion.com/fabric",
- "issues": "https://github.com/ViaVersion/ViaFabric/issues",
- "sources": "https://github.com/ViaVersion/ViaFabric"
- },
- "environment": "*",
- "authors": [
- {
- "name": "creeper123123321",
- "contact": {
- "homepage": "https://creeper123123321.github.io/"
- }
- },
- {
- "name": "FlorianMichael/EnZaXD",
- "contact": {
- "homepage": "https://github.com/FlorianMichael"
- }
- },
- {
- "name": "kennytv",
- "contact": {
- "homepage": "https://kennytv.eu"
- }
- },
- {
- "name": "Kichura",
- "contact": {
- "homepage": "https://github.com/Kichura"
- }
- }
- ],
- "contributors": [
- {
- "name": "GitHub contributors",
- "contact": {
- "homepage": "https://github.com/ViaVersion/ViaFabric/graphs/contributors"
- }
- }
- ],
- "entrypoints": {
- "main": [
- "com.viaversion.fabric.mc189.ViaFabric"
- ],
- "modmenu": [
- "com.viaversion.fabric.mc189.gui.ModMenuConfig"
- ]
- },
- "depends": {
- "legacy-fabric-resource-loader-v1": "*",
- "minecraft": "1.8.9",
- "viafabric": "*"
- },
- "recommends": {
- "legacy-fabric-command-api-v1": "*"
- },
- "mixins": [
- "mixins.viafabric189.address.json",
- "mixins.viafabric189.gui.json",
- "mixins.viafabric189.debug.json",
- "mixins.viafabric189.pipeline.json",
- "mixins.viafabric189.shutdown.json"
- ],
- "custom": {
- "modmenu": {
- "parent": "viafabric"
- }
- }
-}
diff --git a/viafabric-mc189/src/main/resources/mixins.viafabric189.address.json b/viafabric-mc189/src/main/resources/mixins.viafabric189.address.json
deleted file mode 100644
index adafc623..00000000
--- a/viafabric-mc189/src/main/resources/mixins.viafabric189.address.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc189.mixin.address",
- "mixins": [
- ],
- "client": [
- "client.MixinConnectScreenThread",
- "client.MixinServerAddress",
- "client.MixinServerPinger"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}
diff --git a/viafabric-mc189/src/main/resources/mixins.viafabric189.debug.json b/viafabric-mc189/src/main/resources/mixins.viafabric189.debug.json
deleted file mode 100644
index 079bfadc..00000000
--- a/viafabric-mc189/src/main/resources/mixins.viafabric189.debug.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc189.mixin.debug",
- "mixins": [
- ],
- "client": [
- "client.MixinClientConnectionAccessor",
- "client.MixinDebugHud",
- "client.MixinClientConnection"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}
diff --git a/viafabric-mc189/src/main/resources/mixins.viafabric189.gui.json b/viafabric-mc189/src/main/resources/mixins.viafabric189.gui.json
deleted file mode 100644
index 940327ff..00000000
--- a/viafabric-mc189/src/main/resources/mixins.viafabric189.gui.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc189.mixin.gui",
- "mixins": [
- ],
- "client": [
- "client.MixinMultiplayerScreen"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}
diff --git a/viafabric-mc189/src/main/resources/mixins.viafabric189.pipeline.json b/viafabric-mc189/src/main/resources/mixins.viafabric189.pipeline.json
deleted file mode 100644
index d6e472ca..00000000
--- a/viafabric-mc189/src/main/resources/mixins.viafabric189.pipeline.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc189.mixin.pipeline",
- "mixins": [
- "MixinClientConnection",
- "MixinServerNetworkIoChInit"
- ],
- "client": [
- "client.MixinClientConnection",
- "client.MixinClientConnectionChInit"
- ],
- "injectors": {
- "defaultRequire": 1
- }
-}
diff --git a/viafabric-mc189/src/main/resources/mixins.viafabric189.shutdown.json b/viafabric-mc189/src/main/resources/mixins.viafabric189.shutdown.json
deleted file mode 100644
index 1ba23f21..00000000
--- a/viafabric-mc189/src/main/resources/mixins.viafabric189.shutdown.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "required": true,
- "compatibilityLevel": "JAVA_8",
- "package": "com.viaversion.fabric.mc189.mixin.shutdown",
- "mixins": [
- ],
- "server": [
- "server.MixinMinecraftServer"
- ],
- "injectors": {
- "defaultRequire": 0
- }
-}