mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 20:05:02 -04:00
World Renderer: fix unloading of empty sections
This commit is contained in:
parent
553c7aeaa2
commit
a49fda2a24
@ -488,11 +488,11 @@ class WorldRenderer(
|
|||||||
if (section.blocks.fluidCount > 0) {
|
if (section.blocks.fluidCount > 0) {
|
||||||
fluidSectionPreparer.prepareFluid(item.chunkPosition, item.sectionHeight, chunk, section, neighbours, neighbourChunks, mesh)
|
fluidSectionPreparer.prepareFluid(item.chunkPosition, item.sectionHeight, chunk, section, neighbours, neighbourChunks, mesh)
|
||||||
}
|
}
|
||||||
|
runnable.interruptable = false
|
||||||
if (mesh.clearEmpty() == 0) {
|
if (mesh.clearEmpty() == 0) {
|
||||||
return queueItemUnload(item)
|
return queueItemUnload(item)
|
||||||
}
|
}
|
||||||
item.mesh = mesh
|
item.mesh = mesh
|
||||||
runnable.interruptable = false
|
|
||||||
meshesToLoadLock.lock()
|
meshesToLoadLock.lock()
|
||||||
if (meshesToLoadSet.remove(item)) {
|
if (meshesToLoadSet.remove(item)) {
|
||||||
meshesToLoad.remove(item) // Remove duplicates
|
meshesToLoad.remove(item) // Remove duplicates
|
||||||
@ -647,10 +647,10 @@ class WorldRenderer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var addedMeshes = 0
|
var addedMeshes = 0
|
||||||
val time = TimeUtil.millis
|
val start = TimeUtil.millis
|
||||||
val maxTime = if (connection.player.velocity.empty) 50L else 20L // If the player is still, then we can load more chunks (to not cause lags)
|
val maxTime = if (connection.player.velocity.empty) 50L else 20L // If the player is still, then we can load more chunks (to not cause lags)
|
||||||
|
|
||||||
while ((TimeUtil.millis - time < maxTime) && meshesToLoad.isNotEmpty()) {
|
while ((TimeUtil.millis - start < maxTime) && meshesToLoad.isNotEmpty()) {
|
||||||
val item = meshesToLoad.removeAt(0)
|
val item = meshesToLoad.removeAt(0)
|
||||||
meshesToLoadSet.remove(item)
|
meshesToLoadSet.remove(item)
|
||||||
val mesh = item.mesh ?: continue
|
val mesh = item.mesh ?: continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user