1.18-pre1, fix #161 ?

This commit is contained in:
creeper123123321 2021-11-12 18:49:05 -03:00
parent 7436b2c6da
commit 51ac0be637
12 changed files with 14 additions and 14 deletions

View File

@ -13,7 +13,7 @@ plugins {
}
def ENV = System.getenv()
def vvVer = "4.1.0-21w44a-SNAPSHOT"
def vvVer = "4.1.0-1.18-pre1-SNAPSHOT"
def yamlVer = "1.29"
description = "Client-side and server-side ViaVersion implementation for Fabric"

View File

@ -3,5 +3,5 @@ package com.viaversion.fabric.common.platform;
import com.viaversion.viaversion.api.platform.providers.Provider;
public interface NativeVersionProvider extends Provider {
int getServerProtocolVersion();
int getNativeServerVersion();
}

View File

@ -183,7 +183,7 @@ public abstract class AbstractFabricPlatform implements ViaPlatform<UUID> {
platformSpecific.add("mods", mods);
NativeVersionProvider ver = Via.getManager().getProviders().get(NativeVersionProvider.class);
if (ver != null) {
platformSpecific.addProperty("native version", ver.getServerProtocolVersion());
platformSpecific.addProperty("native version", ver.getNativeServerVersion());
}
return platformSpecific;
}

View File

@ -105,7 +105,7 @@ public abstract class AbstractFabricVersionProvider extends BaseVersionProvider
}
NativeVersionProvider natProvider = Via.getManager().getProviders().get(NativeVersionProvider.class);
if (natProvider != null) {
return natProvider.getServerProtocolVersion();
return ProtocolVersion.getProtocol(natProvider.getNativeServerVersion()).getVersion();
}
return super.getClosestServerProtocol(connection);
}

View File

@ -11,7 +11,7 @@ public class ProtocolUtils {
public static boolean isSupportedClientSide(int server) {
return isSupported(server, Via.getManager().getProviders()
.get(NativeVersionProvider.class)
.getServerProtocolVersion());
.getNativeServerVersion());
}
public static boolean isSupported(int server, int client) {

View File

@ -5,7 +5,7 @@ import net.minecraft.SharedConstants;
public class FabricNativeVersionProvider implements NativeVersionProvider {
@Override
public int getServerProtocolVersion() {
public int getNativeServerVersion() {
return SharedConstants.getGameVersion().getProtocolVersion();
}
}

View File

@ -5,7 +5,7 @@ import net.minecraft.SharedConstants;
public class FabricNativeVersionProvider implements NativeVersionProvider {
@Override
public int getServerProtocolVersion() {
public int getNativeServerVersion() {
return SharedConstants.getGameVersion().getProtocolVersion();
}
}

View File

@ -5,7 +5,7 @@ import net.minecraft.SharedConstants;
public class FabricNativeVersionProvider implements NativeVersionProvider {
@Override
public int getServerProtocolVersion() {
public int getNativeServerVersion() {
return SharedConstants.getGameVersion().getProtocolVersion();
}
}

View File

@ -5,7 +5,7 @@ import net.minecraft.SharedConstants;
public class FabricNativeVersionProvider implements NativeVersionProvider {
@Override
public int getServerProtocolVersion() {
public int getNativeServerVersion() {
return SharedConstants.getGameVersion().getProtocolVersion();
}
}

View File

@ -1,7 +1,7 @@
dependencies {
minecraft("com.mojang:minecraft:21w44a")
mappings("net.fabricmc:yarn:21w44a+build.4:v2")
minecraft("com.mojang:minecraft:1.18-pre1")
mappings("net.fabricmc:yarn:1.18-pre1+build.5:v2")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.42.0+1.18")
modImplementation("net.fabricmc.fabric-api:fabric-api:0.42.2+1.18")
modImplementation("com.terraformersmc:modmenu:3.0.0")
}

View File

@ -5,7 +5,7 @@ import net.minecraft.SharedConstants;
public class FabricNativeVersionProvider implements NativeVersionProvider {
@Override
public int getServerProtocolVersion() {
public int getNativeServerVersion() {
return SharedConstants.getGameVersion().getProtocolVersion();
}
}

View File

@ -10,7 +10,7 @@ import net.minecraft.server.MinecraftServer;
public class FabricNativeVersionProvider implements NativeVersionProvider {
@Override
public int getServerProtocolVersion() {
public int getNativeServerVersion() {
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
return getClientProtocol();
}