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