Merge branch '1.21' into worldgen-placement-providers

This commit is contained in:
DBotThePony 2025-03-08 19:24:19 +07:00
commit be97560f01
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 29 additions and 13 deletions

View File

@ -22,7 +22,7 @@ mixin_version=0.8.5
neogradle.subsystems.parchment.minecraftVersion=1.21.1 neogradle.subsystems.parchment.minecraftVersion=1.21.1
neogradle.subsystems.parchment.mappingsVersion=2024.11.17 neogradle.subsystems.parchment.mappingsVersion=2024.11.17
kommons_version=3.3.1 kommons_version=3.3.2
caffeine_cache_version=3.1.5 caffeine_cache_version=3.1.5
jei_version=19.16.4.171 jei_version=19.16.4.171

View File

@ -240,24 +240,40 @@ sealed class Decimal : Number(), Comparable<Decimal> {
return mag.signum() return mag.signum()
} }
private var intCache = 0
private var intComputed = false
override fun toInt(): Int { override fun toInt(): Int {
return if (whole > BI_INT_MAX) { if (!intComputed) {
Int.MAX_VALUE intCache = if (whole > BI_INT_MAX) {
} else if (whole < BI_INT_MIN) { Int.MAX_VALUE
Int.MIN_VALUE } else if (whole < BI_INT_MIN) {
} else { Int.MIN_VALUE
whole.toInt() } else {
whole.toInt()
}
intComputed = true
} }
return intCache
} }
private var longCache = 0L
private var longComputed = false
override fun toLong(): Long { override fun toLong(): Long {
return if (whole > BI_LONG_MAX) { if (!longComputed) {
Long.MAX_VALUE longCache = if (whole > BI_LONG_MAX) {
} else if (whole < BI_LONG_MIN) { Long.MAX_VALUE
Long.MIN_VALUE } else if (whole < BI_LONG_MIN) {
} else { Long.MIN_VALUE
whole.toLong() } else {
whole.toLong()
}
} }
return longCache
} }
override fun compareTo(other: Decimal): Int { override fun compareTo(other: Decimal): Int {