return native version on server-side, allow untested mc versions

closes #165
This commit is contained in:
creeper123123321 2021-12-18 07:52:59 -03:00
parent 0035c47d2a
commit db57ced2bb
2 changed files with 9 additions and 1 deletions

View File

@ -1,11 +1,15 @@
package com.viaversion.fabric.common.platform;
import com.viaversion.fabric.common.handler.CommonTransformer;
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.fastutil.ints.IntLinkedOpenHashSet;
import com.viaversion.viaversion.libs.fastutil.ints.IntSortedSet;
import com.viaversion.viaversion.libs.fastutil.ints.IntSortedSets;
import com.viaversion.viaversion.libs.gson.JsonObject;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
public class FabricInjector implements ViaInjector {
@Override
@ -35,6 +39,10 @@ public class FabricInjector implements ViaInjector {
@Override
public IntSortedSet getServerProtocolVersions() {
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
int version = Via.getManager().getProviders().get(NativeVersionProvider.class).getNativeServerVersion();
return IntSortedSets.singleton(version);
}
// On client-side we can connect to any server version
IntSortedSet versions = new IntLinkedOpenHashSet();
versions.add(ProtocolVersion.v1_7_1.getOriginalVersion());

View File

@ -13,7 +13,7 @@
},
"depends": {
"fabricloader": ">=0.10.0",
"minecraft": ["1.8.9", "1.14.4", "1.15.2", "1.16.5", "1.17.1", "1.18.x"],
"minecraft": ["1.8.x", "1.14.x", "1.15.x", "1.16.x", "1.17.x", "1.18.x"],
"viaversion": ">=4.0.0"
},
"environment": "*",