Skip to content

Commit

Permalink
remove fastutil usage
Browse files Browse the repository at this point in the history
better fix to #349
  • Loading branch information
creeper123123321 committed Jul 7, 2024
1 parent 832a29f commit 6a78845
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
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
Expand Down Expand Up @@ -57,13 +57,13 @@ public JsonObject getDump() {
}

@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()));
Expand Down

0 comments on commit 6a78845

Please sign in to comment.