world border: don't render if more than 1000 blocks away

This commit is contained in:
Bixilon 2022-09-03 19:29:16 +02:00
parent a6347fe859
commit 304df9d189
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 4 additions and 1 deletions

View File

@ -98,7 +98,7 @@ class BlockSectionDataProvider(
return false
}
private fun BlockState?.isSolid(): Boolean {
private inline fun BlockState?.isSolid(): Boolean {
if (this == null) {
return false
}

View File

@ -42,6 +42,8 @@ class WorldBorderRenderer(
private val border = renderWindow.connection.world.border
private lateinit var texture: AbstractTexture
private var offsetReset = TimeUtil.millis
override val skipTranslucent: Boolean
get() = border.getDistanceTo(renderWindow.connection.player.position) > MAX_DISTANCE
override fun init(latch: CountUpAndDownLatch) {
shader.load()
@ -102,6 +104,7 @@ class WorldBorderRenderer(
val SHRINKING_COLOR = "#FF3030".asColor()
val STATIC_COLOR = "#20A0FF".asColor()
const val ANIMATION_SPEED = 2000
const val MAX_DISTANCE = 1000
private val TEXTURE = "minecraft:misc/forcefield".toResourceLocation().texture()