mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 02:45:13 -04:00
fix some world border bugs
This commit is contained in:
parent
3f30134896
commit
f3fab7dad8
@ -94,7 +94,7 @@ class WorldBorder {
|
||||
}
|
||||
|
||||
fun interpolate(oldRadius: Double, newRadius: Double, millis: Long) {
|
||||
if (millis == 0L) {
|
||||
if (millis <= 0L) {
|
||||
stopInterpolating()
|
||||
radius = newRadius
|
||||
}
|
||||
@ -115,6 +115,7 @@ class WorldBorder {
|
||||
}
|
||||
val time = millis()
|
||||
if (interpolationEnd <= time) {
|
||||
this.radius = newRadius // also get the last interpolation step
|
||||
state = WorldBorderState.STATIC
|
||||
interpolationStart = -1L
|
||||
lock.unlock()
|
||||
@ -124,12 +125,12 @@ class WorldBorder {
|
||||
|
||||
val remaining = interpolationEnd - time
|
||||
val totalTime = (interpolationEnd - interpolationStart)
|
||||
val radius = interpolateLinear(remaining.toDouble() / totalTime.toDouble(), this.newRadius, this.oldRadius)
|
||||
val radius = interpolateLinear(remaining.toDouble() / totalTime.toDouble(), this.oldRadius, this.newRadius)
|
||||
this.radius = radius
|
||||
|
||||
state = if (oldRadius > radius) {
|
||||
state = if (oldRadius > newRadius) {
|
||||
WorldBorderState.SHRINKING
|
||||
} else if (oldRadius < radius) {
|
||||
} else if (oldRadius < newRadius) {
|
||||
WorldBorderState.GROWING
|
||||
} else {
|
||||
interpolationStart = -1L
|
||||
|
Loading…
x
Reference in New Issue
Block a user