mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-14 22:55:15 +01:00
Improve version detection on borge and fabric
This commit is contained in:
parent
aa5395622c
commit
db05bc89b0
@ -38,7 +38,7 @@ public class MinecraftVersion implements Comparable<MinecraftVersion> {
|
||||
|
||||
private static final Pattern VERSION_REGEX = Pattern.compile("(?:(?<major>\\d+)\\.(?<minor>\\d+))(?:\\.(?<patch>\\d+))?(?:\\-(?:pre|rc)\\d+)?");
|
||||
|
||||
public static final MinecraftVersion LATEST_SUPPORTED = new MinecraftVersion(1, 19, 0);
|
||||
public static final MinecraftVersion LATEST_SUPPORTED = new MinecraftVersion(1, 19, 1);
|
||||
public static final MinecraftVersion EARLIEST_SUPPORTED = new MinecraftVersion(1, 13);
|
||||
|
||||
private final int major, minor, patch;
|
||||
|
@ -41,6 +41,7 @@
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
@ -124,7 +125,11 @@ public void onInitialize() {
|
||||
|
||||
@Override
|
||||
public MinecraftVersion getMinecraftVersion() {
|
||||
return new MinecraftVersion(1, 19);
|
||||
try {
|
||||
return MinecraftVersion.of(SharedConstants.getGameVersion().getReleaseTarget());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return MinecraftVersion.LATEST_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,6 +35,7 @@
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -140,7 +141,11 @@ public void onTick(ServerTickEvent evt) {
|
||||
|
||||
@Override
|
||||
public MinecraftVersion getMinecraftVersion() {
|
||||
return new MinecraftVersion(1, 19, 1);
|
||||
try {
|
||||
return MinecraftVersion.of(SharedConstants.getCurrentVersion().getReleaseTarget());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return MinecraftVersion.LATEST_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,6 +35,7 @@
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -140,7 +141,11 @@ public void onTick(ServerTickEvent evt) {
|
||||
|
||||
@Override
|
||||
public MinecraftVersion getMinecraftVersion() {
|
||||
return new MinecraftVersion(1, 19, 0);
|
||||
try {
|
||||
return MinecraftVersion.of(SharedConstants.getCurrentVersion().getReleaseTarget());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return new MinecraftVersion(1, 19, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user