mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-24 12:06:11 +01:00
parent
832a29f935
commit
6a788454ad
@ -145,7 +145,6 @@ dependencies {
|
|||||||
|
|
||||||
includeJ8("com.viaversion:viaversion:${rootProject.viaver_version}")
|
includeJ8("com.viaversion:viaversion:${rootProject.viaver_version}")
|
||||||
include("org.yaml:snakeyaml:${rootProject.yaml_version}")
|
include("org.yaml:snakeyaml:${rootProject.yaml_version}")
|
||||||
implementation("it.unimi.dsi:fastutil:8.5.13")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remapJar {
|
remapJar {
|
||||||
|
@ -22,13 +22,13 @@ import com.viaversion.viaversion.api.Via;
|
|||||||
import com.viaversion.viaversion.api.platform.ViaInjector;
|
import com.viaversion.viaversion.api.platform.ViaInjector;
|
||||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
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.api.EnvType;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
import java.util.SortedSet;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
public class FabricInjector implements ViaInjector {
|
public class FabricInjector implements ViaInjector {
|
||||||
@Override
|
@Override
|
||||||
@ -57,13 +57,13 @@ public class FabricInjector implements ViaInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectSortedSet<ProtocolVersion> getServerProtocolVersions() {
|
public SortedSet<ProtocolVersion> getServerProtocolVersions() {
|
||||||
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
|
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
|
||||||
final ProtocolVersion version = Via.getManager().getProviders().get(NativeVersionProvider.class).getNativeServerProtocolVersion();
|
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
|
// 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);
|
versions.add(ProtocolVersion.v1_8);
|
||||||
final OptionalInt highestSupportedVersion = ProtocolVersion.getProtocols().stream().mapToInt(ProtocolVersion::getOriginalVersion).max();
|
final OptionalInt highestSupportedVersion = ProtocolVersion.getProtocols().stream().mapToInt(ProtocolVersion::getOriginalVersion).max();
|
||||||
versions.add(ProtocolVersion.getProtocol(highestSupportedVersion.getAsInt()));
|
versions.add(ProtocolVersion.getProtocol(highestSupportedVersion.getAsInt()));
|
||||||
|
Loading…
Reference in New Issue
Block a user