From 6a788454ad3d1570ad443ffd388daf0d9014826a Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Sun, 7 Jul 2024 15:23:22 -0300 Subject: [PATCH] remove fastutil usage better fix to #349 --- build.gradle | 1 - .../fabric/common/platform/FabricInjector.java | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 50f3409..0358294 100644 --- a/build.gradle +++ b/build.gradle @@ -145,7 +145,6 @@ dependencies { includeJ8("com.viaversion:viaversion:${rootProject.viaver_version}") include("org.yaml:snakeyaml:${rootProject.yaml_version}") - implementation("it.unimi.dsi:fastutil:8.5.13") } remapJar { diff --git a/src/main/java/com/viaversion/fabric/common/platform/FabricInjector.java b/src/main/java/com/viaversion/fabric/common/platform/FabricInjector.java index 94ee8a6..ac3cd3f 100644 --- a/src/main/java/com/viaversion/fabric/common/platform/FabricInjector.java +++ b/src/main/java/com/viaversion/fabric/common/platform/FabricInjector.java @@ -22,13 +22,13 @@ import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.platform.ViaInjector; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.libs.gson.JsonObject; -import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; -import it.unimi.dsi.fastutil.objects.ObjectSortedSet; -import it.unimi.dsi.fastutil.objects.ObjectSortedSets; import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; +import java.util.Collections; import java.util.OptionalInt; +import java.util.SortedSet; +import java.util.TreeSet; public class FabricInjector implements ViaInjector { @Override @@ -57,13 +57,13 @@ public class FabricInjector implements ViaInjector { } @Override - public ObjectSortedSet getServerProtocolVersions() { + public SortedSet getServerProtocolVersions() { if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) { final ProtocolVersion version = Via.getManager().getProviders().get(NativeVersionProvider.class).getNativeServerProtocolVersion(); - return ObjectSortedSets.singleton(version); + return new TreeSet<>(Collections.singleton(version)); } // On client-side we can connect to any server version - ObjectSortedSet versions = new ObjectLinkedOpenHashSet<>(); + SortedSet versions = new TreeSet<>(); versions.add(ProtocolVersion.v1_8); final OptionalInt highestSupportedVersion = ProtocolVersion.getProtocols().stream().mapToInt(ProtocolVersion::getOriginalVersion).max(); versions.add(ProtocolVersion.getProtocol(highestSupportedVersion.getAsInt()));