9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

最低支持1.16客户端

This commit is contained in:
XiaoMoMi
2025-12-18 18:47:45 +08:00
parent 37d045aabf
commit 9606c17406
4 changed files with 17 additions and 3 deletions

View File

@@ -16,9 +16,9 @@ resource-pack:
# This option determines the location of the generated resource pack
# You can use either an absolute path or a relative path here
path: "./generated/resource_pack.zip"
# The minimum client version supported by CraftEngine is 1.20. If you need to provide support for lower client versions, please modify the resource pack yourself.
# The minimum client version supported by CraftEngine is 1.16. If you need to provide support for lower client versions, please modify the resource pack yourself.
# Allowed values:
# - 1.20.2, 1.21, 1.21.8, etc.
# - 1.20.1, 1.21, 1.21.8, 26.1, etc.
# - latest: the latest client version
# - server: the current server version
supported-version:

View File

@@ -845,6 +845,7 @@ public abstract class AbstractPackManager implements PackManager {
JsonElement description = AdventureHelper.componentToJsonElement(AdventureHelper.miniMessage().deserialize(Config.packDescription()));
packJson.add("description", description);
// 需要旧版本兼容性
// https://minecraft.wiki/w/Java_Edition_25w31a
if (minVersion.isBelow(PackVersion.PACK_FORMAT_CHANGE_VERSION)) {
packJson.addProperty("pack_format", minVersion.major());
JsonObject supportedVersions = new JsonObject();
@@ -865,7 +866,7 @@ public abstract class AbstractPackManager implements PackManager {
PackMcMeta mcMeta = new PackMcMeta(rawMeta);
List<Overlay> overlays = mcMeta.overlays();
if (!overlays.isEmpty()) {
boolean legacySupported = false;
boolean legacySupported = false; // https://minecraft.wiki/w/Java_Edition_25w31a
for (Overlay overlay : overlays) {
if (overlay.minVersion().isBelow(PackVersion.PACK_FORMAT_CHANGE_VERSION)) {
legacySupported = true;

View File

@@ -1,6 +1,7 @@
package net.momirealms.craftengine.core.pack.mcmeta.overlay;
import net.momirealms.craftengine.core.pack.mcmeta.Overlay;
import net.momirealms.craftengine.core.util.MinecraftVersion;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@@ -10,6 +10,12 @@ public class MinecraftVersion implements Comparable<MinecraftVersion> {
private static final Map<Integer, PackVersion> PACK_FORMATS = new HashMap<>();
static {
PACK_FORMATS.put(1_16_00, new PackVersion(5, 0));
PACK_FORMATS.put(1_16_01, new PackVersion(5, 0));
PACK_FORMATS.put(1_16_02, new PackVersion(6, 0));
PACK_FORMATS.put(1_16_03, new PackVersion(6, 0));
PACK_FORMATS.put(1_16_04, new PackVersion(6, 0));
PACK_FORMATS.put(1_16_05, new PackVersion(6, 0));
PACK_FORMATS.put(1_17_00, new PackVersion(7, 0));
PACK_FORMATS.put(1_17_01, new PackVersion(7, 0));
PACK_FORMATS.put(1_18_00, new PackVersion(8, 0));
@@ -45,6 +51,12 @@ public class MinecraftVersion implements Comparable<MinecraftVersion> {
private static final Map<String, MinecraftVersion> BY_NAME = new LinkedHashMap<>();
private static final Multimap<Integer, MinecraftVersion> BY_PACK_FORMAT = ArrayListMultimap.create();
public static final MinecraftVersion V1_16 = new MinecraftVersion("1.16");
public static final MinecraftVersion V1_16_1 = new MinecraftVersion("1.16.1");
public static final MinecraftVersion V1_16_2 = new MinecraftVersion("1.16.2");
public static final MinecraftVersion V1_16_3 = new MinecraftVersion("1.16.3");
public static final MinecraftVersion V1_16_4 = new MinecraftVersion("1.16.4");
public static final MinecraftVersion V1_16_5 = new MinecraftVersion("1.16.5");
public static final MinecraftVersion V1_17 = new MinecraftVersion("1.17");
public static final MinecraftVersion V1_17_1 = new MinecraftVersion("1.17.1");
public static final MinecraftVersion V1_18 = new MinecraftVersion("1.18");