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

修复三元导致的类型强转问题.

This commit is contained in:
Catnies
2025-06-27 02:30:30 +08:00
parent 982cf7980e
commit 2b4ed81b72

View File

@@ -238,7 +238,9 @@ public final class SNBTReader extends DefaultStringReader {
if (hexDigits.isEmpty()) return fullString; // 没值了代表这是个字符串.
long value = Long.parseLong(hexDigits, 16);
if (negativeHex) value = -value;
return (value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE) ? (int) value : value; // 默认返回的还是Int类型的喵.
// 默认返回的还是Int类型的, 三元坑我喵.
if (value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE) return (int) value;
else return value;
}
// 布尔值检查