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

Update ResolutionMergePackMcMeta.java

This commit is contained in:
XiaoMoMi
2025-10-06 18:58:38 +08:00
parent 8b40a2dad4
commit eec7cf4903

View File

@@ -186,8 +186,21 @@ public class ResolutionMergePackMcMeta implements Resolution {
} }
if (supported.isJsonPrimitive()) { if (supported.isJsonPrimitive()) {
int value = supported.getAsInt(); if (supported.getAsJsonPrimitive().isNumber()) {
return new MinMax(value, value); int value = supported.getAsInt();
return new MinMax(value, value);
} else if (supported.getAsJsonPrimitive().isString()) {
String value = supported.getAsString();
if (value.contains(",")) {
String[] parts = value.replace("[", "").replace("]", "").split(",");
int min = Integer.parseInt(parts[0]);
int max = Integer.parseInt(parts[1]);
return new MinMax(min, max);
} else {
int min = Integer.parseInt(value);
return new MinMax(min, min);
}
}
} }
if (supported.isJsonArray()) { if (supported.isJsonArray()) {