remove fastutil usage

better fix to #349
This commit is contained in:
creeper123123321 2024-07-07 15:23:22 -03:00
parent 832a29f935
commit 6a788454ad
2 changed files with 6 additions and 7 deletions

View File

@ -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 {

View File

@ -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<ProtocolVersion> getServerProtocolVersions() {
public SortedSet<ProtocolVersion> 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<ProtocolVersion> versions = new ObjectLinkedOpenHashSet<>();
SortedSet<ProtocolVersion> versions = new TreeSet<>();
versions.add(ProtocolVersion.v1_8);
final OptionalInt highestSupportedVersion = ProtocolVersion.getProtocols().stream().mapToInt(ProtocolVersion::getOriginalVersion).max();
versions.add(ProtocolVersion.getProtocol(highestSupportedVersion.getAsInt()));