diff --git a/src/main/java/de/florianmichael/viafabricplus/fixes/data/ResourcePackHeaderDiff.java b/src/main/java/de/florianmichael/viafabricplus/fixes/data/ResourcePackHeaderDiff.java index 00a3e74d..cff0b154 100644 --- a/src/main/java/de/florianmichael/viafabricplus/fixes/data/ResourcePackHeaderDiff.java +++ b/src/main/java/de/florianmichael/viafabricplus/fixes/data/ResourcePackHeaderDiff.java @@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.fixes.data; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viaversion.api.protocol.version.VersionType; +import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import net.minecraft.GameVersion; import net.minecraft.SaveVersion; import net.minecraft.SharedConstants; @@ -83,17 +83,10 @@ public class ResourcePackHeaderDiff { registerVersion(ProtocolVersion.v1_7_2, 1, "1.7.5"); } - /** - * Checks if the registry is outdated. - */ @ApiStatus.Internal public static void checkOutdated() { - for (ProtocolVersion version : ProtocolVersion.getProtocols()) { - if (version.isSnapshot()) continue; - if (version.getVersionType() != VersionType.RELEASE) continue; - if (!GAME_VERSION_DIFF.containsKey(version)) { - throw new RuntimeException("The version " + version + " has no pack format registered"); - } + if (!GAME_VERSION_DIFF.containsKey(ProtocolTranslator.NATIVE_VERSION)) { + throw new RuntimeException("The native client version is not registered in the resource pack header diff!"); } } diff --git a/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/ProtocolTranslator.java b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/ProtocolTranslator.java index 368131fb..b19f9ccb 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/ProtocolTranslator.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocoltranslator/ProtocolTranslator.java @@ -48,6 +48,7 @@ import io.netty.channel.Channel; import io.netty.util.AttributeKey; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.SharedConstants; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.network.ClientConnection; @@ -315,6 +316,9 @@ public class ProtocolTranslator { */ @ApiStatus.Internal public static CompletableFuture init(final File directory) { + if (SharedConstants.getProtocolVersion() != NATIVE_VERSION.getOriginalVersion()) { + throw new IllegalStateException("Native version is not the same as the current version"); + } patchConfigs(new File(directory, "ViaLoader")); // Register command callback for /viafabricplus