Skip to content

Commit ba6934e

Browse files
committed
fix search and other chunk based render modules not removing chunks when respawning at another location. SafeContext couldnt be created to call the original listeners because the player didnt exist so the unload events werent called
1 parent 2eda1b6 commit ba6934e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/kotlin/com/lambda/graphics/mc/renderer/ChunkedRenderer.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.lambda.event.events.TickEvent
2424
import com.lambda.event.events.WorldEvent
2525
import com.lambda.event.listener.SafeListener.Companion.listen
2626
import com.lambda.event.listener.SafeListener.Companion.listenConcurrently
27+
import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafe
2728
import com.lambda.graphics.RenderMain
2829
import com.lambda.graphics.mc.RegionRenderer
2930
import com.lambda.graphics.mc.RenderBuilder
@@ -78,8 +79,8 @@ class ChunkedRenderer(
7879
if (zInChunk == 15) world.getWorldChunk(pos.south())?.chunkData?.markDirty()
7980
}
8081

81-
owner.listen<WorldEvent.ChunkEvent.Load> { event -> event.chunk.chunkData.markDirty() }
82-
owner.listen<WorldEvent.ChunkEvent.Unload> { chunkMap.remove(it.chunk.chunkKey)?.clearData() }
82+
owner.listenUnsafe<WorldEvent.ChunkEvent.Load> { event -> event.chunk.chunkData.markDirty() }
83+
owner.listenUnsafe<WorldEvent.ChunkEvent.Unload> { chunkMap.remove(it.chunk.chunkKey)?.clearData() }
8384
owner.listen<WorldEvent.Player.Leave> { rebuild() }
8485

8586
owner.listenConcurrently<TickEvent.Pre> {

0 commit comments

Comments
 (0)