diff options
author | Linnea Gräf <nea@nea.moe> | 2023-12-29 19:14:55 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2023-12-29 19:14:55 +0100 |
commit | bd0712adb0eb9c12a97a201b6df52fbdad0f0dba (patch) | |
tree | 5274c77aca2daa0f7eb8c9a15da2c6f10342dec3 /src/main/kotlin/moe/nea/firmament | |
parent | 745688773823d79c6033ccd6b008c690abf7d131 (diff) | |
download | firmament-bd0712adb0eb9c12a97a201b6df52fbdad0f0dba.tar.gz firmament-bd0712adb0eb9c12a97a201b6df52fbdad0f0dba.tar.bz2 firmament-bd0712adb0eb9c12a97a201b6df52fbdad0f0dba.zip |
Fix legacy tag parser prefering untyped doubles to ints
This fixes an incompatibility caused by https://github.com/SkyblockerMod/Skyblocker/issues/462
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/LegacyTagParser.kt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/LegacyTagParser.kt b/src/main/kotlin/moe/nea/firmament/util/LegacyTagParser.kt index 80e1ea4..47d60ac 100644 --- a/src/main/kotlin/moe/nea/firmament/util/LegacyTagParser.kt +++ b/src/main/kotlin/moe/nea/firmament/util/LegacyTagParser.kt @@ -208,10 +208,6 @@ class LegacyTagParser private constructor(string: String) { if (textForm.isEmpty()) { racer.error("Expected numeric tag (starting with either -, +, . or a digit") } - val doubleMatch = Patterns.DOUBLE.matchEntire(textForm) ?: Patterns.DOUBLE_UNTYPED.matchEntire(textForm) - if (doubleMatch != null) { - return NbtDouble.of(doubleMatch.groups[1]!!.value.toDouble()) - } val floatMatch = Patterns.FLOAT.matchEntire(textForm) if (floatMatch != null) { return NbtFloat.of(floatMatch.groups[1]!!.value.toFloat()) @@ -232,6 +228,10 @@ class LegacyTagParser private constructor(string: String) { if (integerMatch != null) { return NbtInt.of(integerMatch.groups[1]!!.value.toInt()) } + val doubleMatch = Patterns.DOUBLE.matchEntire(textForm) ?: Patterns.DOUBLE_UNTYPED.matchEntire(textForm) + if (doubleMatch != null) { + return NbtDouble.of(doubleMatch.groups[1]!!.value.toDouble()) + } throw IllegalStateException("Could not properly parse numeric tag '$textForm', despite passing rough verification. This is a bug in the LegacyTagParser") } |